I tried to calculate the margins for a variable in Stata 12, after running a multilevel regression with the xtlogit
command. But, although I used the margins
command right after running the regression, I still received an error, saying that my variable was not found in a list of covariates. Here is a simplified version of my code:
. use http://url.com/file.dta, clear
. xtset country
. xtlogit dv iv1 iv2 iv3 iv4 iv5
. margins iv1, at(iv2==(0(1)6))
'iv1' not found in list of covariates
r(322);
Interestingly, Stata does not give any errors when I use the margins
command in a format that requires a comma after it. For example, the following two lines of code work without any problems:
margins, at(iv2=(0(1)6)) over(iv1)
margins, dydx(iv1) at(iv2=(0(1)6))
I have seen this previous post from March 2013, but I still cannot figure out how I can solve this problem: Stata error: not found in list of covariates
margins iv1, at(iv2==(0(1)6))
to produce? It's obvious to me why it errors, but the goal is not clear, so the solution is out of reach. – Dimitriy V. Masterovmarginsplot
. – neutralmargins, dydx(iv1) at(iv2=(0(1)6))
suit your purpose? – Dimitriy V. Masterov