Statalist


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

Re: st: Confidence bounds for truncated regression with cubic splines


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Confidence bounds for truncated regression with cubic splines
Date   Thu, 3 Dec 2009 03:30:45 -0800 (PST)

--- On Thu, 3/12/09, Georg Pfundstein wrote:
> I am running a truncated regression with cubic splines,
> which works quite well i think. <snip> i also want to
> calculate and plot confidence bounds for the regression
> splines. 

*------------------ begin example ----------------
sysuse auto, clear
mkspline cubsp_mpg1 18 cubsp_mpg2 = mpg, marginal
foreach var of varlist cubsp* {
	qui replace `var' = `var'^3
}
gen cubsp_sq = mpg^2
gen cubsp_lin = mpg
reg price cubsp* foreign weight

preserve

sum weight if e(sample)
replace weight = r(mean)
replace foreign = 0

predictnl yhat = xb(), ci(lb ub)
twoway rarea lb ub  mpg, sort || ///
       line yhat mpg, sort       ///
	   legend(off)               ///
	   title("predicted price for US cars with average weight")

restore
*-------------------- end example ---------------------

You might also be interested in this talk held at the
last German Stata Users' Group meeting:

http://ideas.repec.org/p/boc/dsug09/04.html

And this talk held at the last Swedish Stata Users'
Group meeting:

http://www.stata.com/meeting/sweden09/se09_orsini.pdf

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------




      

*
*   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/



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