Semi parametric mean and variance regression (multivariate)
Source:R/semiVarReg_multi.R
semiVarReg.multi.Rd
semiVarReg.multi
performs semi-parametric mean and variance regression models. This is
designed for multiple covariates fit in the mean and variance models.
Arguments
- y
Vector containing outcome data. Must be no missing data and any censored values must be set to the limits of detection.
- x
Matrix containing the covariate data. Must be no missing data and same length as
y
.- mean.model
Vector to specify the mean model to be fit to the data. The possible inputs are
"zero"
,"constant"
, or a vector to indicate if covariates are to be"linear"
or"semi"
."semi"
indicates a semi-parametric spline model, with the number of internal knots specified inknots.m
. If covariates are fit, each covariate needs an indicator of"linear"
or"semi"
, wheremean.vars
specifies each covariate.- mean.vars
Vector to specify column(s) in
x
referring to covariates to be fit in the mean model, eg c(1,2) indicates columns 1 and 2 inx
. Must be the same length asmean.model
which specifies if they are fit as linear/semi. If semi, useknots.m
to specify knots.- knots.m
Vector indicating the number of internal knots to be fit in each of covariate(s) fit in the semi-parametric mean model. Must be one entry per
"semi"
covariate inmean.model
. Knots are placed equidistantly over each covariate.- var.model
Vector to specify the variance model to be fit to the data. The possible inputs are
"constant"
, or a vector to indicate if each covariate is to be"linear"
or"semi"
."semi"
indicates a semi-parametric B-spline model, with the number of internal knots specified inknots.v
.- var.vars
Vector to specify column(s) in
x
referring to covariates to be fit in the variance model, eg c(1,2) indicates columns 1 and 2 inx
. Must be the same length asvar.model
which specifies if they are fit as linear/semi. If semi, useknots.v
to specify knots.- knots.v
Vector indicating the number of internal knots to be fit in the semi-parametric variance model. Knots are placed equidistantly over the covariate.
- degree
Integer indicating the degree of the splines fit in the mean and the variance models. The default value is
2
.- control
list of control parameters. See
VarReg.control
.- ...
arguments to be used to form the default control argument if it is not supplied directly
Value
semiVarReg.multi
returns an object of class "VarReg"
which inherits some components from the class "glm"
. This object of class "VarReg"
is a list containing the following components:
modeltype
: Text indicating the model that was fit, indicating an uncensored approach was performed.knots.m
,knots.v
,degree
,meanmodel
,varmodel
: Returning the input variables as described aboveconverged
: Logical argument indicating if convergence occurred.iterations
: Total iterations performed.reldiff
: the positive convergence tolerance that occurred at the final iteration.loglik
: Numeric variable of the maximised log-likelihood.boundary
: Logical argument indicating if the MLE is on the boundary of the parameter space.aic.c
: Akaike information criterion corrected for small samplesaic
: Akaike information criterionbic
: Bayesian information criterionhqc
: Hannan-Quinn information criterionmean.ind
: Vector of integer(s) indicating the column number(s) in the dataframedata
that were fit in the mean model.mean
: Vector of the maximum likelihood estimates of the mean parameters.var.ind
: Vector of integer(s) indicating the column(s) in the dataframedata
that were fit in the variance model.variance
: Vector of the maximum likelihood estimates of the variance parameters.data
: Dataframe containing the variables included in the model.
Examples
data(mcycle)
## run a model with linear mean and linear variance:
linmodel<-semiVarReg.multi(mcycle$accel, x=mcycle, mean.model="linear",mean.vars=2,
var.model="linear", var.vars=2, maxit=10000)
## run a model with semi-parametric mean (4 internal knots) and semi-parametric variance (2 knots):
##not run
##semimodel<-semiVarReg.multi(mcycle$accel, x=mcycle, meanmodel="semi",mean.vars=2, varmodel="semi",
##var.vars=2,knots.m=4, knots.v=2, maxit=10000)