I used the supersmoother function in the modreg package as follows: super <- supsmu(ilogemp,award) Then I decided that I might want additional explanatory variables (other than ilogemp) in my model. The ppr function in modreg seemed a logical extension of supsmu from univariate to multidimensional explanatory variables. As a "check" I ran the following: pprest <- ppr(ilogemp,award,nterms=1), figuring I'd get the same results. I did not. First, the fitted values ppr output is not rescaled back to the original scale of award. Eventually, I figured out that the ppr fitted values had mean zero and variance=1, so I thought I needed to multiply ppr's fitted values by the standard deviation of award (pprest$ys) and then add in the mean of award (pprest$yb), but the result is still way off from the fitted values from supsmu. Does anyone have any thoughts about this? Thanks, David N. Beede Economist Office of Policy Development Economics and Statistics Administration U.S. Department of Commerce Room 4858 HCHB 14th Street and Pennsylvania Avenue, N.W. Washington, DC 20230 Voice: 202.482.1226 Fax: 202.482.0325 e-mail: david.beede at mail.doc.gov -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 12 Feb 2001 david.beede at mail.doc.gov wrote:> I used the supersmoother function in the modreg package as follows: > > super <- supsmu(ilogemp,award) > > Then I decided that I might want additional explanatory variables (other > than ilogemp) in my model. The ppr function in modreg seemed a logical > extension of supsmu from univariate to multidimensional explanatory > variables. As a "check" I ran the following: > > pprest <- ppr(ilogemp,award,nterms=1), > > figuring I'd get the same results. I did not. First, the fitted values > ppr output is not rescaled back to the original scale of award. > Eventually, I figured out that the ppr fitted values had mean zero and > variance=1, so I thought I needed to multiply ppr's fitted values by the > standard deviation of award (pprest$ys) and then add in the mean of award > (pprest$yb), but the result is still way off from the fitted values from > supsmu.I don't get this at all. I used the rock data in example(ppr) and did plot(perm~area1,data=rock) a.ppr<-ppr(perm~area1,data=rock,nterms=1) points(area1,fitted(a.ppr),col=2) lines(supsmu(rock$perm,rock$area1),col=3) b.ppr<-ppr(area1,rock$perm,nterms=1) points(area1,fitted(b.ppr),col=4) The two ppr() sets of fitted values were identical, and the supsmu() line followed them very closely. In addition, the variance of the fitted values is about 44000, not 1, and the mean is 415, not 0. One difficulty in comparing the fitted values (which is I did it graphically) is that supsmu() returns its results for the unique x values sorted in increasing order and ppr() doesn't. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks, Thomas. I am still new to R, and I didn't know about the -fitted- function. One thing to note, however -- if you just do plot(a.ppr) in your example, the predicted values will be standardized. Thomas Lumley <tlumley at u.washington.edu> on 02/12/2001 04:04:18 PM To: david.beede at mail.doc.gov cc: r-help at hypatia.math.ethz.ch Subject: Re: [R] supsmu vs. ppr On Mon, 12 Feb 2001 david.beede at mail.doc.gov wrote:> I used the supersmoother function in the modreg package as follows: > > super <- supsmu(ilogemp,award) > > Then I decided that I might want additional explanatory variables (other > than ilogemp) in my model. The ppr function in modreg seemed a logical > extension of supsmu from univariate to multidimensional explanatory > variables. As a "check" I ran the following: > > pprest <- ppr(ilogemp,award,nterms=1), > > figuring I'd get the same results. I did not. First, the fitted values > ppr output is not rescaled back to the original scale of award. > Eventually, I figured out that the ppr fitted values had mean zero and > variance=1, so I thought I needed to multiply ppr's fitted values by the > standard deviation of award (pprest$ys) and then add in the mean of award > (pprest$yb), but the result is still way off from the fitted values from > supsmu.I don't get this at all. I used the rock data in example(ppr) and did plot(perm~area1,data=rock) a.ppr<-ppr(perm~area1,data=rock,nterms=1) points(area1,fitted(a.ppr),col=2) lines(supsmu(rock$perm,rock$area1),col=3) b.ppr<-ppr(area1,rock$perm,nterms=1) points(area1,fitted(b.ppr),col=4) The two ppr() sets of fitted values were identical, and the supsmu() line followed them very closely. In addition, the variance of the fitted values is about 44000, not 1, and the mean is 415, not 0. One difficulty in comparing the fitted values (which is I did it graphically) is that supsmu() returns its results for the unique x values sorted in increasing order and ppr() doesn't. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._