Package 'covBM'

Title: Brownian Motion Processes for 'nlme'-Models
Description: Allows Brownian motion, fractional Brownian motion, and integrated Ornstein-Uhlenbeck process components to be added to linear and non-linear mixed effects models using the structures and methods of the 'nlme' package.
Authors: Oliver Stirrup [aut, cre]
Maintainer: Oliver Stirrup <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-01-21 03:39:34 UTC
Source: https://github.com/ostirrup/covbm

Help Index


Serial CD4 counts in children with HIV.

Description

Dataset used in Data Analysis Using Regression and Multilevel/Hierarchical Models by Andrew Gelman and Jennifer Hill (Cambridge University Press, 2006). Rows with missing values of 'CD4CNT', 'visage' or 'baseage' have been removed.

Usage

cd4

Format

A data frame with 976 rows and 11 variables:

newpid

Patient ID code.

t

Time, in years from first visit.

sqrtcd4

Square root of CD4 count.

treatmnt

Indicator variable for treatment, 1 represents control group and 2 indicates zinc treatment group.

CD4CNT

CD4 count on original (untransformed) scale.

baseage

Age of child in years at initial visit.

visage

Age of child in years at given visit.

Source

http://www.stat.columbia.edu/~gelman/arm/examples/cd4/


coef.covBM

Description

This is a method function that extracts the scale coefficient associated with a Brownian motion correlation structure object.

Usage

## S3 method for class 'covBM'
coef(object, unconstrained = TRUE, ...)

Arguments

object

An object of class covBM, inheriting from corStruct.

unconstrained

A logical value. If TRUE the coefficients are returned in unconstrained form (as used in the optimization algorithm). If FALSE the coefficients are returned in "natural" form.

...

Additional arguments (not used by this method).

Examples

cov1<-covBM(form=~time|group)
coef(cov1)

coef.covFracBM

Description

This is a method function that extracts the scale coefficient and Hurst parameter associated with a fractional Brownian motion correlation structure object.

Usage

## S3 method for class 'covFracBM'
coef(object, unconstrained = TRUE, ...)

Arguments

object

An object of class covFracBM, inheriting from corStruct.

unconstrained

A logical value. If TRUE the coefficients are returned in unconstrained form (as used in the optimization algorithm). If FALSE the coefficients are returned in "natural" form.

...

Additional arguments (not used by this method).

Examples

cov2<-covFracBM(form=~time|group)
coef(cov2)

coef.covIOU

Description

This is a method function that extracts the perturbation and Alpha parameters associated with an integrated Ornstein-Uhlenbeck (IOU) process correlation structure object.

Usage

## S3 method for class 'covIOU'
coef(object, unconstrained = TRUE, ...)

Arguments

object

An object of class covIOU, inheriting from corStruct.

unconstrained

A logical value. If TRUE the coefficients are returned in unconstrained form (as used in the optimization algorithm). If FALSE the coefficients are returned in "natural" form.

...

Additional arguments (not used by this method).

Examples

cov3<-covIOU(form=~time|group)
coef(cov3)

corMatrix.covBM

Description

This method generates a scaled covariance matrix (or list of matrices), for a "covBM" "corStruct" object.

Usage

## S3 method for class 'covBM'
corMatrix(object, covariate = getCovariate(object), ...)

Arguments

object

An object of class covBM, inheriting from corStruct.

covariate

List of covariate vectors, at which values the correlation matrix, or list of correlation matrices, are to be evaluated, as for corMatrix.corStruct.

...

Additional arguments (not used by this method).


corMatrix.covFracBM

Description

This method generates a scaled covariance matrix (or list of matrices), for a "covFracBM" "corStruct" object.

Usage

## S3 method for class 'covFracBM'
corMatrix(object, covariate = getCovariate(object), ...)

Arguments

object

An object of class covFracBM, inheriting from corStruct.

covariate

List of covariate vectors, at which values the correlation matrix, or list of correlation matrices, are to be evaluated, as for corMatrix.corStruct.

...

Additional arguments (not used by this method).


corMatrix.covIOU

Description

This method generates a scaled covariance matrix (or list of matrices), for a "covIOU" "corStruct" object.

Usage

## S3 method for class 'covIOU'
corMatrix(object, covariate = getCovariate(object), ...)

Arguments

object

An object of class covIOU, inheriting from corStruct.

covariate

List of covariate vectors, at which values the correlation matrix, or list of correlation matrices, are to be evaluated, as for corMatrix.corStruct.

...

Additional arguments (not used by this method).


covBM

Description

This is a constructor function for the "covBM" class, representing a Brownian motion component in terms of a continuous variable. The object created is a special type of corStruct.

covBM

Usage

covBM(value = 1, form = ~1)

Arguments

value

Numeric argument providing starting value for the scale parameter of Brownian motion process relative to residual error variance for optimisation.

form

A one-sided formula of the form ~t|g, where t represents a continuous variable (usually time) and g represents a grouping factor, i.e. with a separate Brownian motion process modelled at each level.

Value

An object of class "covBM" and inheriting from "corStruct".

Examples

cov1<-covBM(form=~time|group)

covFracBM

Description

This is a constructor function for the "covFracBM" class, representing a fractional Brownian motion component in terms of a continuous variable. The object created is a special type of corStruct.

Usage

covFracBM(value = c(1, 0.5), form = ~1)

