Learn R Programming

eefAnalytics (version 1.0.6)

mlmBayes: Bayesia multilevel analysis of randomised educatuon trials using vague priors.

Description

mlmBayes performs analysis of randomised eduation trials using multilevel model under Bayesian framework assuming vague priors.

Usage

mlmBayes(formula, random, intervention, nSim, data)

Arguments

formula
the model to be analysed. It is of the form y ~ x1+x2+.... Where y is the outcome variable and Xs are the predictors.
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 appeared in the formula. See example below
nSim
number of MCMC iterations. A minimum of 10,000 is recommended.
data
data frame containing the data to be analysed.

Value

S3 object; a list consisting of
  • Beta. Estimates and confidence intervals for preditors specified in the model.
  • ES. Hedges' g effect size for the intervention(s). If nBoot is not specified, the confidence intervals are 95
  • covParm. Vector of variance decomposition into between cluster variance (Schools) and within cluster variance (Pupils). It also contains the intral-cluster correlation (ICC).
  • SchEffects. Random intercepts for clusters, e.g schools.
  • ProbES. A maxtrix containing the probability of observing effect size greater than a pre-specified threshold.

Examples

Run this code
if(interactive()){
  
data(crtData)

########################################################
## Bayesian analysis of cluster randomised trials     ##
########################################################

output <- mlmBayes(Posttest~ Intervention+Prettest,random="School",
		intervention="Intervention",nSim=10000,data=crtData)

### Fixed effects
beta <- output$Beta
beta

### Effect size
ES1 <- output$ES
ES1

## Covariance matrix
covParm <- output$covParm
covParm

### plot random effects for schools

plot(output)

### plot posterior probability of an effect size to be bigger than a pre-specified threshold

plot(output,group=1)
}

Run the code above in your browser using DataLab