Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: AW: Predict command |
Date | Wed, 21 Apr 2010 20:52:33 +0530 |
I fully agree with Nick and Steve - you should probably not predict from a model by posting restrictions post-hoc. However, it is possible that interesting statistical properties (inconsistency results) can be derived. There are many ways to do what you want, and this in an ungainly way using Mata: ******************************************** clear* clear mata sysuse auto regress mpg weight c.weight#c.weight foreign turn mata vPval = 2*ttail(st_numscalar("e(df_r)"),abs(st_matrix("e(b)")' :/ diagonal(cholesky(diag(st_matrix("e(V)")))))) vSpval = mm_cond(vPval :< .05, 1, 0) // need Ben Jann's -moremata- package vBetaSelect = vSpval :* st_matrix("e(b)")' st_view(mData=., ., (st_macroexpand(regexr(regexr("`e(cmdline)'", "`e(depvar)'", ""), "`e(cmd)'", "")))) // this will choke on options mData = mData, J(rows(mData),1,1) vLinPredSelect = mData*vBetaSelect // compare with the full linear predictor stata("predict vLinPred, xb") st_view(vLinPred = ., ., "vLinPred") mm_plot((vLinPredSelect, vLinPred)) // need Ben Jann's -moremata- package end getmata vLinPredSelect ******************************************** T PS. The p-value line is due to M. Buis's article (Stata tip 53: Where did my p-values go?) in SJ (Vol. 7, No. 4). 2010/4/21 Steve Samuels <sjsamuels@gmail.com>: > I'm not Nick, but: No. > > On Wed, Apr 21, 2010 at 9:14 AM, Rasika Raghavan <rasikarag@gmail.com> wrote: >> Nick, >> >> Anyway I can do so without re-running the model? >> >> Rasika >> * >> * 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/ >> > > > > -- > Steven Samuels > sjsamuels@gmail.com > 18 Cantine's Island > Saugerties NY 12477 > USA > Voice: 845-246-0774 > Fax: 206-202-4783 > > * > * 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/ > -- To every ω-consistent recursive class κ of formulae there correspond recursive class signs r, such that neither v Gen r nor Neg(v Gen r) belongs to Flg(κ) (where v is the free variable of r). * * 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/