Now, I know I have yet to imbibe my full daily dose of caffeine, and maybe I didn't get as many hours of sleep last night as I should have. But for the life of me, I do not see what I am doing wrong here:
is my data set.
It is hard for me to imagine there is a bug in a straightforward, and ancient function like diag().
Evidently the workaround is to just construct D element by element, and I have done that and can move forward. But I really don't get what I'm doing wrong here. Does anyone see it?
Added: Even more puzzling: although -diag()- chokes on this matrix, -syminv()- has no problem with it.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13) 35.49362 6.902328 10.190154 9.059019 4.90965 -14.830358 -33.51197 -29.69985 -10.174074 -.5877179 .6048743 .030278724 -.02317784 6.902328 33.360325 2.3703847 2.409502 3.867615 -27.242607 -4.16133 -3.7759824 -3.7173665 2.631272 1.0363309 -.170952 -.0239322 10.190154 2.3703847 19.771967 14.099613 -.3304263 -.8716252 -15.14319 -9.384815 .56452847 -.04007869 -.1524103 .02515032 -.004933141 9.059019 2.409502 14.099613 28.527035 -3.2938886 -2.409359 -9.517553 -22.279425 2.6908784 .1336752 -.8775372 .013183976 -.04381609 4.90965 3.867615 -.3304263 -3.2938886 18.270546 -2.937681 -1.941296 1.8324593 -16.78055 .16291936 .11271199 .05821532 -.007008217 -14.830358 -27.242607 -.8716252 -2.409359 -2.937681 51.1867 7.054405 8.733149 9.753474 2.0740674 -.3768104 .0627132 .02383808 -33.51197 -4.16133 -15.14319 -9.517553 -1.941296 7.054405 46.93388 28.170256 .06202966 .4026062 -.17233193 -.071465515 .009773405 -29.69985 -3.7759824 -9.384815 -22.279425 1.8324593 8.733149 28.170256 60.49548 -5.147311 -.12426873 -.1322009 -.027954483 .06627995 -10.174074 -3.7173665 .56452847 2.6908784 -16.78055 9.753474 .06202966 -5.147311 43.08675 .14523736 .10655335 .01136777 .05028607 -.5877179 2.631272 -.04007869 .1336752 .16291936 2.0740674 .4026062 -.12426873 .14523736 7.743637 .10186014 .004620384 .0025797726 .6048743 1.0363309 -.1524103 -.8775372 .11271199 -.3768104 -.17233193 -.1322009 .10655335 .10186014 .6255068 -.0016476278 .0015802446 .030278724 -.170952 .02515032 .013183976 .05821532 .0627132 -.071465515 -.027954483 .01136777 .004620384 -.0016476278 .014333568 .0008621671 -.02317784 -.0239322 -.004933141 -.04381609 -.007008217 .02383808 .009773405 .06627995 .05028607 .0025797726 .0015802446 .0008621671 .03381956 end
Code:
. about Stata/MP 14.2 for Windows (64-bit x86-64) Revision 16 Mar 2017 Copyright 1985-2015 StataCorp LLC Total physical memory: 8269900 KB Available physical memory: 3129912 KB Single-user 2-core Stata perpetual license: Serial number: REDACTED Licensed to: Clyde Schechter Albert Einstein College of Medicine . . count 13 . assert r(N) == 13 . des, short Contains data obs: 13 vars: 13 size: 676 Sorted by: Note: Dataset has changed since last saved. . assert r(k) == 13 . . mkmat A*, matrix(V) . . local r = rowsof(V) . local c = colsof(V) . assert `r' == `c' . . . matrix D = diag(V) conformability error r(503);
Evidently the workaround is to just construct D element by element, and I have done that and can move forward. But I really don't get what I'm doing wrong here. Does anyone see it?
Added: Even more puzzling: although -diag()- chokes on this matrix, -syminv()- has no problem with it.
Comment