Dear statalisters,
I am trying to obtain the percentages from a tabm table that uses weights and I get some precision error. You can see that for variable r12 and Categ5, the proportion is 53.85%. However, if I try to calculate this same proportion using the results stored by matcell(), the resulting proportion is 53.83. Is there any way to make matcells() store more decimals?
Below you have my code and results:
. tabm r1-r12 [aw=wgt], row nofreq matcell(freqs)
| values
variable | Categ1 Categ2 Categ3 Categ4 Categ5 | Total
------------------+-------------------------------------------------------+----------
r1 | 0.00 0.00 0.71 45.33 53.96 | 100.00
r2 | 0.00 0.00 1.93 44.11 53.96 | 100.00
r3 | 0.00 0.00 4.21 41.83 53.96 | 100.00
r4 | 4.83 1.48 0.69 39.15 53.85 | 100.00
.. | .... .... .... ..... ..... | ......
r12 | 0.00 0.00 0.00 46.15 53.85 | 100.00
------------------+-------------------------------------------------------+----------
Total | 1.76 0.80 1.47 42.09 53.88 | 100.00
. mat li freqs
freqs[12,5]
c1 c2 c3 c4 c5
r1 0 0 18.687787 1194.2136 1421.6247
r2 0 0 50.843143 1162.0582 1421.6247
r3 0 0 110.89391 1102.0074 1421.6247
r4 127.37912 39.013458 18.216818 1033.5905 1421.6247
.................................................. .......
r12 58.60397 45.169448 74.980403 1039.4461 1421.6247
mat percent = 100*freqs/2641
. mat li percent
percent[12,5]
c1 c2 c3 c4 c5
r1 0 0 .7076027 45.218234 53.829032
r2 0 0 1.9251474 44.000689 53.829032
r3 0 0 4.1989364 41.7269 53.829032
r4 4.8231396 1.4772229 .68976971 39.136331 53.829032
.................................................. .......
r12 2.2190068 1.7103161 2.8390914 39.358049 53.829032
Thank you in advance,
Aina
Related Posts with Getting more decimals from matcell
Hausman test/Estimating pmg,mg, dfe Good afternoon I am estimating a dynamic model with pmg, mg and dfe. the study has to do with the …
Cross tabulations based on multiple dummy variablesHello, I have a large dataset for N= 59,000,000 observations. I have 154 dummy variables relating …
Subsample dataset under multiple conditionsWindows 10 Stata 16 Code: * Example generated by -dataex-. To install: ssc install dataex clear in…
Looping to create a difference scoreHello all, I am working on a project where I need difference scores. I will have a number of differ…
Endogeneity & dropping of constraintsHi, I am doing Durbin–Wu–Hausman test to test my independent variables for endogeniety. My data is…
Subscribe to:
Post Comments (Atom)
0 Response to Getting more decimals from matcell
Post a Comment