var.inspect: A function for calculating empirical variances with respect... In lmenssp: Linear Mixed Effects Models with Non-Stationary Stochastic Processes

Description

Calculates empirical variances for data sets with regularly or irregularly spaced time points, and plots the result

Usage

 `1` ```var.inspect(resid, timeVar, binwidth, numElems = 0, irregular = T) ```

Arguments

 `resid` a vector of empirical residuals `timeVar` a vector for the time variable `binwidth` a numerical value for the bin length, to be used for irregularly spaced data `numElems` a numerical value for the elimination of the bins with less than that number of elements `irregular` a character string, `FALSE` indicates the data are collected at regular time points

Value

Returns mid values and variances of the bins, and numbers of elements falling into the bins for `irregular = TRUE`, and unique time points and variances, and number of the elements for the time points for `irregular = FALSE`.

Author(s)

Ozgur Asar, Peter J. Diggle

References

Asar O, Ritchie J, Kalra P, Diggle PJ (2015) Acute kidney injury amongst chronic kidney disease patients: a case-study in statistical modelling. To be submitted.

Diggle PJ, Sousa I, Asar O (2015) Real time monitoring of progression towards renal failure in primary care patients. Biostatistics, 16(3), 522-536.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```# loading the data set and subsetting it for the first 20 patients # for the sake illustration of the usage of the functions data(data.sim.ibm) data.sim.ibm.short <- data.sim.ibm[data.sim.ibm\$id <= 20, ] # obtaining empirical residuals by a linear model # and calculating the empirical variances lm.fit <- lm(log.egfr ~ sex + bage + fu + pwl, data = data.sim.ibm.short) var.inspect(resid = resid(lm.fit), timeVar = data.sim.ibm.short\$fu, binwidth = 0.1, numElems = 20, irregular = TRUE) ```

lmenssp documentation built on May 29, 2017, 10:33 p.m.