Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Michael Harhay <michael.harhay@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Predicted values where a subgroup of variables are held constant |
Date | Thu, 17 Mar 2011 17:11:12 -0400 |
Dear all, I want to do a straightforward xb prediction after an OLS regression on a patient population, but for a subgroup of variables I want to use the sample mean not the true individual value for the prediction: I've been playing with both the "predict" and "margins" command but with no success. Is there an "if" like command I can put after predict to force this? After no success trying that I also tried to go about this in a roundabout way: preserve foreach var of local varlist `pred' { sum `var’, meanonly replace `var’ = r(mean) } predict sev5, xb The predictions are still not adjusted. Any quick thoughts? Thanks! * * 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/