[R] predict.smooth.Pspline function not found
David Winsemius
dwinsemius at comcast.net
Thu Feb 28 04:25:09 CET 2013
On Feb 27, 2013, at 6:18 PM, David Winsemius wrote:
>
> On Feb 27, 2013, at 4:29 PM, zoe richards wrote:
>
>> I have a simple question that irritatingly I haven't been able to figure
>> out on my own. It seems that some functions from the "Pspline" package are
>> successfully installed while others are not. The code with which I'm
>> working is more complicated, but the following highlights my problem. If I
>> run the following code
>>
>>> tt <- seq (0,1,length=20)
>>> xt <- tt^3
>>> fit <- smooth.Pspline (tt, xt, norder=3,spar=0.0001, method=1)
>>> pred<- predict.smooth.Pspline (fit, tt, nderiv=0)
>>
>> I get this error:
>> "Error: could not find function "predict.smooth.Pspline" "
>>
>> So it seems like "smooth.Pspline" is loading but "predict.smooth.Pspline"
>> isn't. Any ideas about why this might be the case?
>
> Where are you getting the "Pspline" package. I only see a "pspline" package on CRAN. (I'm surprised you did not get an error when trying to load with that spelling, so maybe you do have such a package?) My guess is that you failed to load the package, either through misspelling of not knowing that package needed to be loaded. One of the reasons that the Posing Guide requests that all questions be accompanied by the output of sessionInfo() is to cover cases like this.
In a private message Zoe proved to me that she had loaded the `pspline` package. (You should not reply privately, Zoe.) It only remained to do this (after loading the package):
> pred<- predict.smooth.Pspline(fit, tt, nderiv=0)
Error: could not find function "predict.smooth.Pspline"
> pred<- predict(fit, tt, nderiv=0)
> str(pred)
num [1:20, 1] 0.004091 0.000253 -0.000499 0.001918 0.007715 ...
So in trying to go around the usual dispatch of functions by class you were creating unnecessary confusion. I don't know if maybe the spelling of the class with a period could be the root of the confusion?
Go Blue.
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list