fda (version 6.1.8)

eval.posfd: Evaluate a Positive Functional Data Object

Description

Evaluate a positive functional data object at specified argument values, or evaluate a derivative of the functional object.

Usage

eval.posfd(evalarg, Wfdobj, Lfdobj=int2Lfd(0))
# S3 method for posfd
predict(object, newdata=NULL, Lfdobj=0, ...)
# S3 method for posfd
fitted(object, ...)
# S3 method for posfd
residuals(object, ...)

Value

a matrix containing the positive function values. The first dimension corresponds to the argument values in evalarg and the second to replications.

Arguments

evalarg, newdata

a vector of argument values at which the functional data object is to be evaluated.

Wfdobj

a functional data object that defines the positive function to be evaluated. Only univariate functions are permitted.

Lfdobj

a nonnegative integer specifying a derivative to be evaluated. At this time of writing, permissible derivative values are 0, 1 or 2. A linear differential operator is not allowed.

object

an object of class posfd that defines the positive function to be evaluated. Only univariate functions are permitted.

...

optional arguments required by predict; not currently used.

Details

A positive function data object $h(t)$ is defined by $h(t) =[exp Wfd](t)$. The function Wfdobj that defines the positive function is usually estimated by positive smoothing function smooth.pos

References

Ramsay, James O., Hooker, Giles, and Graves, Spencer (2009), Functional data analysis with R and Matlab, Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2005), Functional Data Analysis, 2nd ed., Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2002), Applied Functional Data Analysis, Springer, New York.

See Also

eval.fd, eval.monfd

Examples

Run this code
harmaccelLfd <- vec2Lfd(c(0,(2*pi/365)^2,0), c(0, 365))
smallbasis   <- create.fourier.basis(c(0, 365), 65)
index        <- (1:35)[CanadianWeather$place == "Vancouver"]
VanPrec      <- CanadianWeather$dailyAv[,index, "Precipitation.mm"]
lambda       <- 1e4
dayfdPar     <- fdPar(fd(matrix(0,smallbasis$nbasis,1), smallbasis), 
                      harmaccelLfd, lambda)
VanPrecPos   <- smooth.pos(day.5, VanPrec, dayfdPar)
#  compute fitted values using eval.posfd()
VanPrecPosFit1 <- eval.posfd(day.5, VanPrecPos$Wfdobj)
#  compute fitted values using predict()
VanPrecPosFit2 <- predict(VanPrecPos, day.5)
stopifnot(
all.equal(VanPrecPosFit1, VanPrecPosFit2)
)
#  compute fitted values using fitted()
VanPrecPosFit3 <- fitted(VanPrecPos)
#  compute residuals
VanPrecRes <- resid(VanPrecPos)
stopifnot(
all.equal(VanPrecRes, VanPrecPos$y-VanPrecPosFit3)
)

Run the code above in your browser using DataLab