mlmBayes: Bayesia multilevel analysis of randomised educatuon trials...

Description Usage Arguments Value Examples

View source: R/eefAnalytics_03_2017.r

Description

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

Usage

1
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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
}

eefAnalytics documentation built on May 31, 2017, 4:17 a.m.