Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: adjust and margins


From   Richard Williams <richardwilliams.ndu@gmail.com>
To   statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu
Subject   Re: st: adjust and margins
Date   Thu, 03 Oct 2013 10:03:08 -0500

The lack of a gen option is a disappointing limitation of margins. But, you might be able to do something like the following:

clonevar xfemale = female
reg y i.xfemale x1 x2 x3
replace xfemale = 0
predict yhatmale
replace xfemale = 1
predict yhatfemale

In other words, run the regression, set variables to the values you want, and then do a predict. Change the values to something else if so desired and do a new predict. I used clonevar so I wouldn't wipe out the original variables, but you can also do things like preserve and restore.


At 07:05 AM 10/3/2013, Marnix Zoutenbier wrote:
Dear all,

After an anova command, I want to predict with some of the factors at
specific levels overruling the level specified in the variable. I also need
the resulting predictions in a new variable. I was used to work with the

adjust ....., gen(newvar)

conctruction.

What I read in the help and FAQs is (summarized)
- margins is the successor of adjust
- margins can not be combined with the option "gen(newvar)"
- "adjust will often fail if you do not run your estimation command under
version control, with the version set to less than 11"

I am wondering if there exists a Stata 13 construct that I can use.

If not, is there some source that is more specific about the conditions
uder which adjust does/does not work?

Thank you in advance for your consideration,

Best regards

Marnix





______________________

Drs. Marnix Zoutenbier MTD CIRM
Principal Consultant

T: +31 (0)40 750 23 25
F: +31 (0)40 750 16 99
E: zoutenbier@cqm.nl

CQM B.V.
PO Box 414, 5600 AK Eindhoven, The Netherlands
Vonderweg 16, 5616 RM Eindhoven, The Netherlands
KvK 17076484
I: www.cqm.nl

I am out of office Monday afternoon

N.B. U bent van harte welkom bij CQM op stand 04C031 tijdens de ICT &
Logistiek op 30 & 31 oktober 2013 in Jaarbeurs Utrecht. Klik hier voor een
gratis toegangsbadge.



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index