Title: | Scalar-on-Function Regression with Measurement Error Correction |
---|---|
Description: | Solve scalar-on-function linear models, including generalized linear mixed effect model and quantile linear regression model, and bias correction estimation methods due to measurement error. Details about the measurement error bias correction methods, see Luan et al. (2023) <doi:10.48550/arXiv.2305.12624>, Tekwe et al. (2022) <doi:10.1093/biostatistics/kxac017>, Zhang et al. (2023) <doi:10.5705/ss.202021.0246>, Tekwe et al. (2019) <doi:10.1002/sim.8179>. |
Authors: | Heyang Ji [aut, cre, ctb, dtc] , Ufuk Beyaztas [ctb, rev] , Nicolas Escobar-Velasquez [com] , Yuanyuan Luan [ctb], Xiwei Chen [ctb], Mengli Zhang [ctb], Roger Zoh [ths], Lan Xue [ths], Carmen Tekwe [ths] |
Maintainer: | Heyang Ji <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2024-10-25 16:18:46 UTC |
Source: | https://github.com/jihx1015/mecfda |
Generic function to compute function value from summation series of a functional basis.
basis2fun(object, x) ## S4 method for signature 'bspline_series,numeric' basis2fun(object, x) ## S4 method for signature 'Fourier_series,numeric' basis2fun(object, x)
basis2fun(object, x) ## S4 method for signature 'bspline_series,numeric' basis2fun(object, x) ## S4 method for signature 'Fourier_series,numeric' basis2fun(object, x)
object |
An object that represents a functional basis. |
x |
point(s) to take value. |
When applied to bspline_series
object, equivalent to bsplineSeries2fun
.
When applied to Fourier_series
object, equivalent to FourierSeries2fun
.
A numeric atomic vector.
See bsplineSeries2fun
and FourierSeries2fun
.
Heyang Ji
For a function , and a basis function sequence
,
basis expansion is to compute
.
Here we do basis expansion for all
in functional variable data,
.
We compute a matrix
, where
.
The basis used here is the b-splines basis,
,
,
where
and
is defined as
bspline_basis_expansion(object, n_splines, bs_degree) ## S4 method for signature 'functional_variable,integer' bspline_basis_expansion(object, n_splines, bs_degree)
bspline_basis_expansion(object, n_splines, bs_degree) ## S4 method for signature 'functional_variable,integer' bspline_basis_expansion(object, n_splines, bs_degree)
object |
a |
n_splines |
the number of splines, equal to |
bs_degree |
the degree of the piecewise polynomial of the b-splines. See |
Returns a numeric matrix, , where
Heyang Ji
A s4 class that represents a b-spline basis on the interval
,
where
is defined as
For all the discontinuity points of (
) in the interval
,
let the value equals its limit, which means
Boundary.knots
boundary of the domain of the splines (start and end), which is and
.
Default is
. See
Boundary.knots
in bs
.
knots
knots of the splines, which is ,
equally spaced sequence is chosen by the function automatically with equal space
(
) when not assigned.
See
knots
in bs
.
intercept
Whether an intercept is included in the basis,
default value is TRUE
, and must be TRUE
. See intercept
bs
.
df
degree of freedom of the basis, which is the number of the splines, equal to .
By default
, and
df
. See
df
bs
.
degree
degree of the splines, which is the degree of piecewise polynomials , default value is 3.
See
degree
in bs
.
Heyang Ji
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 )
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 )
A s4 class that represents
the summation by a bspline_basis object
and coefficients
(
).
coef
coefficients of the b-splines, (
).
bspline_basis
a bspline_basis
object,
represents the b-splines basis used, .
Heyang Ji
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 ) bss = bspline_series( coef = c(2,1,1.5,0.5), bspline_basis = bsb )
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 ) bss = bspline_series( coef = c(2,1,1.5,0.5), bspline_basis = bsb )
Compute the value of the Fourier summation series at certain points.
bsplineSeries2fun(object, x) ## S4 method for signature 'bspline_series,numeric' bsplineSeries2fun(object, x)
bsplineSeries2fun(object, x) ## S4 method for signature 'bspline_series,numeric' bsplineSeries2fun(object, x)
object |
an object of |
x |
Value of $x$. |
A numeric atomic vector
Heyang Ji
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 ) bss = bspline_series( coef = c(2,1,1.5,0.5), bspline_basis = bsb ) bsplineSeries2fun(bss,(1:239)/10)
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 ) bss = bspline_series( coef = c(2,1,1.5,0.5), bspline_basis = bsb ) bsplineSeries2fun(bss,(1:239)/10)
Extract the dimensionality of slot X of functional_variable object.
## S4 method for signature 'functional_variable' dim(x)
## S4 method for signature 'functional_variable' dim(x)
x |
a |
Retruns a 2-element numeric vector.
Heyang Ji
fv = functional_variable(X=array(rnorm(12),dim = 4:3),period = 3) dim(fv)
fv = functional_variable(X=array(rnorm(12),dim = 4:3),period = 3) dim(fv)
Method of class Fourier_series to extract Fourier coefficients
extractCoef(object) ## S4 method for signature 'Fourier_series' extractCoef(object)
extractCoef(object) ## S4 method for signature 'Fourier_series' extractCoef(object)
object |
an object of |
A list that contains the coefficients.
Heyang Ji
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, ) extractCoef(fsc)
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, ) extractCoef(fsc)
Generic function to extract the value of coefficient parameter function of the covariates from linear model with functional covariates at some certain points.
fc.beta(object, ...) ## S4 method for signature 'fcRegression' fc.beta(object, FC = 1, t_points = NULL) ## S4 method for signature 'fcQR' fc.beta(object, FC = 1, t_points = NULL)
fc.beta(object, ...) ## S4 method for signature 'fcRegression' fc.beta(object, FC = 1, t_points = NULL) ## S4 method for signature 'fcQR' fc.beta(object, FC = 1, t_points = NULL)
object |
An object that represents a functional covariates linear model. |
... |
More arguments. |
FC |
An integer, represent the ordinal number of the functional covariate. Default is 1, which is take the first functional covariate. |
t_points |
Sequence of the measurement (time) points. |
A numeric atomic vector
Heyang Ji
Fit a quantile regression models below
where is the
-th quantile of
given
and
,
.
Model allows one or multiple functional covariate(s) as fixed effect(s),
and zero, one, or multiple scalar-valued covariate(s).
fcQR( Y, FC, Z, formula.Z, tau = 0.5, basis.type = c("Fourier", "Bspline"), basis.order = 6L, bs_degree = 3 )
fcQR( Y, FC, Z, formula.Z, tau = 0.5, basis.type = c("Fourier", "Bspline"), basis.order = 6L, bs_degree = 3 )
Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name |
FC |
Functional covariate(s), can be a "functional_variable" object or a matrix or a data frame or a list of these object(s) |
Z |
Scalar covariate(s), can be |
formula.Z |
A formula without the response variable, contains only scalar covariate(s). If not assigned, include all scalar covariates and intercept term. |
tau |
Quantile |
basis.type |
Type of funtion basis.
Can only be assigned as one type even if there is more than one functional covariates.
Available options: 'Fourier' or 'Bspline', represent Fourier basis and b-spline basis respectively.
For the detailed form for Fourier and b-splines basis,
see |
basis.order |
Indicate number of the function basis.
When using Fourier basis |
bs_degree |
Degree of the piecewise polynomials if use b-splines basis, default is 3.
See |
fcQR returns an object of class "fcQR". It is a list that contains the following elements.
regression_result |
Result of the regression. |
FC.BasisCoefficient |
A list of Fourier_series or bspline_series object(s), represents the functional linear coefficient(s) of the functional covariates. |
function.basis.type |
Type of funtion basis used. |
basis.order |
Same as in the arguemnets. |
data |
Original data. |
bs_degree |
Degree of the splines, returned only if b-splines basis is used. |
Heyang Ji
data(MECfda.data.sim.0.0) res = fcQR(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z, basis.order = 5, basis.type = c('Bspline'))
data(MECfda.data.sim.0.0) res = fcQR(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z, basis.order = 5, basis.type = c('Bspline'))
Function to fit (generalized) linear model with functional covariate(s). Model allows one or multiple functional covariate(s) as fixed effect(s), and zero, one, or multiple scalar-valued fixed or random effect(s).
fcRegression( Y, FC, Z, formula.Z, family = gaussian(link = "identity"), basis.type = c("Fourier", "Bspline"), basis.order = 6L, bs_degree = 3 )
fcRegression( Y, FC, Z, formula.Z, family = gaussian(link = "identity"), basis.type = c("Fourier", "Bspline"), basis.order = 6L, bs_degree = 3 )
Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name. |
FC |
Functional covariate(s), can be a "functional_variable" object or a matrix or a data frame or a list of these object(s). |
Z |
Scalar covariate(s), can be |
formula.Z |
A formula without the response variable,
contains only scalar covariate(s) (or intercept),
use the format of lme4 package if random effects exist. e.g. |
family |
A description of the error distribution and link function to be used in the model,
see |
basis.type |
Type of funtion basis.
Can only be assigned as one type even if there is more than one functional covariates.
Available options: 'Fourier' or 'Bspline', represent Fourier basis and b-spline basis respectively.
For the detailed form for Fourier and b-splines basis,
see |
basis.order |
Indicate number of the function basis.
When using Fourier basis |
bs_degree |
Degree of the piecewise polynomials if use b-splines basis,
default is 3. See |
Solve linear models with functional covariates below
where the scalar-valued covariates can be fixed or random effect or doesn't exist (may do not contain scalar-valued covariates).
fcRegression returns an object of class "fcRegression". It is a list that contains the following elements.
regression_result |
Result of the regression. |
FC.BasisCoefficient |
A list of Fourier_series or bspline_series object(s), represents the functional linear coefficient(s) of the functional covariates. |
function.basis.type |
Type of funtion basis used. |
basis.order |
Same as in the arguemnets. |
data |
Original data. |
bs_degree |
Degree of the splines, returned only if b-splines basis is used. |
Heyang Ji
data(MECfda.data.sim.0.0) res = fcRegression(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z, basis.order = 5, basis.type = c('Bspline'), formula.Z = ~ Z_1 + (1|Z_2))
data(MECfda.data.sim.0.0) res = fcRegression(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z, basis.order = 5, basis.type = c('Bspline'), formula.Z = ~ Z_1 + (1|Z_2))
For a function , and a basis function sequence
,
basis expansion is to compute
.
Here we do basis expansion for all
in functional variable data,
.
We compute a matrix
, where
.
The basis used here is the Fourier basis,
where and
.
fourier_basis_expansion(object, order_fourier_basis) ## S4 method for signature 'functional_variable,integer' fourier_basis_expansion(object, order_fourier_basis)
fourier_basis_expansion(object, order_fourier_basis) ## S4 method for signature 'functional_variable,integer' fourier_basis_expansion(object, order_fourier_basis)
object |
a |
order_fourier_basis |
the order of Fourier basis, |
Returns a numeric matrix, , where
Heyang Ji
A s4 class that represents the linear combination of Fourier basis functions below:
If not assigned, ,
.
If not assigned, k_cos and k_sin equals 1, 2, 3, ...
double_constant
value of .
cos
values of coefficients of waves,
.
sin
values of coefficients of waves,
.
k_cos
values of corresponding to the coefficients of
waves
k_sin
values of corresponding to the coefficients of
waves
t_0
left end of the domain interval,
period
length of the domain interval, .
Heyang Ji
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, )
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, )
Compute the value of the Fourier summation series
at some certain point(s).
FourierSeries2fun(object, x) ## S4 method for signature 'Fourier_series,numeric' FourierSeries2fun(object, x)
FourierSeries2fun(object, x) ## S4 method for signature 'Fourier_series,numeric' FourierSeries2fun(object, x)
object |
an object of |
x |
Value of |
A numeric atomic vector
Heyang Ji
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, ) FourierSeries2fun(fsc,1:5)
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, ) FourierSeries2fun(fsc,1:5)
A s4 class that represents data of a function-valued variable.
The format is
where
is the observation (subject) index,
represents the measurement (time) points.
X
a matrix , where
, represents the value of
, each row represent an observation (subject), each column is corresponding to a measurement (time) point.
t_0
start of the domain (time period), . Default is 0.
period
length of the domain (time period), . Default is 1.
t_points
sequence of the measurement points, . Default is
.
Heyang Ji
X = array(rnorm(12),dim = 4:3) functional_variable(X=X,period = 3)
X = array(rnorm(12),dim = 4:3) functional_variable(X=X,period = 3)
See detailed model in reference
ME.fcLR_IV( data.Y, data.W, data.M, t_interval = c(0, 1), t_points = NULL, CI.bootstrap = FALSE )
ME.fcLR_IV( data.Y, data.W, data.M, t_interval = c(0, 1), t_points = NULL, CI.bootstrap = FALSE )
data.Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name. |
data.W |
A dataframe or matrix, represents |
data.M |
A dataframe or matrix, represents |
t_interval |
A 2-element vector, represents an interval,
means the domain of the functional covariate.
Default is c(0,1), represent interval |
t_points |
Sequence of the measurement (time) points,
default is |
CI.bootstrap |
Whether to return the confidence using bootstrap method.
Default is |
Returns a ME.fcLR_IV class object. It is a list that contains the following elements.
beta_tW |
Parameter estimates. |
CI |
Confidence interval, returnd only when CI.bootstrap is TRUE. |
Tekwe, Carmen D., et al. "Instrumental variable approach to estimating the scalar‐on‐function regression model w ith measurement error with application to energy expenditure assessment in childhood obesity." Statistics in medicine 38.20 (2019): 3764-3781.
data(MECfda.data.sim.0.3) res = ME.fcLR_IV(data.Y = MECfda.data.sim.0.3$Y, data.W = MECfda.data.sim.0.3$W, data.M = MECfda.data.sim.0.3$M)
data(MECfda.data.sim.0.3) res = ME.fcLR_IV(data.Y = MECfda.data.sim.0.3$Y, data.W = MECfda.data.sim.0.3$W, data.M = MECfda.data.sim.0.3$M)
Zhang et al. proposed a new corrected loss function for a partially functional linear quantile model with functional measurement error in this manuscript. They established a corrected quantile objective function of the observed measurement that is an unbiased estimator of the quantile objective function that would be obtained if the true measurements were available. The estimators of the regression parameters are obtained by optimizing the resulting corrected loss function. The resulting estimator of the regression parameters is shown to be consistent.
ME.fcQR_CLS( data.Y, data.W, data.Z, tau = 0.5, t_interval = c(0, 1), t_points = NULL, grid_k, grid_h, degree = 45, observed_X = NULL )
ME.fcQR_CLS( data.Y, data.W, data.Z, tau = 0.5, t_interval = c(0, 1), t_points = NULL, grid_k, grid_h, degree = 45, observed_X = NULL )
data.Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name. |
data.W |
A 3-dimensional array, represents |
data.Z |
Scalar covariate(s),
can be not input or |
tau |
Quantile |
t_interval |
A 2-element vector, represents an interval,
means the domain of the functional covariate. Default is c(0,1), represent interval |
t_points |
Sequence of the measurement (time) points, default is |
grid_k |
An atomic vector, of which each element is candidate number of basis. |
grid_h |
A non-zero-value atomic vector, of which each element is candidate value of tunning parameter. |
degree |
Used in computation for derivative and integral, defult is 45, large enough for most scenario. |
observed_X |
For estimating parametric variance. Default is |
Returns a ME.fcQR_CLS class object. It is a list that contains the following elements.
estimated_beta_hat |
Estimated coefficients from corrected loss function (including functional part) |
estimated_beta_t |
Estimated functional curve |
SE_est |
Estimated parametric variance. Returned only if observed_X is not |
estimated_Xbasis |
The basis matrix we used |
res_naive |
results of naive method |
Zhang, Mengli, et al. "PARTIALLY FUNCTIONAL LINEAR QUANTILE REGRESSION WITH MEASUREMENT ERRORS." Statistica Sinica 33 (2023): 2257-2280.
data(MECfda.data.sim.0.1) res = ME.fcQR_CLS(data.Y = MECfda.data.sim.0.1$Y, data.W = MECfda.data.sim.0.1$W, data.Z = MECfda.data.sim.0.1$Z, tau = 0.5, grid_k = 4:7, grid_h = 1:2)
data(MECfda.data.sim.0.1) res = ME.fcQR_CLS(data.Y = MECfda.data.sim.0.1$Y, data.W = MECfda.data.sim.0.1$W, data.Z = MECfda.data.sim.0.1$Z, tau = 0.5, grid_k = 4:7, grid_h = 1:2)
Perform a two-stage strategy to correct the measurement error of
a function-valued covariate and then fit a linear quantile regression model.
In the first stage, an instrumental variable is used to estimate
the covariance matrix associated with the measurement error.
In the second stage, simulation extrapolation (SIMEX) is used to correct for
measurement error in the function-valued covariate.
See detailed model in the reference.
ME.fcQR_IV.SIMEX( data.Y, data.W, data.Z, data.M, tau = 0.5, t_interval = c(0, 1), t_points = NULL, formula.Z, basis.type = c("Fourier", "Bspline"), basis.order = NULL, bs_degree = 3 )
ME.fcQR_IV.SIMEX( data.Y, data.W, data.Z, data.M, tau = 0.5, t_interval = c(0, 1), t_points = NULL, formula.Z, basis.type = c("Fourier", "Bspline"), basis.order = NULL, bs_degree = 3 )
data.Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name. |
data.W |
A dataframe or matrix, represents |
data.Z |
Scalar covariate(s),
can be not input or |
data.M |
A dataframe or matrix, represents |
tau |
Quantile |
t_interval |
A 2-element vector, represents an interval,
means the domain of the functional covariate. Default is c(0,1), represent interval |
t_points |
Sequence of the measurement (time) points, default is |
formula.Z |
A formula without the response variable, contains only scalar covariate(s), no random effects. If not assigned, include all scalar covariates and intercept term. |
basis.type |
Type of funtion basis.
Can only be assigned as one type even if there is more than one functional covariates.
Available options: 'Fourier' or 'Bspline', represent Fourier basis and b-spline basis respectively.
For the detailed form for Fourier and b-splines basis,
see |
basis.order |
Indicate number of the function basis.
When using Fourier basis |
bs_degree |
Degree of the piecewise polynomials if use b-splines basis,
default is 3. See |
Returns a ME.fcQR_IV.SIMEX class object. It is a list that contains the following elements.
coef.X |
A Fourier_series or bspline_series object, represents the functional coefficient parameter of the functional covariate. |
coef.Z |
The estimate of the linear coefficients of the scalar covariates. |
coef.all |
Original estimate of linear coefficients. |
function.basis.type |
Type of funtion basis used. |
basis.order |
Same as in the input arguements. |
t_interval |
A 2-element vector, represents an interval, means the domain of the functional covariate. |
t_points |
Sequence of the measurement (time) points. |
formula |
Regression model. |
formula.Z |
formula object contains only the scalar covariate(s). |
zlevels |
levels of the non-continuous scalar covariate(s). |
Tekwe, Carmen D., et al. "Estimation of sparse functional quantile regression with measurement error: a SIMEX approach." Biostatistics 23.4 (2022): 1218-1241.
data(MECfda.data.sim.0.2) res = ME.fcQR_IV.SIMEX(data.Y = MECfda.data.sim.0.2$Y, data.W = MECfda.data.sim.0.2$W, data.Z = MECfda.data.sim.0.2$Z, data.M = MECfda.data.sim.0.2$M, tau = 0.5, basis.type = 'Bspline')
data(MECfda.data.sim.0.2) res = ME.fcQR_IV.SIMEX(data.Y = MECfda.data.sim.0.2$Y, data.W = MECfda.data.sim.0.2$W, data.Z = MECfda.data.sim.0.2$Z, data.M = MECfda.data.sim.0.2$M, tau = 0.5, basis.type = 'Bspline')
The Mixed-effect model (MEM) approach is a two-stage-based method that employs functional mixed-effects models. It allows us to delve into the nonlinear measurement error model, where the relationship between the true and observed measurements is not constrained to be linear, and the distribution assumption on the observed measurement is relaxed to encompass the exponential family rather than being limited to the Gaussian distribution. The MEM approach employs point-wise (UP_MEM) and multi-point-wise (MP_MEM) estimation procedures to avoid potential computational complexities caused by analyses of multi-level functional data and computations of potentially intractable and complex integrals.
ME.fcRegression_MEM( data.Y, data.W, data.Z, method = c("UP_MEM", "MP_MEM", "average"), t_interval = c(0, 1), t_points = NULL, d = 3, family.W = c("gaussian", "poisson"), family.Y = "gaussian", formula.Z, basis.type = c("Fourier", "Bspline"), basis.order = NULL, bs_degree = 3, smooth = FALSE, silent = TRUE )
ME.fcRegression_MEM( data.Y, data.W, data.Z, method = c("UP_MEM", "MP_MEM", "average"), t_interval = c(0, 1), t_points = NULL, d = 3, family.W = c("gaussian", "poisson"), family.Y = "gaussian", formula.Z, basis.type = c("Fourier", "Bspline"), basis.order = NULL, bs_degree = 3, smooth = FALSE, silent = TRUE )
data.Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name. |
data.W |
A 3-dimensional array, represents |
data.Z |
Scalar covariate(s), can be not input or |
method |
The method to construct the substitution |
t_interval |
A 2-element vector, represents an interval,
means the domain of the functional covariate. Default is c(0,1), represent interval |
t_points |
Sequence of the measurement (time) points, default is |
d |
The number of time points involved for MP_MEM (default and miniumn is 3). |
family.W |
Distribution of |
family.Y |
A description of the error distribution
and link function to be used in the model, see |
formula.Z |
A formula without the response variable, contains only scalar covariate(s), use the format of lme4 package if random effects exist. e.g. ~ Z_1 + (1|Z_2). If not assigned, include all scalar covariates and intercept term as fixed effects. |
basis.type |
Type of function basis.
Can only be assigned as one type even if there is more than one functional covariates.
Available options: 'Fourier' or 'Bspline',
represent Fourier basis and b-spline basis respectively.
For the detailed form for Fourier and b-splines basis,
see |
basis.order |
Indicate number of the function basis.
When using Fourier basis |
bs_degree |
Degree of the piecewise polynomials if use b-splines basis, default is 3.
See |
smooth |
Whether to smooth the substitution of |
silent |
Whether not to show the state of the running of the function. Default is |
Returns a fcRegression
object. See fcRegression
.
Luan, Yuanyuan, et al. "Scalable regression calibration approaches to correcting measurement error in multi-level generalized functional linear regression models with heteroscedastic measurement errors." arXiv preprint arXiv:2305.12624 (2023).
data(MECfda.data.sim.0.1) res = ME.fcRegression_MEM(data.Y = MECfda.data.sim.0.1$Y, data.W = MECfda.data.sim.0.1$W, data.Z = MECfda.data.sim.0.1$Z, method = 'UP_MEM', family.W = "gaussian", basis.type = 'Bspline')
data(MECfda.data.sim.0.1) res = ME.fcRegression_MEM(data.Y = MECfda.data.sim.0.1$Y, data.W = MECfda.data.sim.0.1$W, data.Z = MECfda.data.sim.0.1$Z, method = 'UP_MEM', family.W = "gaussian", basis.type = 'Bspline')
Plot b-splines baisi summation series.
## S4 method for signature 'bspline_series' plot(x)
## S4 method for signature 'bspline_series' plot(x)
x |
A |
No return value. Generate a scatter plot.
Heyang Ji
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 ) bss = bspline_series( coef = c(2,1,1.5,3), bspline_basis = bsb ) plot(bss)
bsb = bspline_basis( Boundary.knots = c(0,24), intercept = TRUE, df = NULL, degree = 3 ) bss = bspline_series( coef = c(2,1,1.5,3), bspline_basis = bsb ) plot(bss)
Plot Fourier basis summation series.
## S4 method for signature 'Fourier_series' plot(x)
## S4 method for signature 'Fourier_series' plot(x)
x |
A |
No return value. Generate a scatter plot.
Heyang Ji
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, ) plot(fsc)
fsc = Fourier_series( double_constant = 0.5, cos = c(0,0.3), sin = c(1,0.7), k_cos = 1:2, ) plot(fsc)
Predicted values based on the Quantile linear model with functional covariates represented by a "fcQR" class object.
## S3 method for class 'fcQR' predict(object, newData.FC, newData.Z = NULL, ...)
## S3 method for class 'fcQR' predict(object, newData.FC, newData.Z = NULL, ...)
object |
A fcQR class object produced by |
newData.FC |
A atomic vector or a matrix or a dataframe or a functional_variable class object or a list of objects above.
See argument FC in |
newData.Z |
A dataframe or a matrix or a atomic vector. See argument Z in |
... |
Further arguments passed to or from other methods |
If no new data is input, will return the fitted value.
See predict.rq
.
Heyang Ji
Predicted values based on the linear model with functional covariates represented by a "fcRegression" class object.
## S3 method for class 'fcRegression' predict(object, newData.FC, newData.Z = NULL, ...)
## S3 method for class 'fcRegression' predict(object, newData.FC, newData.Z = NULL, ...)
object |
A fcRegression class object produced by |
newData.FC |
A atomic vector or a matrix or a dataframe or
a functional_variable class object or a list of objects above.
See argument FC in |
newData.Z |
A dataframe or a matrix or a atomic vector.
See arguement Z in |
... |
Further arguments passed to or from other methods,
including |
If no new data is input, will return the fitted value.
See predict.lm
, predict.glm
,
predict.merMod
.
Heyang Ji
data(MECfda.data.sim.0.0) res = fcRegression(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z, basis.order = 5, basis.type = c('Bspline'), formula.Z = ~ Z_1 + (1|Z_2)) data(MECfda.data.sim.1.0) predict(object = res, newData.FC = MECfda.data.sim.1.0$FC,newData.Z = MECfda.data.sim.1.0$Z)
data(MECfda.data.sim.0.0) res = fcRegression(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z, basis.order = 5, basis.type = c('Bspline'), formula.Z = ~ Z_1 + (1|Z_2)) data(MECfda.data.sim.1.0) predict(object = res, newData.FC = MECfda.data.sim.1.0$FC,newData.Z = MECfda.data.sim.1.0$Z)