GainIndex: Calculate the Gain Index (GI) using JAGS

View source: R/GI.R

GainIndexR Documentation

Calculate the Gain Index (GI) using JAGS

Description

This function computes the Gain Index and other related statistics for educational trials. Gain index provides a proportion of pupils who would not have make good progress without intervention. This function supports flexible configurations for JAGS modeling.

Usage

GainIndex(
  data,
  formula,
  random,
  intervention,
  NA.omit = TRUE,
  n.iter = 20000,
  n.chains = 3,
  n.burnin = 10000,
  inits = NULL,
  model.file = NULL,
  alpha = 0.05
)

Arguments

data

A list containing the data for the JAGS model which must include columns: School, Posttest, Pretest, Intervention. Data should not have any missing values in these columns.

formula

the model to be analysed is of the form y ~ x1+x2+.... Where y is the outcome variable and Xs are the independent variables. Formula does not need to include Intervention variable.

random

a string variable specifying the "clustering variable" as contained in the data. See example below.

intervention

a string variable specifying the "intervention variable" as appearing in the formula and the data. See example below.

NA.omit

Optional; a logic to check if omitting missing value. If NA.omit = TRUE, results will output the percentage of missing value in the four required columns and then JAGS results. If NA.omit = FALSE, will give a warning "Please handle missing values before using GainIndex()." If not provided, the function uses default TRUE.

n.iter

Total number of iterations for the MCMC simulation.

n.chains

Number of chains to run in the MCMC simulation.

n.burnin

Number of burn-in iterations to be discarded before analysis.

inits

Optional; a list of initial values for the JAGS model. If NULL, the function generates default initial values.

model.file

Optional; a custom path to the JAGS model file. If not provided, the function uses default path.

alpha

significant level, default alpha = 0.05.

Value

An S3 object containing the following components:

GI

A data frame containing the Gain Index and its 95% confidence intervals, as well as the Progress Index and its 95% confidence intervals.

Proportions

A data frame showing the proportion of participants achieving each level of gain (low and high) for both control and intervention groups.

Timing

A vector with execution time details, including user and elapsed time in seconds.

Examples

######### EXAMPLE ONE: crtData #########
## Not run: 
  data(crtData)
  output1 <- GainIndex(data = crtData, formula = Posttest~Prettest, random = "School",n.iter = 200,
                       intervention = "Intervention", NA.omit = T, alpha = 0.05)
  output1


  ########## EXAMPLE TWO: mstData ######
  data(mstData)
  output1 <- GainIndex(data = mstData, formula = Posttest~Prettest, random = "School",n.iter = 200,
                       intervention = "Intervention", NA.omit = T, alpha = 0.05)
  output1

## End(Not run)

eefAnalytics documentation built on Oct. 8, 2024, 5:09 p.m.