Description Usage Arguments Details Value References Examples
These are the main functions to fit a functional data object to a dataset. The model can be linear or nonlinear. The smoothing parameter and the number of basis is assumed to be known.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | coefEst(y, t, lam, k, L=2,
create_basis=create.bspline.basis, ...)
nlCoefEst(y, t, lam, k, L=2,
create_basis=create.bspline.basis, maxit=100, tol=1e-8,
typels=c("brent","grid"), addDat=FALSE, rangeval=NULL, ...)
makeLinFda(obj, npoints=200)
logFda(obj)
## S3 method for class 'myfda'
as.fd(x, fdnames=NULL, npoints=200, ...)
## S3 method for class 'myfda'
fitted(object, t=NULL, ...)
|
y |
A T \times n matrix of data points, when T is the number of periods and n the number of individuals. |
t |
A numeric vector of time units. In |
lam |
The regularization parameter that penalizes for the absence of smoothness. |
k |
The number of basis. |
L |
Either a nonnegative integer defining an order of a
derivative or a linear differential operator (see
|
create_basis |
The function used to create the basis object (see
|
maxit |
The maximum number of iteration for the Newton method |
tol |
The tolerance parameter for the stopping rule of the Newton method |
... |
Other argument that is passed to |
obj |
Object of class "myfda" |
npoints |
Number of points to fit the linear FDA to the non-linear one |
x |
Object of class "myfda" |
object |
Object of class "myfda" |
fdnames |
Names of elements of the "fd" object (see
|
typels |
The |
addDat |
If TRUE, fake observations are added before and after assuming stationarity. for the estimation, the time span is expanded accordingly. |
rangeval |
This can be set if the basis is defined on a range other
than |
In coefEst
, the functional data is a linear combination of the
basis, while in nlCoefEst
it is the exponential of the linear
combination of the basis. The latter is used when we want to force the
functional data curve to be positive,
makeLinFda
will transform the nonlinear fit to a linear FDA by
fitting the nonlinear curve to a linear combination of the same
basis. The curve is almost identical and it is transformed this way
by funcreg
logFDA
transforms the non-linear FDA into a linear FDA. It only
redefine the link
equation and take the log of the observed data.
It returns an object of 'class' "myfda"
The object of class "myfda" is a list containing at least:
coefficients |
k\times n matrix of coefficients. |
y |
The dataset matrix |
t |
The input vector |
basis |
The basis object |
link |
The function that links |
lambda |
The value of |
convergence |
Information on the convergence of the Newton method. |
Ramsay, James O., & Silverman, Bernard W. (2005), Functional Data Analysis, Springer, New York.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | data(GDPv56)
t <- seq(0,1,len=nrow(GDPv56))
## Linear estimation
res <- coefEst(y=GDPv56, t=t, lam=0.003, k=15)
res
cbind(data=GDPv56[,1], fitted=fitted(res)[,1])
## Nonlinear Estimation
res <- nlCoefEst(y=GDPv56, t=t, lam=0.003, k=15)
res
resLin <- makeLinFda(res)
resLin
## Take the logarithm of the non-linear functional data
logres <- logFda(res)
plot(res,1:2)
## Transform the myfda object into an fd object
resfd <- as.fd(resLin)
## Nonlinear Estimation with zeros
data(simData)
t <- seq(0,1,length.out=5)
res <- nlCoefEst(y=simData, t=t, lam=0.003, k=7)
res
res <- nlCoefEst(y=simData, t=t, lam=0.003, k=7, addDat=TRUE)
res
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.