I am having trouble pulling parts of a matrix after running svy: mean on a stratified simple random sample I have drawn. I am using postfile and post commands and it seems to work inconsistently. There is clearly something I don't understand about the naming and calling of the values I am interested in. Hope someone can help.
The following works:
However, the following does not work --- it fails on the V_srs term:
it results in
Interestingly, there is no "se" matrix listed when I type ereturn list but there is a e(b) and e(V_srs) and both can be displayed as shown below while e(se) can not.
The following works:
postfile buffer mhat sehat using mcs_SSRS
..... draw sample.....
svyset [pweight=wt], strata(strata) fpc(fpc)
svy: mean y
post buffer (_b[y]) (_se[y])
postclose buffer
..... draw sample.....
svyset [pweight=wt], strata(strata) fpc(fpc)
svy: mean y
post buffer (_b[y]) (_se[y])
postclose buffer
However, the following does not work --- it fails on the V_srs term:
postfile buffer mhat sehat V_srshat using mcs_SSRS
..... draw sample.....
svyset [pweight=wt], strata(strata) fpc(fpc)
svy: mean y
post buffer (_b[y]) (_se[y]) (_V_srs[y])
postclose buffer
..... draw sample.....
svyset [pweight=wt], strata(strata) fpc(fpc)
svy: mean y
post buffer (_b[y]) (_se[y]) (_V_srs[y])
postclose buffer
_V_srs not found
post: above message corresponds to expression 3, variable V_srshat
r(111);
post: above message corresponds to expression 3, variable V_srshat
r(111);
Interestingly, there is no "se" matrix listed when I type ereturn list but there is a e(b) and e(V_srs) and both can be displayed as shown below while e(se) can not.
ereturn list
scalars:
e(df_r) = 109
e(N_strata_omit) = 0
e(singleton) = 0
e(census) = 0
e(N_pop) = 5616.000091552734
e(N_psu) = 111
e(N_strata) = 2
e(N_over) = 1
e(N) = 111
e(stages) = 1
e(k_eq) = 1
e(rank) = 1
macros:
e(cmdline) : "svy : mean y"
e(cmd) : "mean"
e(prefix) : "svy"
e(cmdname) : "mean"
e(command) : "mean y,"
e(title) : "Survey: Mean estimation"
e(vcetype) : "Linearized"
e(vce) : "linearized"
e(estat_cmd) : "svy_estat"
e(varlist) : "y"
e(marginsnotok) : "_ALL"
e(wtype) : "pweight"
e(wvar) : "wt"
e(wexp) : "= wt"
e(singleunit) : "missing"
e(strata1) : "strata"
e(fpc1) : "fpc"
e(properties) : "b V"
matrices:
e(b) : 1 x 1
e(V) : 1 x 1
e(_N_subp) : 1 x 1
e(V_srswr) : 1 x 1
e(V_srs) : 1 x 1
e(_N) : 1 x 1
e(error) : 1 x 1
e(_N_strata_certain) : 1 x 1
e(_N_strata_single) : 1 x 1
e(_N_strata) : 1 x 1
functions:
e(sample)
scalars:
e(df_r) = 109
e(N_strata_omit) = 0
e(singleton) = 0
e(census) = 0
e(N_pop) = 5616.000091552734
e(N_psu) = 111
e(N_strata) = 2
e(N_over) = 1
e(N) = 111
e(stages) = 1
e(k_eq) = 1
e(rank) = 1
macros:
e(cmdline) : "svy : mean y"
e(cmd) : "mean"
e(prefix) : "svy"
e(cmdname) : "mean"
e(command) : "mean y,"
e(title) : "Survey: Mean estimation"
e(vcetype) : "Linearized"
e(vce) : "linearized"
e(estat_cmd) : "svy_estat"
e(varlist) : "y"
e(marginsnotok) : "_ALL"
e(wtype) : "pweight"
e(wvar) : "wt"
e(wexp) : "= wt"
e(singleunit) : "missing"
e(strata1) : "strata"
e(fpc1) : "fpc"
e(properties) : "b V"
matrices:
e(b) : 1 x 1
e(V) : 1 x 1
e(_N_subp) : 1 x 1
e(V_srswr) : 1 x 1
e(V_srs) : 1 x 1
e(_N) : 1 x 1
e(error) : 1 x 1
e(_N_strata_certain) : 1 x 1
e(_N_strata_single) : 1 x 1
e(_N_strata) : 1 x 1
functions:
e(sample)
matrix list e(b)
symmetric e(b)[1,1]
y
y1 .31518578
matrix list e(V_srs)
symmetric e(V_srs)[1,1]
y
y .01460002
matrix list e(se)
matrix e(se) not found
r(111);
.
symmetric e(b)[1,1]
y
y1 .31518578
matrix list e(V_srs)
symmetric e(V_srs)[1,1]
y
y .01460002
matrix list e(se)
matrix e(se) not found
r(111);
.
Comment