[R] Another question on locfit

Ralf.Kloessinger@student.fh-nuernberg.de Ralf.Kloessinger at student.fh-nuernberg.de
Thu Apr 4 00:50:56 CEST 2002


Thank you all for your suggestion on my last question about locfit.

Now I have another question:

I would like to change the evalution structure ev in locfit() to a vector/matrix.
I created a vector and a matrix:
>  vec <- mat.or.vec(101, 1)
>  vec <- c(0:100)
>  mat <- matrix(data = vec, nrow = 101, ncol = 1)

and I tried to change the ev parameter:

>  fit <- locfit(~imposter, kern="gauss", renorm=T, xlim=c(1e-20,100), ev=vec)

This works good but when I tried to get the density points I get an error, this happens also when I use the matrix (mat) for ev:

>  fhat <- fitted(fit)
   Error in fitted.locfit(fit) : NA/NaN/Inf in foreign function call (arg 10)

I think arg 10 means "dp" and there I got the following parameters:

> fit$dp
nnalph   fixh  adpen    cut     lk    df1    df2     rv 
   0.7    0.0    0.0    0.8    0.0    0.0    0.0    1.0 
   swt    rsc 
6228.0    0.0 

When I tried locfit with ev="tree", lk, df1, df2, rsc are changed, so I think there is the problem!!

If I use the predict() function, I get also an error message:

> pre <- predict.locfit(fit, mat)
Error in preplot.locfit.raw(object, newdata, where, what, band)  
        NA/NaN/Inf in foreign function call (arg 2)

But here the problem could be the newdata parameter. I don't know an other way to get around of this problems to get what I need. 

Also when I change the xlim to c(0,100) I get for the fitted() and predict() function only 1s in each row. It would be nice to know, why this happen.

Thank you for your time and your help


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

More information about the R-help mailing list