Hello,
I am using a survey that recommends the follow syntax for weighted analysis when using replicate weights:
svyset[pweight=perwt], vce(brr) brrweight(repwtp1-repwtp80) fay(.5)mse
After my regression, I want to compute margins with standard errors based on balanced repeated replications (brr). I followed the advice on the Stata manual svy.pdf page 115.
Here is my code:
capture program drop mymargins
program mymargins, eclass
version 13
syntax anything [if] [iw pw]
if "`weight'" != "" {
local wgtexp "[`weight' `exp']"
}
set buildfvinfo on
`anything' `if' `wgtexp'
margins groups1, at (age=(50(5)80))subpop(samp) atmeans
end
svyset[pweight=perwt], vce(brr) brrweight(repwtp1-repwtp80) fay(.5)mse
local mycmdline svy, subpop(samp): logistic physdis ib4.groups1 age female
quietly mymargins `mycmdline'
svy brr _b: mymargins `mycmdline'
However, I am getting an error that says "options not allowed r(101);" after the line quietly mymargins `mycmdline'
Thanks a lot for your help,
Susana
I am using a survey that recommends the follow syntax for weighted analysis when using replicate weights:
svyset[pweight=perwt], vce(brr) brrweight(repwtp1-repwtp80) fay(.5)mse
After my regression, I want to compute margins with standard errors based on balanced repeated replications (brr). I followed the advice on the Stata manual svy.pdf page 115.
Here is my code:
capture program drop mymargins
program mymargins, eclass
version 13
syntax anything [if] [iw pw]
if "`weight'" != "" {
local wgtexp "[`weight' `exp']"
}
set buildfvinfo on
`anything' `if' `wgtexp'
margins groups1, at (age=(50(5)80))subpop(samp) atmeans
end
svyset[pweight=perwt], vce(brr) brrweight(repwtp1-repwtp80) fay(.5)mse
local mycmdline svy, subpop(samp): logistic physdis ib4.groups1 age female
quietly mymargins `mycmdline'
svy brr _b: mymargins `mycmdline'
However, I am getting an error that says "options not allowed r(101);" after the line quietly mymargins `mycmdline'
Thanks a lot for your help,
Susana
Comment