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? -Zoe Richards [[alternative HTML version deleted]]
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. -- David Winsemius Alameda, CA, USA
On 28/02/2013 00:29, 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?You should not be calling a method directly. Call predict(). If you look at the help in ?predict.smooth.Pspline, it says Usage: ## S3 method for class 'smooth.Pspline' predict(object, xarg, nderiv = 0, ...) Arguments: object: a fitted ?smooth.Pspline? object. so you needed to follow the help .... The maintainer of pspline.> > -Zoe Richards > > [[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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595