Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: How to make prediction after a spline regression


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: How to make prediction after a spline regression
Date   Tue, 13 Apr 2004 12:16:54 +0100

At 11:34 09/04/04 -0700, Shige wrote:
Dear All,

I would like to follow my previous question about how to use spline.
Suppose I create a spline using "frencurv" and then estimate a logistic
regression like this:

. frencurv, xvar(school) refpts(0(4)16) gen(sch) power(1)
. xtlogit unemp sch* X, re i(id) noconstant

How to generated predicted probablity so that I can create a two-way plot
of "prob(unemp) by school", like the one in pp.7 in bspline user guide?
Thank you very much!
Figure 3 in the -bspline- user guide was created using -predict- as follows (under Stata 6):

* frencurv with extended reference points (default) and cubic spline *
frencurv,xvar(weight) refpts(1760(770)4840) gen(cs) power(3)
describe cs*
regress mpg cs*,noconst robust
lincom cs3-cs5
predict mpghat3
grap mpg mpghat3 weight,s(o.) c(.L) xlab(1760(770)4840) ylab(0(5)45) t1(" ") l1("Mileage (mpg)") saving(fig3.gph,replace)

Therefore, use -predict- after -xtlogit- to get predicted probabilities in the usual way.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index