f.mean computes the sample functional mean and f.var the sample functional variance by default.

f.mean(x, ...)

# S3 method for npf.data
f.mean(x, na.rm = TRUE, ...)

f.var(x, ...)

# S3 method for npf.data
f.var(x, mean = f.mean(x, na.rm = na.rm), na.rm = TRUE, ...)

Arguments

x

a functional data object.

...

further arguments passed to or from other methods.

na.rm

logical; indicating whether NA values should be ignored.

mean

numeric; mean estimates at the discretization points.

Value

Return a vector with the corresponding estimates at the discretization points.

Details

f.var.npf.data() computes the sample functional variance by default, using the denominator \(n - 1\) (alternatively, setting mean = 0 may be appropriate for residuals or mean = predict(fit), for computing a residual functional variance).

Examples

fd <- npf.data(ozone, dimnames = "day")
# Plot data + sample mean -+ sample std. dev.
plot(fd, col = "lightgray", legend = FALSE)
x <- coords(fd)
y <- f.mean(fd)
lines(x, y)
matlines(x, y + sqrt(f.var(fd, mean = y)) %o% c(-1, 1), col = 1, lty = 2)