Arguments

value

Vector of length 2 providing starting values for optimisation of the scale parameter of fractional Brownian motion process relative to residual error variance and the Hurst parameter, respectively.

form

A one-sided formula of the form ~t|g, where t represents a continuous variable (usually time) and g represents a grouping factor, i.e. with a separate fractional Brownian motion process modelled at each level.

Value

An object of class "covFracBM" and inheriting from "corStruct".

Examples

cov2<-covFracBM(form=~time|group)

covIOU

Description

This is a constructor function for the "covIOU" class, representing an integrated Ornstein-Uhlenbeck (IOU) process component in terms of a continuous variable. The object created is a special type of corStruct.

Usage

covIOU(value = c(1, 1), form = ~1)

Arguments

value

Vector of length 2 providing starting values for optimisation of the perturbation parameter of integrated Ornstein-Uhlenbeck process relative to residual error variance and the Alpha parameter, respectively.

form

A one-sided formula of the form ~t|g, where t represents a continuous variable (usually time) and g represents a grouping factor, i.e. with a separate integrated Ornstein-Uhlenbeck process modelled at each level.

Value

An object of class "covIOU" and inheriting from "corStruct".

Examples

cov3<-covIOU(form=~time|group)

lmeBM

Description

This function is a wrapper for lme.formula that allows Brownian motion, fractional Brownian motion or integrated Ornstein-Uhlenbeck components to be included in linear mixed models, with related parameter estimates and confidence intervals returned in their natural parameterisation.

Usage

lmeBM(fixed, data, random, covariance = NULL, method = c("REML", "ML"),
  control = list(), keep.data = TRUE)

Arguments

fixed

This is as specified for lme.formula.

data

This is as specified for lme.formula.

random

This is as specified for lme.formula.

covariance

An optional corStruct object describing the within-group covariance structure. In addition to those available in nlme, covBM can be used to incorporate a Brownian motion component, covFracBM can be used to incorporate a fractional Brownian motion component and covIOU can be used to incorporate an integrated Ornstein-Uhlenbeck process in relation to a continuous variable.

method

This is as specified for lme.formula.

control

This is as specified for lme.formula.

keep.data

This is as specified for lme.formula.

Value

An object of class "lme" representing the linear mixed effects model fit.

Examples

BMmodel<-lmeBM(sqrtcd4~t, data=cd4, random=~t|newpid, covariance=covBM(form=~t|newpid),
							method="ML", control=list(opt="link{nlm}"))

nlmeBM

Description

This function is a wrapper for nlme.formula that allows Brownian motion, fractional Brownian motion or integrated Ornstein-Uhlenbeck components to be included in non-linear mixed models, with related parameter estimates and confidence intervals returned in their natural parameterisation.

Usage

nlmeBM(model, data, fixed, random, start, covariance = NULL,
  method = c("ML", "REML"), control = list(), verbose = FALSE)

Arguments

model

This is as specified for nlme.formula.

data

This is as specified for lme.formula.

fixed

This is as specified for lme.formula.

random

This is as specified for nlme.formula.

start

This is as specified for nlme.formula.

covariance

An optional corStruct object describing the within-group covariance structure. In addition to those available in nlme, covBM can be used to incorporate a Brownian motion component, covFracBM can be used to incorporate a fractional Brownian motion component and covIOU can be used to incorporate an integrated Ornstein-Uhlenbeck process in relation to a continuous variable.

method

This is as specified for lme.formula.

control

This is as specified for nlme.formula.

verbose

This is as specified for nlme.formula.

Value

An object of class "nlme" and inheriting from class "lme" representing the non-linear mixed effects model fit.

Examples

data(Milk, package="nlme")
Model_fit<- nlmeBM(protein ~ SSasymp(Time, Asym, R0, lrc), data=Milk,
				fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1|Cow,
				covariance=covFracBM(form=~Time|Cow),
        		start = c(Asym = 3.5, R0 = 4, lrc = -1))

print.summary.corStructBM

Description

print.summary.corStructBM

Usage

## S3 method for class 'summary.corStructBM'
print(x, ...)

Arguments

x

An object of class "summary.corStructBM", containing information on fitted stochastic process component.

...

Additional arguments (not used for this method).


summary.covBM

Description

summary.covBM

Usage

## S3 method for class 'covBM'
summary(object, structName = class(object)[1], ...)

Arguments

object

An object of class "covBM", containing information on fitted stochastic process component.

structName

An optional character string defining the type of correlation structure associated with object, as for summary.corStruct. Defaults to class(object)[1].

...

Additional arguments (not used for this method).


summary.covFracBM

Description

summary.covFracBM

Usage

## S3 method for class 'covFracBM'
summary(object, structName = class(object)[1], ...)

Arguments

object

An object of class "covFracBM", containing information on fitted stochastic process component.

structName

An optional character string defining the type of correlation structure associated with object, as for summary.corStruct. Defaults to class(object)[1].

...

Additional arguments (not used for this method).


summary.covIOU

Description

summary.covIOU

Usage

## S3 method for class 'covIOU'
summary(object, structName = class(object)[1], ...)

Arguments

object

An object of class "covIOU", containing information on fitted stochastic process component.

structName

An optional character string defining the type of correlation structure associated with object, as for summary.corStruct. Defaults to class(object)[1].

...

Additional arguments (not used for this method).