Title: | Datasets and Utility Functions Enhancing Functionality of 'nlme' Package |
---|---|
Description: | Datasets and utility functions enhancing functionality of nlme package. Datasets, functions and scripts are described in book titled 'Linear Mixed-Effects Models: A Step-by-Step Approach' by Galecki and Burzykowski (2013). Package is under development. |
Authors: | Andrzej Galecki [email protected], Tomasz Burzykowski [email protected] |
Maintainer: | Andrzej Galecki <[email protected]> |
License: | GPL (>=2) |
Version: | 0.70-9 |
Built: | 2024-11-26 03:06:02 UTC |
Source: | https://github.com/agalecki/nlmeu |
Datasets and auxiliary functions for Galecki and Burzykowski book (2013).
Datasets and auxiliary functions for Galecki and Burzykowski book (2013). Package under development.
Andrzej Galecki [email protected], Tomasz Burzykowski [email protected]
Data from Age-Related Macular Degeneration (ARMD) clinical trial
The armd
data frame has 867 rows and 8 columns. It contains
data for n=234 subjects stored in a long format with up to four rows for one
subject.
a factor with 234 levels 1
, 2
, 3
, 4
, 6
, ..., 240
a factor with 2 levels Placebo
, Active
an integer vector with values ranging from 20 to 85
a factor with 8 levels ----
, ---X
, --X-
, --XX
, -XX-
, ..., X-XX
a factor with 4 levels 4wks
, 12wks
, 24wks
, 52wks
a numeric vector with values 4, 12, 24, 52
an integer vector with values ranging from 3 to 85
a numeric vector with values 1, 2, 3, 4 corresponding to time points 4, 12, 24, 52, respectively
The ARMD data arise from a randomized multi-center clinical trial comparing an experimental treatment (interferon-alpha) versus placebo for patients diagnosed with ARMD.
Pharmacological Therapy for Macular Degeneration Study Group (1997). Interferon alpha-IIA is ineffective for patients with choroidal neovascularization secondary to age-related macular degeneration. Results of a prospective randomized placebo-controlled clinical trial. Archives of Ophthalmology, 115, 865-872.
summary(armd)
summary(armd)
Data from Age-Related Macular Degeneration (ARMD) clinical trial
The armd.wide
data frame has 240 rows and 10 columns. Data are
stored in wide format with each row corresponding to one subject.
a factor with 240 levels 1
, 2
, 3
, 4
, 5
, ..., 240
an integer vector with values 1, 2, 3, 4
an integer vector with values ranging from 5 to 17
an integer vector with values of visual acuity measured at baseline ranging from 20 to 85
an integer vector with values of visual acuity measured at 4 weeks ranging from 12 to 84
an integer vector with values of visual acuity measured at 12 weeks ranging from 3 to 85
an integer vector with values of visual acuity measured at 24 weeks ranging from 5 to 85
an integer vector with values of visual acuity measured at 52 weeks from 4 to 85
a factor with 2 levels Placebo
, Active
a factor with 9 levels ----
, ---X
, --X-
, --XX
, -XX-
, ...,XXXX
The ARMD data arise from a randomized multi-center clinical trial comparing an experimental treatment (interferon-alpha) versus placebo for patients diagnosed with ARMD.
Pharmacological Therapy for Macular Degeneration Study Group (1997). Interferon alpha-IIA is ineffective for patients with choroidal neovascularization secondary to age-related macular degeneration. Results of a prospective randomized placebo-controlled clinical trial. Archives of Ophthalmology, 115, 865-872.
summary(armd.wide)
summary(armd.wide)
Data from Age-Related Macular Degeneration (ARMD) clinical trial
The armd0
data frame has 1107 rows and 8 columns. It contains data for n=240 subjects
stored in a long format with up to five rows for one subject.
a factor with 240 levels 1
, 2
, 3
, 4
, 5
, ...
a factor with 2 levels Placebo
, Active
an integer vector with values from 20 to 85
a factor with 9 levels ----
, ---X
, --X-
, --XX
, -XX-
, ...
a factor with 5 levels Baseline
, 4wks
, 12wks
, 24wks
, 52wks
a numeric vector with values from 0 to 52
an integer vector with values from 3 to 85
a numeric vector with values from 0 to 4
The ARMD data arise from a randomized multi-center clinical trial comparing an experimental treatment (interferon-alpha) versus placebo for patients diagnosed with ARMD.
Pharmacological Therapy for Macular Degeneration Study Group (1997). Interferon alpha-IIA is ineffective for patients with choroidal neovascularization secondary to age-related macular degeneration. Results of a prospective randomized placebo-controlled clinical trial. Archives of Ophthalmology, 115, 865-872.
Data from Flemish Community Attainment-Targets (FCAT) Study
The fcat
data frame has 4851 rows and 3 columns
a factor with 9 levels T1(4)
, T2(6)
, T3(8)
, T4(5)
, T5(9)
, ..., T9(5)
a factor with 539 levels 1
, 2
, 3
, 4
, 5
, ..., 539
an integer vector with values from 0 to 9
An educational study, in which elementary school graduates were evaluated with respect to reading comprehension in Dutch. Pupils from randomly selected schools were assessed for a set of nine attainment targets. The dataset is an example of grouped data, for which the grouping factors are crossed.
Janssen, R., Tuerlinckx, F., Meulders, M., & De Boeck, P. (2000). A hierarchical IRT model for criterion-referenced measurement. Journal of Educational and Behavioral Statistics. 25(3), 285.
summary(fcat)
summary(fcat)
This function is generic; method functions can be written to handle specific classes of objects.
logLik1(modfit, dt1, dtInit)
logLik1(modfit, dt1, dtInit)
modfit |
an object representing model fitted to data using ML estimation. |
dt1 |
a data frame with data for one subject, for whom the log-likelihood function is to be evaluated |
dtInit |
an optional auxiliary data frame. |
numeric scalar value representing contribution of a given
subject to the overall log-likelihood returned by
logLik()
function.
Andrzej Galecki and Tomasz Burzykowski
???
require(nlme) logLik(fm1 <- lme(distance ~ age, data = Orthodont)) # random is ~ age dt1 <- subset(Orthodont, Subject == "M01") logLik1(fm1, dt1)
require(nlme) logLik(fm1 <- lme(distance ~ age, data = Orthodont)) # random is ~ age dt1 <- subset(Orthodont, Subject == "M01") logLik1(fm1, dt1)
lme
objectThis is method for logLik1()
generic function.
## S3 method for class 'lme' logLik1(modfit, dt1, dtInit)
## S3 method for class 'lme' logLik1(modfit, dt1, dtInit)
modfit |
an |
dt1 |
a data frame with data for one subject, for whom the log-likelihood function is to be evaluated |
dtInit |
an optional auxiliary data frame. |
Calculates profile likelihood (with beta profiled out) for *one* subject. Data with *one* level of grouping only. correlation component in modelStruct not implemented.
numeric scalar value representing contribution of a given
subject to the overall log-likelihood returned by
logLik()
function applied to lme
object
defined by modfit
argument.
Andrzej Galecki and Tomasz Burzykowski
require(nlme) lm3.form <- visual ~ visual0 + time + treat.f (fm16.5ml <- # M16.5 lme(lm3.form, random = list(subject = pdDiag(~time)), weights = varPower(form = ~time), data = armd, method = "ML")) df1 <- subset(armd, subject == "1") # Panel R20.7 logLik1(fm16.5ml, df1)
require(nlme) lm3.form <- visual ~ visual0 + time + treat.f (fm16.5ml <- # M16.5 lme(lm3.form, random = list(subject = pdDiag(~time)), weights = varPower(form = ~time), data = armd, method = "ML")) df1 <- subset(armd, subject == "1") # Panel R20.7 logLik1(fm16.5ml, df1)
This function allows to compactly present pattern of missing data in a given vector/matrix/data frame or combination of thereof.
missPat(..., symbols = c("X", "-"), collapse = "", missData = FALSE)
missPat(..., symbols = c("X", "-"), collapse = "", missData = FALSE)
... |
one or more vectors/matrices/data frames. They need to be compatible for columnwise binding. |
symbols |
vector containing two single characters
used to indicate NA and remaining values. By defualt it
has values: |
collapse |
an optional character string. It is used
in the internal call |
missData |
logical. If |
character vector with as many elements as length of
vectors(s)/number of rows in matrices and/or data frames
in ...{}
argument(s). Attribute cnames
contains names of vectors/columns/variables. Optional
attribute missData
contains data frame with
missing pattern.
Andrzej Galecki and Tomasz Burzykowski
dtf <- subset(armd.wide, select = c(visual12, visual24, visual52)) missPat(dtf, symbols = c("?","+"))
dtf <- subset(armd.wide, select = c(visual12, visual24, visual52)) missPat(dtf, symbols = c("?","+"))
Data from a Progressive Resistance Randomized Trial.
The prt
data frame has 2471 rows and 9 columns. It contains
data for n = 63 subjects. Each subject underwent muscle biopsy before and
after intervention. Data are stored in a long format with each record
corresponding to one muscle fiber. There are two types of muscle fibers: Type
1 and Type 2. Dependent variables: specific force and isometric force are
measured pre- and post intervention.
a factor with 63 levels 5
, 10
, 15
, 20
, 25
, ..., 520
(subject id)
a factor with 2 levels High
, Low
, i.e. training (intervention) intensity
a factor with 2 levels Young
, Old
(stratifying variable)
a factor with 2 levels Female
, Male
(stratifying variable)
a numeric vector with values of BMI at baseline ranging from 18.36 to 32.29
a numeric vector with values of isometric force ranging from 0.16 to 2.565
a numeric vector with values of specific force ranging from 80.5 to 290
a factor with 2 levels Pre
, Pos
, i.e. pre- and post-intervention.
a factor with 2 levels Type 1
, Type 2
, i.e. Type 1 and Type 2 muscle fiber.
Data frame prt
was obtained by merging
prt.subjects
and prt.fiber
.
Claflin, D.R., Larkin, L.M., Cederna, P.S., Horowitz, J.F., Alexander, N.B., Cole, N.M., Galecki, A.T., Chen, S., Nyquist, L.V., Carlson, B.M., Faulkner, J.A., & Ashton-Miller, J.A. (2011) Effects of high- and low-velocity resistance training on the contractile properties of skeletal muscle fibers from young and older humans. Journal of Applied Physiology, 111, 1021-1030.
summary(prt)
summary(prt)
Data from a Progressive Resistance Randomized Trial.
The prt.fiber
data frame has 2471 rows and 5 columns. Each row
in the data corresponds to one muscle fiber collected during muscle biopsy.
See prt
data frame for the description of the study design.
a factor with 63 levels 5
, 10
, 15
, 20
, 25
, ..., 520
a numeric vector with values of isometric force ranging from 0.16 to 2.565
a numeric vector with values of specific force ranging from 80.5 to 290
a factor with 2 levels Pre
, Pos
, i.e. pre- and post- intervention
a factor with 2 levels Type 1
, Type 2
, i.e. Type 1 and Type 2 muscle fiber.
PRT trial was aimed for devising evidence-based methods for improving and measuring the mobility and muscle power of elderly men and women
Claflin, D.R., Larkin, L.M., Cederna, P.S., Horowitz, J.F., Alexander, N.B., Cole, N.M., Galecki, A.T., Chen, S., Nyquist, L.V., Carlson, B.M., Faulkner, J.A., & Ashton-Miller, J.A. (2011) Effects of high- and low-velocity resistance training on the contractile properties of skeletal muscle fibers from young and older humans. Journal of Applied Physiology, 111, 1021-1030.
summary(prt.fiber)
summary(prt.fiber)
Data prt.subjects ...
The prt.subjects
data frame has 63 rows and 5 columns
a factor with 63 levels 5
, 10
, 15
, 20
, 25
, ...
a factor with 2 levels High
, Low
a factor with 2 levels Young
, Old
a factor with 2 levels Female
, Male
a numeric vector with values from 18.4 to 32.3
The working hypothesis was that a 12-week program of PRT would increase: (a) the power output of the overall musculature associated with movements of the ankles, knees, and hips; (b) the cross-sectional area and the force and power of permeabilized single fibers obtained from the vastus lateralis muscle; and (c) the ability of young and elderly men and women to safely arrest standardized falls. The training consisted of repeated leg extensions by shortening contractions of the leg extensor muscles against a resistance that was increased as the subject trained using a specially designed apparatus
Claflin, D.R., Larkin, L.M., Cederna, P.S., Horowitz, J.F., Alexander, N.B., Cole, N.M., Galecki, A.T., Chen, S., Nyquist, L.V., Carlson, B.M., Faulkner, J.A., & Ashton-Miller, J.A. (2011) Effects of high- and low-velocity resistance training on the contractile properties of skeletal muscle fibers from young and older humans. Journal of Applied Physiology, 111, 1021-1030.
summary(prt.subjects)
summary(prt.subjects)
This function is generic; method functions can be written to handle specific classes of objects.
Pwr(object, ...)
Pwr(object, ...)
object |
an object containing the results returned
by a model fitting function (e.g., |
... |
some methods for this generic function may require additional arguments. |
numeric scalar value.
Andrzej Galecki and Tomasz Burzykowski
## Not run: Pwr (fm1) ## End(Not run)
## Not run: Pwr (fm1) ## End(Not run)
This is method for Pwr()
generic function. It
works fine for an example given in the book. It may
require additional testing, especially for post-hoc power
analysis
## S3 method for class 'lme' Pwr(object, ..., type = c("sequential", "marginal"), Terms, L, verbose = FALSE, sigma, ddf = numeric(0), alpha = 0.05, altB = NULL, tol = 1e-10)
## S3 method for class 'lme' Pwr(object, ..., type = c("sequential", "marginal"), Terms, L, verbose = FALSE, sigma, ddf = numeric(0), alpha = 0.05, altB = NULL, tol = 1e-10)
object |
an object containing |
... |
some additional arguments may be required. |
type |
an optional character string specifying the
type of sum of squares to be used in F-tests needed for
power calculations. Syntax is the same as for
|
Terms |
an optional integer or character vector
specifying which terms in the model should be jointly
tested to be zero using a Wald F-test. See
|
L |
an optional numeric vector or array specifying
linear combinations of the coefficients in the model that
should be tested to be zero. See |
verbose |
an optional logical value. See
|
sigma |
numeric scalar value. |
ddf |
numeric scalar value. Argument can be used to redefine default number of denominator degrees of freedom |
alpha |
numeric scalar value. By default 0.05. |
altB |
matrix/vector containing alternative values for beta parameters |
tol |
numeric scalar value. |
a data frame inheriting from class Pwr.lme
Andrzej Galecki and Tomasz Burzykowski
Default call of the function without arguments, prints a list of available scripts.
runScript(script = NA, package = "nlmeU", subdir = "scriptsR2.15.0", echo = TRUE)
runScript(script = NA, package = "nlmeU", subdir = "scriptsR2.15.0", echo = TRUE)
script |
character string containing name of the script to be executed. By default is set to NA. |
package |
character string containing package name. By default nlmeU. |
subdir |
subdirectory containing scripts. By default: scriptsR15.0. |
echo |
logical. Used by source function. By default set to TRUE. |
Script is executed and results are printed.
Andrzej Galecki and Tomasz Burzykowski
runScript()
runScript()
This function is generic; method functions can be written to handle specific classes of objects.
sigma(object, ...)
sigma(object, ...)
object |
an object for which scale parameter can be extracted. |
... |
some methods for this generic function may require additional arguments. |
numeric scalar value.
Andrzej Galecki and Tomasz Burzykowski
## sigma (fm1)
## sigma (fm1)
Data from Study of Instructional Improvement Project
The SIIdata
data frame has 1190 rows and 12 columns. The
dataset includes results for 1190 first grade pupils sampled from 312
classrooms in 107 schools.
a factor with 2 levels M
, F
,i.e. males and females, resepectively
a factor with 2 levels Mnrt=No
, Mnrt=Yes
. An indicator variable for the minority status
an integer vector with values from 290 to 629. This is pupil's math score in the spring of the kindergarten year
an integer vector with values from -110 to 253. Number represents pupil's gain in the math achievement score from the spring of kindergarten to the spring of first grade
a numeric vector with values from -1.61 to 3.21. Value represents socioeconomical status
a numeric vector with values from 0 to 40. It is number of years of teacher's experience in teaching in the first grade
a numeric vector with values from -2.5 to 2.61. Number represents teacher's knowledge of the first-grade math contents (higher values indicate a higher knowledge of the contents)
a numeric vector containing proportion of households in the nneighborhood of the school below the poverty level with values ranging from 0.012 to 0.564
a numeric vector with values from 1 to 6. Contains the number of preparatory courses on the first-grade math contents and methods followed by the teacher.
a factor with 312 levels 1
, 2
, 3
, 4
, 5
, ..., 312
. Classroom's id
a factor with 107 levels 1
, 2
, 3
, 4
, 5
, ..., 107
. School's id
a factor with 1190 levels 1
, 2
, 3
, 4
, 5
, ..., 1190
. Pupil's id
The SII Project was carried out to assess the math
achievement scores of first- and third-grade pupils in
randomly selected classrooms from a national US sample of
elementary schools (Hill et al, 2005). Data were also
analyzed in West et al, 2007. The outcome of interest is
mathgain
variable. Data were created based on
classroom
data from WWGbook
package
Hill, H., Rowan, B., and Ball, D. (2005). Effect of teachers mathematical knowledge for teaching on student achievement. American Educational Research Journal, 42, 371-406.
West, B. T.,Welch, K. B., and Galecki, A. T. (2007). Linear Mixed Models: A Practical Guide Using Statistical Software. Chapman and Hall/CRC.
summary(SIIdata)
summary(SIIdata)
This function is generic; method functions can be written to handle specific classes of objects.
simulateY(object, nsim = 1, seed = NULL, ..., verbose = FALSE, sigma)
simulateY(object, nsim = 1, seed = NULL, ..., verbose = FALSE, sigma)
object |
an object with a model fit for which dependent variable is to be simulated. |
nsim |
number of simulations. nsim = 1 by default. |
seed |
integer scalar used to initiate random numbers generator. |
... |
some methods for this generic function may require additional arguments. |
verbose |
logical. If TRUE basic information about arguments is provided. By default set to FALSE. |
sigma |
numeric scalar. Allows to perform simulations employing alternative value of the scale parameter. |
numeric matrix. Number of columns determined by nsim argument.
Andrzej Galecki and Tomasz Burzykowski
## simulateY (fm1)
## simulateY (fm1)