Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Amy Hsin <hsin.amy@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Margins error |
Date | Mon, 2 Jul 2012 15:09:29 +0200 |
Issa, I have essentially abandoned the margins command and gone back to using the adjust command. I am trying to calculate predicted values so the adjust command is sufficient for my purposes. What it lacks is the ability to support factors (i.e. ## functions) but after several days and no luck, I went the brute force approach and generated all my interactions by manually. If what you wish to accomplish can be done by adjust, I would suggest that you use it instead. I found the STATA help for adjust to be more useful. Otherwise, perhaps other who are more advanced programmers than I can offer you more help. Good luck, Amy On Mon, Jul 2, 2012 at 2:58 PM, Issa Kohler-Hausmann <ikh210@nyu.edu> wrote: > Thanks Amy, I am suddenly having luck with the following syntax but I am now trying to figure out conceptually what the right one would be to use: > > margins r.arrestnum_cat@p_misdcon_cat, at(arr_re_combi=2 male =1 p_felcon=0 MisdArr=1) > > margins arrestnum_cat, at(p_misdcon_cat=(0 1)) at(arr_re_combi=2 male =1 p_felcon=0 MisdArr=1) > > Are you having any luck? I guess I am still confused about what the different forms mean. > > Thanks much, > - issa > > > On Jul 1, 2012, at 12:16 PM, Amy Hsin wrote: > >> You may want to read the thread "generating predicted values for >> growth models" that was posted yesterday. I had similar problems with >> the margins command using xi. >> >> Maarten and William's suggest was to drop the xi (see the response for >> details). That worked to a degree. >> >> However, I am still having problems with the margins command to >> generate predictions and am hoping to receive some help. >> >> Amy >> >> On Sun, Jul 1, 2012 at 5:39 PM, Issa Kohler-Hausmann <ikh210@nyu.edu> wrote: >>> Hello - >>> >>> I am sorry if this is a dumb question but I have having trouble with the "margins" command after running a logistic regression and I cannot figure out what I am misunderstanding. >>> >>> I am trying to graph the effect of the number of misdemeanor convictions (p_misdcon_cat) on the likelihood of conviction to a misdemeanor crime (outcome --> convict_Misd). The problem (it seems to me) is that STATA does not recognize the variables for purposes of the margins command that were generated using xi. logit and I don't know any other way of doing this. It also seems from all of the examples online that this should work. >>> >>> I ran the following logic model: >>> >>> . xi: logit convict_Misd i.race_eth_cat male p_felcon i.p_misdcon_cat arrestnum_cat MisdArr, cluster(my_case_id) >>> >>> I then get the following errors when I try the margins command evaluated at specified levels of my covariates. >>> >>> . margins, dydx(p_misdcon_cat) at (_Irace_eth__2=1 male=1 p_felcon=0 arrestnum_cat=4 MisdArr=1) >>> 'p_misdcon_cat' not found in list of covariates >>> r(322); >>> >>> . >>> . margins p_misdcon_cat, at (_Irace_eth__2=1 male=1 p_felcon=0 arrestnum_cat=4 MisdArr=1) >>> 'p_misdcon_cat' not found in list of covariates >>> r(322); >>> >>> Any help would be greatly appreciated! >>> >>> Thank you >>> >>> >>> >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/statalist/faq >>> * http://www.ats.ucla.edu/stat/stata/ >> >> >> >> -- >> Amy Hsin >> Assistant Professor of Sociology >> Queens College, City University of New York >> http://qcpages.qc.cuny.edu/~ahsin >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/statalist/faq >> * http://www.ats.ucla.edu/stat/stata/ > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ -- Amy Hsin Assistant Professor of Sociology Queens College, City University of New York http://qcpages.qc.cuny.edu/~ahsin * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/