Forum Replies Created
-
AuthorPosts
-
I have added
xtmlogit
to asdocx in its latest update. You can update and try it. Here is an examplewebuse estatus xtset id asdocx xtmlogit estatus i.hhchild age hhincome i.hhsigno i.bwinner , label abb(.)
Random-effects multinomial logistic regressionestatus Coef. St.Err. t-value p-value [95% Co Interval] Sig Children <18 years old in household : base No 0 . . . . . Yes 0.463 0.096 4.81 0 0.274 0.652 *** Age (in years) -0.005 0.007 -0.73 0.468 -0.018 0.008 Annual household income (in $1,000s) -0.005 0.002 -2.55 0.011 -0.008 -0.001 ** Significant other living in household : base No 0 . . . . . Yes 0.497 0.095 5.25 0 0.311 0.682 *** Primary/sole breadwinner in household : base No 0 . . . . . Yes -0.474 0.073 -6.51 0 -0.617 -0.331 *** Constant -0.479 0.285 -1.68 0.092 -1.036 0.079 * Children <18 years old in household : base No 0 . . . . . Yes -0.04 0.12 -0.34 0.737 -0.275 0.194 Age (in years) 0.004 0.008 0.52 0.602 -0.012 0.02 Annual household income (in $1,000s) -0.031 0.003 -11.63 0 -0.036 -0.026 *** Significant other living in household : base No 0 . . . . . Yes 0.097 0.119 0.81 0.417 -0.137 0.331 Primary/sole breadwinner in household : base No 0 . . . . . Yes -0.225 0.095 -2.37 0.018 -0.412 -0.039 ** Constant -0.095 0.351 -0.27 0.786 -0.783 0.592 var(u1) 0.859 0.109 .b .b 0.67 var(u2) 0.737 0.139 .b .b 0.509 1.066 Prob > chi2 Akaike crit. (AIC) 8965.683 I think what you are asking for is available in the reg1 template.
See details here https://asdocx.com/creating-and-working-with-asdocx-template-files/reg1-template-of-asdocx-regression-for-epidemiology/.asdocx nbreg daysabs mathnce langnce female , irr template(reg1)
An example of using the reg1 template command and its results are given below.
Table: Regression Results – daysabsVariable OR [95% CI] P-value ctbs math nce 0.998 [0.989, 1.008] 0.741 ctbs lang nce 0.986 [0.975, 0.997] 0.010 female 1.539 [1.171, 2.024] 0.002 Constant 9.825 [6.511, 14.824] 0.000 /lnalpha 0.253 [0.066, 0.441] .b _diparm1:alpha 1.288 [1.068, 1.554] .b Observations 316 Seems you need the
tableonly
option, that creates just the table without the file header and package list. For exampleasdocx cor Diaper GetupNight PutBabyToSleep PlayWithBaby , /// save(CorrCaringWork.tex) abb(.) title(\notitle) replace tableonly
Also, in the master file where you call the input(), you should include the following lines to the package list
\usepackage{tabularx, booktabs, threeparttable, caption} \captionsetup{font=bf, aboveskip=1ex, belowskip=2ex} \usepackage{multirow}
I shall look into the table
title(\i)
, obviously, it is not working.Adding support for
factor
will take some time. However, you can quickly export the tables of factor command using thewmat
command of asdocx, that is writing matrix. See this example.* Load example data webuse bg2, clear * Run the factor command factor bg2cost1-bg2cost6 * Save the matrix in L mat L = e(L) * Export the matrix with asdocx using wmat command asdocx wmat, mat(L) replace title(Factor loadings (pattern matrix)
Factor loadings (pattern matrix) and unique variancesFactor1 Factor2 Factor3 bg2cost1 0.247 0.367 -0.045 bg2cost2 -0.337 0.332 -0.077 bg2cost3 -0.376 0.376 0.02 bg2cost4 -0.322 0.194 0.103 bg2cost5 0.455 0.248 0.064 bg2cost6 0.476 0.236 -0.007 in reply to: xtgcause not working with asdocx #16431The command xtgcause is not a Stata official command. Hence asdocx is not aware of that. The help file of xtgcause shows that the command leaves scalar in r(), and hence these can be written with flexmat and then exported with asdocx. Here is an example.
The dataset Data_demo.xls used in this example is provided by Dumitrescu and Hurlin at
http://www.runmycode.org/companion/view/42, along with a few results.. import excel using Data_demo.xls, clear . ren (A-J) x#, addnumber . ren (K-T) y#, addnumber . gen t = _n . reshape long x y, i(t) j(id) . xtset id t . xtgcause y x, lag(1)
Now create the table from the scalars with flexmat
flexmat reset flexmat addrow, data(Lag order, `r(lags)', \empty, \empty) row(1) flexmat addrow, data(W-bar, `r(wbar)', \empty, \empty) row(2) dec(3) flexmat addrow, data(Z-bar, `r(zbar)', p-value, `r(zbar_pv)') row(3) dec(3) flexmat addrow, data(Z-bar tilde, `r(zbart)', p-value, `r(zbart_pv)') row(4) dec(3) asdocx export
Table: ResultsLag order 1 W-bar 1.291 Z-bar 0.650 p-value 0.515 Z-bar tilde 0.259 p-value 0.796 I have now updated the core of asdocx. It handles the interaction terms in a graceful manner. Following are few examples.
asdocx_update webuse nhanes2b * Interaction of continuous variables asdocx reg hgb hdresult c.tgresult#c.weight , nest replace abb(.) asdocx reg hgb hdresult c.tgresult#c.hct , nest abb(.)
Table: Regression results(1) (2) hgb hgb hdresult -0.019*** -0.016*** (0.002) (0.001) tgresult × weight 0*** (0) tgresult × hct 0*** (0) Intercept 14.951*** 14.575*** (0.096) (0.096) Observations 4222 4222 R\super2 0.08 0.107 Table: Regression results(1) (2) hgb hgb hdresult -0.013*** -0.009*** (0.001) (0.001) sex × tgresult 0.004*** (0) Female × tgresult -0.003*** (0) sex × tibc 0.004*** (0) Female × tibc 0 (0) Intercept 14.79*** 14.076*** (0.09) (0.09) Observations 4222 8720 R\super2 0.23 0.322 I have update the asdocx package. The update adds a new sub-command
change(old, new)
to flexmat to find and replace existing string with new string. Therefore, if you want to change the#
withx
, the option change will be used aschange("#", " x ")
. See the following example*update asdocx asdocx_update * Load example data sysuse auto * Estimate a regression with interaction terms asdocx reg price c.turn#c.trunk, replace nest 0 |1 2 ----+----------------------------------------------------------------------------- 1 | (1) 2 | price ----+----------------------------------------------------------------------------- 3 |c.turn#c.trunk 4.737*** 4 | (1.515) 5 |Intercept 3528.565*** 6 | (903.25) 7 |Observations 74 8 |R2 0.12 ---------------------------------------------------------------------------------- * Replace the # string with x flexmat change(#, " x ") 0 |1 2 ----+----------------------------------------------------------------------------- 1 | (1) ----+----------------------------------------------------------------------------- 2 | price 3 |c.turn x c.trunk 4.737*** 4 | (1.515) 5 |Intercept 3528.565*** 6 | (903.25) 7 |Observations 74 8 |R\super2 0.12 ---------------------------------------------------------------------------------- * Replace c. string with empty flexmat change(c., "") * Finally, export the modified table asdocx export
asdocx can report lables for variables, but not for interaction terms. You can suggest any standard practice in your field and I shall try to come up with a solution. For this, you may refer a paper or send your own example to show how interaction terms should be reported.
in reply to: margins function not complying with asdocx #16413margins is still in the beta version. You can update to beta version by
asdocx_update, beta
This is documented in the flexmat help file.
help flexmat
Section 9 of the help file reads
9. addparts:
Sub-command addparts with optionnotes(Table notes text)
adds table notes to the current table. Table notes appear at the bottom of the
table when the table is exported with asdocx. When sub-command addparts is used with optiontitle(Table title text)
, it sets the table
title.flexmat reset mat A = (1,2,3\ 4,5,6\ 7,8,9) matrix rownames A = myrow1 myrow2 myrow3 mat colnames A = mycol1 mycol2 mycol3 flexmat addmat, matname(A) flexmat addparts, title(My Stata matrix) notes(My notes from flexmat) My Stata matrix 0 |1 2 3 4 ----+------------------------------------------------------------------ 1 | mycol1 mycol2 mycol3 ----+------------------------------------------------------------------- 2 |myrow1 1 2 3 3 |myrow2 4 5 6 4 |myrow3 7 8 9 ------------------------------------------------------------------------ My notes from flexmat
This issue is now fixed in the asdocx beta version. I have added the new features to the beta version of asdocx. All new features are first added to the beta version. Once that version is stable, it is released as a regular version. To install the new version, copy and paste the following line in Stata and press enter.
asdocx_update, beta
Restart Stata after installation of the new version.
Here is an example
mat A = (1,2,3\ 4,5,6\ 7,8,9) matrix rownames A = myrow1 myrow2 myrow3 mat colnames A = mycol1 mycol2 mycol3 flexmat addmat, matname(A) 0 |1 2 3 4 ----+-------------------------------------------------------------------- 1 | mycol1 mycol2 mycol3 ----+--------------------------------------------------------------------- 2 |myrow1 1 2 3 3 |myrow2 4 5 6 4 |myrow3 7 8 9 ---------------------------------------------------------------------------
in reply to: flexmat_to_excel error when using table1 template #16401Please update to the beta version.
asdocx_update, beta which asdocx *!-------------------------------------------------------------------------------------+ *! Feb 24, 2022: Version 2.0.2 : Option sheet(name) add, it works with excel files. | *! Attaullah Shah; attaullah.shah@imsciences.edu.pk | *! Tenured Associate Professor: Institute of Management Sciences, Peshawar, Pakistan. | *!-------------------------------------------------------------------------------------+
in reply to: Request for user command gologit2 support #16368I have added gologit2 to asdocx. Since the output of the gologit2 comprises of three groups of estimates, asdocx add the group name as a prefix, that is fair, average, good. See this example
*Update asdocx asdocx_update * Use example data webuse fullauto *Add three nested models asdocx gologit2 rep77 i.foreign length mpg, replace nest asdocx gologit2 rep77 i.foreign length mpg trunk , nest asdocx gologit2 rep77 i.foreign mpg trunk , nest
Table: Regression results(1) (2) (3) rep77 rep77 rep77 0bn.foreign 1.foreign 3.07 167.059 -1.596 (7.081) (38570.529) (1.601) length 0.447 17.56 (0.316) (3337.642) mpg 0.505 24.289 -0.444 (0.851) (7408.473) (0.45) trunk -23.61 -0.097 (3518.731) (0.281) Intercept -89.731 -3524.318 13.323 (63.983) (744600.61) (12.56) Fair:0bn.foreign Fair:1.foreign 2.42* 1.861 1.213 (1.346) (1.341) (0.904) Fair:length 0.054 0.028 (0.042) (0.051) Fair:mpg 0.26 0.279 0.224** (0.159) (0.176) (0.113) Fair:trunk 0.108 0.182* (0.134) (0.107) Fair:Intercept -14.632 -11.379 -5.968* (11.076) (12.276) (3.335) Average:0bn.foreign Average:1.foreign 3.569*** 3.37*** 1.524** (1.077) (1.09) (0.728) Average:length 0.123*** 0.122*** (0.039) (0.043) Average:mpg 0.358*** 0.372*** 0.094 (0.132) (0.137) (0.059) Average:trunk 0.005 0.177* (0.118) (0.092) Average:Intercept -32.637*** -32.861*** -5.5** (10.241) (10.664) (2.27) Good:0bn.foreign Good:1.foreign 19.883 24.247 20.503 (1501.655) (7320.255) (2304.349) Good:length 0.058 0.038 (0.057) (0.069) Good:mpg 0.001 -0.032 -0.053 (0.12) (0.125) (0.085) Good:trunk 0.197 0.241 (0.217) (0.205) Good:Intercept -30.528 -32.583 -22.73 (1501.716) (7320.271) (2304.351) Observations 66 66 66 Pseudo R2 0.276 0.329 0.154 Hello Johanna
I have added margins to the asdocx. Now you can report a detailed table of margins [see this post ] or a nested table of margins [see this post ]in reply to: Table1 reporting unique missing value frequencies #16357Please post your code to reproduce the error. For dropping the p-values column, you can use flexmat to modify the table created by asdocx. To know more about flexmat, you may like to read these entries.
Here is an example that deletes the p-value column.sysuse nlsw88 *Since the p-values are in the 5th column, drop column 5. flexmat dropcol, col(5) *Export the modified table with asdocx asdocx export
Table 1: DemographicsVariables single (n=804) married (n = 1442) Total (2246) race 1.40 (1.37 – 1.44) 1.21 (1.19 – 1.24) 1.28 (1.26 – 1.30) current grade completed 01 (0.04%) 1 (0.04%) 2 (0.09%) 42 (0.09%) 1 (0.04%) 3 (0.13%) 50 (0.00%) 1 (0.04%) 1 (0.04%) 68 (0.36%) 6 (0.27%) 14 (0.62%) 79 (0.40%) 10 (0.45%) 19 (0.85%) 815 (0.67%) 18 (0.80%) 33 (1.47%) 923 (1.02%) 32 (1.43%) 55 (2.45%) 1026 (1.16%) 58 (2.58%) 84 (3.74%) 1145 (2.01%) 78 (3.48%) 123 (5.48%) 12325 (14.48%) 618 (27.54%) 943 (42.02%) 1360 (2.67%) 116 (5.17%) 176 (7.84%) 1475 (3.34%) 112 (4.99%) 187 (8.33%) 1533 (1.47%) 59 (2.63%) 92 (4.10%) 1682 (3.65%) 170 (7.58%) 252 (11.23%) 1734 (1.52%) 72 (3.21%) 106 (4.72%) 1865 (2.90%) 89 (3.97%) 154 (6.86%) lives in south 0464 (20.66%) 840 (37.40%) 1304 (58.06%) 1340 (15.14%) 602 (26.80%) 942 (41.94%) college graduate not college grad616 (27.43%) 1098 (48.89%) 1714 (76.31%) college grad188 (8.37%) 344 (15.32%) 532 (23.69%) -
AuthorPosts