Re: [R] fitted values with locfit

2012-03-28 Thread Liaw, Andy
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-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Soberon 
 Velez, Alexandra Pilar
 Sent: Monday, March 19, 2012 5:13 AM
 To: r-help@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@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}}

__
R-help@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.


Re: [R] fitted values with locfit

2012-03-19 Thread Peter Ehlers

On 2012-03-19 02:12, Soberon Velez, Alexandra Pilar wrote:

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).



?predict.locfit doesn't indicate the option of a 'terms' argument.
Also, your model specification doesn't look correct: either provide
a formula to locfit() or a matrix x to locfit.raw.

Peter Ehlers



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@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.


__
R-help@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.