[R] ksmooth in SPLUS vs R

Jean Eid jeaneid at chass.utoronto.ca
Tue Sep 23 01:07:47 CEST 2003


I am working with a model that I have to estimate a nonparametric
function. The model is partial linear i.e.

Y=X$\beta$ + f(z) + $\epsilon$

I am using the ' double residual methods' Robinson (1988) Speckman (1988)
where I estimate a nonparametric function for each of the parametric
variables in terms of the nonparametric one i.e.

X[,i]=g(Z)+ u

this is done because I need the $E( X[,i]\vert Z)$ for each position j in
the vectors.

the problem is that when I use the ksmooth() function in R it estimates
the function at different points and not those that consist of the Z
vector.

the ksmooth() function in Splus on the other hand evaluates the points at
the corresponding Z vector. both codes are given below


d<-ksmooth(lprice,XX[,i],kernel="box")
unique(lprice-d$x)

in SPLUS will generate 0 while in R it generates a vector of different
values.



My second question is regarding the sm library:

d<-sm.regression(lprice, XX[,i], h=sd(lprice), display="none")
will only generate 50 point estimates while  NROW(XX[,i]) = 3897
and when I do
d<-sm.regression(lprice, XX[,i], h=sd(lprice), display="none",
ngrid=NROW(lprice))

I get the right dimension of the estimated points but again they are not
estimated at the points in lprice.


Any help is greatly appreciated.

P.S. I have Bowman and Azzalini book but unfortunately it does not clarify
the procedures in sm.regression()

Jean,




More information about the R-help mailing list