seVarReg: SE calculations for mean and variance regression models

View source: R/seVarReg.R

seVarRegR Documentation

SE calculations for mean and variance regression models

Description

seVarReg calculates SE for an object of class VarReg. If the result is not on a boundary, the Fishers Information matrix SE are given. The bootstrapped 95% CI can also be calculated. Designed to be called by the plot function plotVarReg, rather than run by a user.

Usage

seVarReg(
  x,
  boot = FALSE,
  bootreps = 1000,
  vector.mean = x$data[, 2],
  vector.variance = x$data[, 2],
  control = list(...),
  ...
)

Arguments

x

Object of class VarReg to determin the SE (eg. result from semiVarReg).

boot

Logical to indicate if bootstrapped CI should be calculated. Default is FALSE.

bootreps

Number of bootstraps to be performed if boot=TRUE. Default is 1000.

vector.mean

Vector of x values for which the SE of the mean is to be calculated. Default is the x covariate from the model.

vector.variance

Vector of x values for which the SE of the variance is to be calculated. Default is the actual x covariate from the model.

control

List of control parameters for the bootstrapped models. See VarReg.control.

...

arguments to be used to form the default control argument if it is not supplied directly

Value

The result is a list of results. This includes:

  • mean.est: dataframe of overall results from the mean model, including parameter estimates from the model, SEs from information matrix (if boundary=FALSE) and if specified, the SE from bootstrapping with the bootstrapped 95% CI.

  • variance.est: dataframe of overall results from the variance model, including parameter estimates from the model, SEs from information matrix (if boundary=FALSE) and if specified, the SE from bootstrapping with the bootstrapped 95% CI.

  • mean.im: dataframe of the expected information matrices for the mean (as appropriate)

  • variance.im: dataframe of the expected information matrices for the variance (as appropriate)

  • mean.outputs: dataframe with complete output for mean graphics. Includes the vector.mean as input, and the mean vector (mean.mean) and the SE vector mean.se.im, and bootstrapping outputs as appropriate.

  • variance.outputs: dataframe with complete output for variance graphics. Includes the vector.variance as input, and the mean vector (var.mean) and the SE vector var.se.im, and bootstrapping outputs as appropriate.

See Also

semiVarReg, VarReg.control

Examples

data(mcycle)
##Fit model with range as a covariate in the mean and the variance model
semimodel<-semiVarReg(mcycle$accel, mcycle$times, meanmodel="semi", varmodel="linear",
knots.m=4, maxit=10000)
##Calculate SE
se1<-seVarReg(semimodel, boot=FALSE)
##not run: with bootstrapping
##se2<-seVarReg(semimodel, boot=TRUE, bootreps=10)
##not run: calculate mean and SE for a given sequence
##test.seq<-seq(min(mcycle$times), max(mcycle$times),
##by=((max(mcycle$times)-min(mcycle$times))/999))
##se2<-seVarReg(semimodel, boot=TRUE, bootreps=10, vector.mean=test.seq)

VarReg documentation built on May 31, 2023, 8:44 p.m.