From degras at uchicago.edu  Fri Nov  7 18:40:10 2008
From: degras at uchicago.edu (degras at uchicago.edu)
Date: Fri,  7 Nov 2008 18:40:10 +0100 (CET)
Subject: [Rd] Problems with packages fda and splines (PR#13263)
Message-ID: <20081107174010.F2DEA282C765@mail.pubhealth.ku.dk>

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



[Rd] Problems with packages fda and splines (PR#13263)
degras at uchicago.edu