Fit of Functional Generalized Least Squares Model Iteratively
Source:R/fregre.igls.r
fregre.igls.Rd
This function fits iteratively a functional linear model using generalized least squares. The errors are allowed to be correlated and/or have unequal variances.
Begin with a preliminary estimation of \(\hat{\theta}=\theta_0\) (for instance, \(\theta_0=0\)). Compute \(\hat{W}\).
Estimate \(b_\Sigma =(Z'\hat{W}Z)^{-1}Z'\hat{W}y\)
Based on the residuals, \(\hat{e}=\left(y-Zb_\Sigma \right)\), update \(\hat{\theta}=\rho\left({\hat{e}}\right)\) where \(\rho\) depends on the dependence structure chosen.
Repeats steps 2 and 3 until convergence (small changes in \(b_\Sigma\) and/or \(\hat{\theta}\)).
Usage
fregre.igls(
formula,
data,
basis.x = NULL,
basis.b = NULL,
correlation,
maxit = 100,
rn,
lambda,
weights = rep(1, n),
control,
...
)
Arguments
- formula
A two-sided linear formula object describing the model, with the response on the left of a
~
operator and the terms, separated by+
operators, on the right.- data
An optional data frame containing the variables named in
model
,correlation
,weights
, andsubset
. By default the variables are taken from the environment from whichgls
is called.- basis.x
List of basis for functional explanatory data estimation.
- basis.b
List of basis for \(\beta(t)\) parameter estimation.
- correlation
List describing the correlation structure. Defaults to
NULL
, corresponding to uncorrelated errors. See the following internal functions for a description and a code example in script file.corUnstruc(x)
, fit an unstrutured correlation.cor.AR(x, order.max = 8, p=1, method = "lm")
fit an Autoregressive Models to Time Series usingar
function.cor.ARMA(x, p, d = 0, q = 0, method = "lm", order.max = 1)
Fit an
ARIMA model to a univariate time series usingarima
function.corExpo(xy,range, method = "euclidean",p=2)
Fit an exponential correlation structure.
- maxit
Number of maximum of interactions.
- rn
List of Ridge parameter.
- lambda
List of Roughness penalty parameter.
- weights
weights
- control
Control parameters.
- ...
Further arguments passed to or from other methods.
Value
An object of class fregre.igls
representing the functional linear model
fit with temporal dependence errors.
Beside, the class(z) is similar to "fregre.lm" plus the following objects:
corStruct
: Fitted AR or ARIMA model.
References
Oviedo de la Fuente, M., Febrero-Bande, M., Pilar Munoz, and Dominguez, A. (2018). Predicting seasonal influenza transmission using functional regression models with temporal dependence. PloS one, 13(4), e0194250. doi:10.1371/journal.pone.0194250
Examples
if (FALSE) { # \dontrun{
data(tecator)
x=tecator$absorp.fdata
x.d2<-fdata.deriv(x,nderiv=)
tt<-x[["argvals"]]
dataf=as.data.frame(tecator$y)
# plot the response
plot(ts(tecator$y$Fat))
ldata=list("df"=dataf,"x.d2"=x.d2)
res.gls=fregre.igls(Fat~x.d2,data=ldata,
correlation=list("cor.ARMA"=list()),
control=list("p"=1))
res.gls
res.gls$corStruct
} # }