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 |
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.
cd4
cd4
A data frame with 976 rows and 11 variables:
Patient ID code.
Time, in years from first visit.
Square root of CD4 count.
Indicator variable for treatment, 1 represents control group and 2 indicates zinc treatment group.
CD4 count on original (untransformed) scale.
Age of child in years at initial visit.
Age of child in years at given visit.
http://www.stat.columbia.edu/~gelman/arm/examples/cd4/
This is a method function that extracts the scale coefficient associated with a Brownian motion correlation structure object.
## S3 method for class 'covBM' coef(object, unconstrained = TRUE, ...)
## S3 method for class 'covBM' coef(object, unconstrained = TRUE, ...)
object |
|
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). |
cov1<-covBM(form=~time|group) coef(cov1)
cov1<-covBM(form=~time|group) coef(cov1)
This is a method function that extracts the scale coefficient and Hurst parameter associated with a fractional Brownian motion correlation structure object.
## S3 method for class 'covFracBM' coef(object, unconstrained = TRUE, ...)
## S3 method for class 'covFracBM' coef(object, unconstrained = TRUE, ...)
object |
|
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). |
cov2<-covFracBM(form=~time|group) coef(cov2)
cov2<-covFracBM(form=~time|group) coef(cov2)
This is a method function that extracts the perturbation and Alpha parameters associated with an integrated Ornstein-Uhlenbeck (IOU) process correlation structure object.
## S3 method for class 'covIOU' coef(object, unconstrained = TRUE, ...)
## S3 method for class 'covIOU' coef(object, unconstrained = TRUE, ...)
object |
|
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). |
cov3<-covIOU(form=~time|group) coef(cov3)
cov3<-covIOU(form=~time|group) coef(cov3)
This method generates a scaled covariance matrix (or list of matrices), for a "covBM" "corStruct" object.
## S3 method for class 'covBM' corMatrix(object, covariate = getCovariate(object), ...)
## S3 method for class 'covBM' corMatrix(object, covariate = getCovariate(object), ...)
object |
|
covariate |
List of covariate vectors, at which values the correlation matrix,
or list of correlation matrices, are to be evaluated, as for |
... |
Additional arguments (not used by this method). |
This method generates a scaled covariance matrix (or list of matrices), for a "covFracBM" "corStruct" object.
## S3 method for class 'covFracBM' corMatrix(object, covariate = getCovariate(object), ...)
## S3 method for class 'covFracBM' corMatrix(object, covariate = getCovariate(object), ...)
object |
|
covariate |
List of covariate vectors, at which values the correlation matrix,
or list of correlation matrices, are to be evaluated, as for |
... |
Additional arguments (not used by this method). |
This method generates a scaled covariance matrix (or list of matrices), for a "covIOU" "corStruct" object.
## S3 method for class 'covIOU' corMatrix(object, covariate = getCovariate(object), ...)
## S3 method for class 'covIOU' corMatrix(object, covariate = getCovariate(object), ...)
object |
|
covariate |
List of covariate vectors, at which values the correlation matrix,
or list of correlation matrices, are to be evaluated, as for |
... |
Additional arguments (not used by this method). |
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
covBM(value = 1, form = ~1)
covBM(value = 1, form = ~1)
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. |
An object of class "covBM" and inheriting from "corStruct".
cov1<-covBM(form=~time|group)
cov1<-covBM(form=~time|group)
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
.
covFracBM(value = c(1, 0.5), form = ~1)
covFracBM(value = c(1, 0.5), form = ~1)
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. |
An object of class "covFracBM" and inheriting from "corStruct".
cov2<-covFracBM(form=~time|group)
cov2<-covFracBM(form=~time|group)
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
.
covIOU(value = c(1, 1), form = ~1)
covIOU(value = c(1, 1), form = ~1)
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. |
An object of class "covIOU" and inheriting from "corStruct".
cov3<-covIOU(form=~time|group)
cov3<-covIOU(form=~time|group)
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.
lmeBM(fixed, data, random, covariance = NULL, method = c("REML", "ML"), control = list(), keep.data = TRUE)
lmeBM(fixed, data, random, covariance = NULL, method = c("REML", "ML"), control = list(), keep.data = TRUE)
fixed |
This is as specified for |
data |
This is as specified for |
random |
This is as specified for |
covariance |
An optional |
method |
This is as specified for |
control |
This is as specified for |
keep.data |
This is as specified for |
An object of class "lme" representing the linear mixed effects model fit.
BMmodel<-lmeBM(sqrtcd4~t, data=cd4, random=~t|newpid, covariance=covBM(form=~t|newpid), method="ML", control=list(opt="link{nlm}"))
BMmodel<-lmeBM(sqrtcd4~t, data=cd4, random=~t|newpid, covariance=covBM(form=~t|newpid), method="ML", control=list(opt="link{nlm}"))
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.
nlmeBM(model, data, fixed, random, start, covariance = NULL, method = c("ML", "REML"), control = list(), verbose = FALSE)
nlmeBM(model, data, fixed, random, start, covariance = NULL, method = c("ML", "REML"), control = list(), verbose = FALSE)
model |
This is as specified for |
data |
This is as specified for |
fixed |
This is as specified for |
random |
This is as specified for |
start |
This is as specified for |
covariance |
An optional |
method |
This is as specified for |
control |
This is as specified for |
verbose |
This is as specified for |
An object of class "nlme" and inheriting from class "lme" representing the non-linear mixed effects model fit.
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))
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
## S3 method for class 'summary.corStructBM' print(x, ...)
## S3 method for class 'summary.corStructBM' print(x, ...)
x |
An object of class "summary.corStructBM", containing information on fitted stochastic process component. |
... |
Additional arguments (not used for this method). |
summary.covBM
## S3 method for class 'covBM' summary(object, structName = class(object)[1], ...)
## S3 method for class 'covBM' summary(object, structName = class(object)[1], ...)
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 |
... |
Additional arguments (not used for this method). |
summary.covFracBM
## S3 method for class 'covFracBM' summary(object, structName = class(object)[1], ...)
## S3 method for class 'covFracBM' summary(object, structName = class(object)[1], ...)
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 |
... |
Additional arguments (not used for this method). |
summary.covIOU
## S3 method for class 'covIOU' summary(object, structName = class(object)[1], ...)
## S3 method for class 'covIOU' summary(object, structName = class(object)[1], ...)
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 |
... |
Additional arguments (not used for this method). |