I have read http://www.statalist.org/forums/foru...293473-margins but the solution posted there (adding prefix i.) does not help in my case.
Data and specification
xi: svy: ivprobit sw_participate i.male i.i_age (i.i_msg_read=avg_logins)
sw_participate male are 0/1- indicators
age has 4 groups (min: 0, max 3)
avg_logins is continuous
Ideally, I would like to calculate the following margins command
margins i_msg_read, at(_Ii_age_1==1) at(_Ii_age_2==1) at(_Ii_age_3==1) baselevels vce(unconditional) asbalanced
'i_msg_read' not found in list of covariates
This error seems to have two dimensions, but not related to the instrumental variable (same for age, male etc.):
Question A: Why can I not calculate margins at specific points?
Even though I used the i. - specification, margins without the dydx option produces the error r(322)
E.g. does not work:
margins _Ii_msg_rea_1
margins _Ii_age_2
'_Ii_msg_rea_1' not found in list of covariates
E.g. works:
margins, dydx(_Ii_msg_rea_1)
margins, dydx(_Ii_msg_rea_1) at(_Ii_age_1==1) at(_Ii_age_2==1) at(_Ii_age_3==1) baselevels vce(unconditional) asbalanced
margins, dydx(_Ii_age_2)
Not very helpful since the marginal effect-value of msg_read is of course the same (average) value at all stages of age
Question B: Why do I have to enter the indicator variables created by xi ?
Entering the original i.variables name yields the same error r(322)
E.g. does not work:
margins, dydx(i_msg_read) baselevels vce(unconditional) asbalanced
margins, dydx( i_age) baselevels vce(unconditional) asbalanced
'i_age' not found in list of covariates
E.g. works:
margins, dydx(_Ii_msg_rea_1) baselevels vce(unconditional) asbalanced
margins, dydx( _Ii_age_2) baselevels vce(unconditional) asbalanced
Not very helpful since I am interested in _Ii_age_3 etc as well. Do I really have to enter them all separately?
I am sure I have overseen something obvious, but even after reading a lot, I cannot figure out what I missed.
Thank you for your help.
Data and specification
xi: svy: ivprobit sw_participate i.male i.i_age (i.i_msg_read=avg_logins)
sw_participate male are 0/1- indicators
age has 4 groups (min: 0, max 3)
avg_logins is continuous
Ideally, I would like to calculate the following margins command
margins i_msg_read, at(_Ii_age_1==1) at(_Ii_age_2==1) at(_Ii_age_3==1) baselevels vce(unconditional) asbalanced
'i_msg_read' not found in list of covariates
This error seems to have two dimensions, but not related to the instrumental variable (same for age, male etc.):
Question A: Why can I not calculate margins at specific points?
Even though I used the i. - specification, margins without the dydx option produces the error r(322)
E.g. does not work:
margins _Ii_msg_rea_1
margins _Ii_age_2
'_Ii_msg_rea_1' not found in list of covariates
E.g. works:
margins, dydx(_Ii_msg_rea_1)
margins, dydx(_Ii_msg_rea_1) at(_Ii_age_1==1) at(_Ii_age_2==1) at(_Ii_age_3==1) baselevels vce(unconditional) asbalanced
margins, dydx(_Ii_age_2)
Not very helpful since the marginal effect-value of msg_read is of course the same (average) value at all stages of age
Question B: Why do I have to enter the indicator variables created by xi ?
Entering the original i.variables name yields the same error r(322)
E.g. does not work:
margins, dydx(i_msg_read) baselevels vce(unconditional) asbalanced
margins, dydx( i_age) baselevels vce(unconditional) asbalanced
'i_age' not found in list of covariates
E.g. works:
margins, dydx(_Ii_msg_rea_1) baselevels vce(unconditional) asbalanced
margins, dydx( _Ii_age_2) baselevels vce(unconditional) asbalanced
Not very helpful since I am interested in _Ii_age_3 etc as well. Do I really have to enter them all separately?
I am sure I have overseen something obvious, but even after reading a lot, I cannot figure out what I missed.
Thank you for your help.
Comment