Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: out of sample lowess prediction


From   Eric Lewis <erikylewis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: out of sample lowess prediction
Date   Tue, 7 Aug 2012 11:42:44 -0400

Dear all,

This seems like a simple question, but I'm having a hard time finding
a solution: Is it possible to do out of sample prediction with lowess?

For example, here is some simple code where I'd like to generate out
of sample predictions for even-numbered observations using data only
from odd-numbered observations :

* data generation
clear
set obs 11
gen x = .
gen y = .
forvalues i = 1(1)11 {
   replace x = `i' in `i'
   replace y = (`i')^2 in `i' if (floor((`i')/2) != ((`i')/2) )
    * (only generates y variables for odd numbered x's)
}
* lowess -- local linear regression
lowess y x, gen(new_y)
list x y new_y

Thanks,
-Eric
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index