R/data.R

#' Simulated Value-Added Data
#'
#' A data set simulated from a variable persistence model, illustrating a
#' model with perfectly correlated current and future effects for each teacher.
#'
#' @format A data frame with 3,750 observations on 1,250 students over three
#'   years, with 50 teachers in each year, and five variables:
#' \describe{
#'   \item{student}{Numeric student identifier.}
#'   \item{teacher}{Numeric teacher identifier, interpreted within year.}
#'   \item{year}{Numeric observation year, from 1 to 3.}
#'   \item{y}{Numeric student score.}
#'   \item{cont_var}{Numeric continuous covariate.}
#' }
#' @details
#' Scores combine a student effect, current and persistent teacher effects,
#' the continuous covariate, and independent errors. The persistence
#' multiplier is 0.4. The student, teacher, and residual standard deviations
#' are each 5; the covariate standard deviation is 4 and its coefficient is 1.
#'
#' The original simulation used the following code and R's pre-3.6.0
#' \code{"Rounding"} sampler. On R 3.6.0 or later, first select
#' \code{RNGkind(sample.kind = "Rounding")} to reproduce the supplied data,
#' and restore your preferred RNG settings afterward. With that sampler,
#' the code reproduces the stored data exactly.
#' \preformatted{
#' set.seed(0)
#' years <- 3
#' teachers <- 50
#' students <- 25
#' alpha <- .4
#' eta.stu <- rnorm(students * teachers, 0, 5)
#' z1 <- rep(1:teachers, each = students)
#' z2 <- sample(rep(1:teachers, each = students))
#' z3 <- sample(rep(1:teachers, each = students))
#' cont_var1 <- rnorm(students * teachers, 0, 4)
#' cont_var2 <- rnorm(students * teachers, 0, 4)
#' cont_var3 <- rnorm(students * teachers, 0, 4)
#' gam1 <- rnorm(teachers, 0, 5)
#' gam2 <- rnorm(teachers, 0, 5)
#' gam3 <- rnorm(teachers, 0, 5)
#' eps1 <- rnorm(students * teachers, 0, 5)
#' eps2 <- rnorm(students * teachers, 0, 5)
#' eps3 <- rnorm(students * teachers, 0, 5)
#' y1 <- eta.stu + gam1[z1] + cont_var1 + eps1
#' y2 <- eta.stu + gam1[z1] * alpha + gam2[z2] + cont_var2 + eps2
#' y3 <- eta.stu + gam1[z1] * alpha + gam2[z2] * alpha + gam3[z3] +
#'   cont_var3 + eps3
#' student <- 1:(students * teachers)
#' teacher <- c(z1, z2, z3)
#' cont_var <- c(cont_var1, cont_var2, cont_var3)
#' year <- rep(1:3, each = students * teachers)
#' y <- c(y1, y2, y3)
#' vam_data <- as.data.frame(cbind(student, teacher, year, y, cont_var))
#' }
#' @examples
#' data(vam_data)
#' head(vam_data)
#' @keywords datasets
"vam_data"

#' Historical Runtime and Memory Benchmarks
#'
#' Runtime and peak memory measurements for different persistence models and
#' simulated data sets. The data sets vary in their numbers of years,
#' teachers per year, and students per teacher. These are historical
#' measurements, not predictions for a current computer or package version.
#'
#' @format A data frame with 160 rows and nine variables:
#' \describe{
#'   \item{Persistence}{Persistence model and, where indicated, student side.}
#'   \item{Years}{Number of years.}
#'   \item{Students.per.Teacher}{Number of students per teacher.}
#'   \item{Teachers.per.Year}{Number of teachers per year.}
#'   \item{Total.Students}{Total student-year records, equal to
#'     \code{Years * Students.per.Teacher * Teachers.per.Year}; the original
#'     column name is retained.}
#'   \item{Total.Teachers}{Total number of teacher-year effects.}
#'   \item{Number.of.Random.Effects.in.Model}{Number of random effects.}
#'   \item{PEAK.MEMORY..MB.}{Peak memory usage in megabytes.}
#'   \item{RUNTIME..min.}{Runtime in minutes.}
#' }
#' @details All benchmarks used \code{hessian = TRUE}. Numerical Hessian
#' calculation accounted for 20\% to 75\% of the recorded runtimes.
#' Use \code{hessian = FALSE} when standard errors of covariance and persistence
#' parameters are not required. The G-side student model can have large memory
#' requirements as the numbers of students and teachers increase.
#' @examples
#' data(GPvam.benchmark)
#' head(GPvam.benchmark)
#' @keywords datasets
"GPvam.benchmark"

Try the GPvam package in your browser

Any scripts or data that you put into this service are public.

GPvam documentation built on Oct. 23, 2026, 1:06 a.m.