[R] fitted values with locfit

Liaw, Andy andy_liaw at merck.com
Wed Mar 28 15:45:07 CEST 2012


I believe you are expecting the software to do what it did not claim being able to do.  predict.locfit() does not have a "type" argument, nor can that take on "terms".  When you specify two variables in the smooth, a bivariate smooth is done, so you get one bivariate smooth function, not the sum of two univariate smooths.  If the latter is what you want, use packages that fits additive models.

Best,
Andy 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Soberon 
> Velez, Alexandra Pilar
> Sent: Monday, March 19, 2012 5:13 AM
> To: r-help at r-project.org
> Subject: [R] fitted values with locfit
> 
> Dear memberships,
> 
> 
> 
> I'm trying to estimate the following multivariate local 
> regression model using the "locfit" package:
> 
> BMI=m1(RCC)+m2(WCC)
> 
> where (m1) and (m2) are unknown smooth functions.
> 
> 
> My problem is that once I get the regression done I cannot 
> get the fitted values of each of this smooth functions (m1) 
> and (m2). What I write is the following
> 
> library(locfit)
> 
> data(ais)
> fit2<-locfit.raw(x=lp(ais$RCC,h=0.5,deg=1)+lp(ais$WCC,deg=1,h=
> 0.75),y=ais$BMI,ev=dat(),kt="prod",kern="gauss")
> g21<-predict(fit2,type="terms")
> 
> 
> If I done this on the computer the results of (g21) is a 
> vector when I should have a matrix with 2 columns (one for 
> each fitted smooth function).
> 
> 
> Please, somebody knows how can I get the estimated fitted 
> values of both smooth functions (m1) and (m2) using a local 
> linear regression with kernel weights as this example?
> 
> 
> thanks a lot in advance I'm very desperate.
> 
> Alexandra
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
Notice:  This e-mail message, together with any attachme...{{dropped:11}}



More information about the R-help mailing list