Bjørn Henrik Auestad
2021-Oct-24 21:32 UTC
[Rd] Problems with packages fda and splines (PR#13263)
Dear Spencer,
I'm struggling with the same problem as was mentioned in Re: [Rd] Problems
with packages fda and splines (PR#13263).
(See also copy below.) I.e. handling NA's with smooth.basis or Data2fd.
Would you kindly let me know if it is possible
to handle NA's with Data2fd?
Best regards,
Bj?rn H. Auestad
Head, Department of Mathematics and Physics
University of Stavanger
phone: 51 83 18 74 / 91 31 65 34
Spencer Graves spencer.graves at
pdf.com<mailto:r-devel%40r-project.org?Subject=Re%3A%20%5BRd%5D%20Problems%20with%20packages%20fda%20and%20splines%20%28PR%2313263%29&In-Reply-To=%3C4914A1F9.8050106%40pdf.com%3E>
Fri Nov 7 21:15:53 CET 2008
* Previous message: [Rd] Problems with packages fda and splines
(PR#13263)<https://stat.ethz.ch/pipermail/r-devel/2008-November/051216.html>
* Next message: [Rd] barplot can put legend in wrong place, request option
to override that
(PR#13265)<https://stat.ethz.ch/pipermail/r-devel/2008-November/051218.html>
* Messages sorted by: [ date
]<https://stat.ethz.ch/pipermail/r-devel/2008-November/date.html#51217> [
thread
]<https://stat.ethz.ch/pipermail/r-devel/2008-November/thread.html#51217>
[ subject
]<https://stat.ethz.ch/pipermail/r-devel/2008-November/subject.html#51217>
[ author
]<https://stat.ethz.ch/pipermail/r-devel/2008-November/author.html#51217>
________________________________
Hello, David:
Thanks for the comments about NA problems in 'fda'. I'll look
into this and get back with you.
Spencer
degras at uchicago.edu<https://stat.ethz.ch/mailman/listinfo/r-devel>
wrote:
> Full_Name: David D Degras
> Version: 2.8.0
> OS: Mac OS X
> Submission from: (NULL) (128.135.239.11)
>
>
> I have recently installed the version 2.8.0 of R along with package fda (v
> 2.0.2)
> and its dependencies (including package splines v. 2.8.0).
>
> Here are my problems:
>
> 1) The package splines should feature functions such a predict.bs,
> predict.bSpline and such and it does not! I can make calls to bs, ns, and
> interpSpline but not to any predicting function.
> Example:
>
>> library(splines)
>> predict.bs
>>
> Erreur : objet "predict.bs" non trouv? # in english: object
"predict.bs" not
> found
>
> Also, I cannot track the package splines on the CRAN website. Why is that?
>
> 2) Package fda: it does not handle at all NAs although promising to.
> I have met this problem using Data2fd and project.basis as well.
> An example script is enclosed at the end of this email.
>
> Can you help on this ?
>
> Thanks,
>
> David
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> R SCRIPT for Data2fd with NAs
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
>> library(fda)
>> y=runif(10)
>> x=Data2fd(1:10,y) # creates functional object in B-spline basis
>>
> Warning message:
> In smooth.basis(argvals, y, fdP, wtvec = w, fdnames = fdnames) :
> The number of basis functions = 12 exceeds 10 = the number of points to
be
> smoothed. With no smoothing (lambda = 0), this will produce a perfect fit
to
> data that typically has wild excursions between data points.
>
>> x$coefs # here it works because no NAs
>>
> [,1]
> [1,] 0.9193563
> [2,] 0.1590327
> [3,] 0.6441482
> [4,] 1.1257380
> [5,] 0.1234022
> [6,] 0.7228168
> [7,] 0.8709656
> [8,] -0.3634714
> [9,] 0.9097221
> [10,] 1.1726878
> [11,] 0.4130424
> [12,] 0.3122870
>
>> y[3]=NA # create a NA
>> x=Data2fd(1:10,y)
>>
> Warning message:
> In smooth.basis(argvals, y, fdP, wtvec = w, fdnames = fdnames) :
> The number of basis functions = 12 exceeds 10 = the number of points to
be
> smoothed. With no smoothing (lambda = 0), this will produce a perfect fit
to
> data that typically has wild excursions between data points.
>
>> x$coefs # vector of NAs because y[3]=NA
>>
> [,1]
> [1,] NA
> [2,] NA
> [3,] NA
> [4,] NA
> [5,] NA
> [6,] NA
> [7,] NA
> [8,] NA
> [9,] NA
> [10,] NA
> [11,] NA
> [12,] NA
>
> ______________________________________________
> R-devel at
r-project.org<https://stat.ethz.ch/mailman/listinfo/r-devel> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
[[alternative HTML version deleted]]