censloop_em: The Censored data EM loop

View source: R/censloop_em.R

censloop_emR Documentation

The Censored data EM loop

Description

censloop_em is an EM loop function for censored data to be utilised by various other higher level functions.

Usage

censloop_em(
  meanmodel,
  theta.old,
  beta.old,
  p.old,
  x.0,
  X,
  censor.ind,
  mean.intercept,
  maxit,
  eps
)

Arguments

meanmodel

Dataframe containing only the covariates to be fit in the mean model. NULL for zero mean model and FALSE for constant mean model.

theta.old

Vector containing the initial variance parameter estimates to be fit in the variance model.

beta.old

Vector containing the initial mean parameter estimates to be fit in the mean model.

p.old

Vector of length n containing the initial variance estimate.

x.0

Matrix of covariates (length n) to be fit in the variance model. All have been rescaled so zero is the minimum. If NULL, then its a constant variance model.

X

Vector of length n of the outcome variable.

censor.ind

Vector of length n of the censoring indicator. 0=uncensored, -1=left censored and 1 is right censored.

mean.intercept

Logical to indicate if mean intercept is to be included in the model.

maxit

Number of maximum iterations for the EM algorithm.

eps

Very small number for the convergence criteria.

Value

A list of the results from the EM algorithm, including:

  • conv: Logical argument indicating if convergence occurred

  • it: Total iterations performed of the EM algorithm

  • reldiff: the positive convergence tolerance that occured at the final iteration.

  • theta.new: Vector of variance parameter estimates. Note that these are not yet transformed back to the appropriate scale

  • mean: Vector of mean parameter estimates

  • fittedmean: Vector of fitted mean estimates

  • p.old: Vector of fitted variance estimates


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