crtBayes: Bayesia analysis of cluster randomised trials Using vague priors.

Description

crtBayes performs analysis of cluster randomised trial using multilevel model within the Bayesian framework assuming vague priors.

Usage

1
crtBayes(formula, random, intervention, nSim, data)

Arguments

formula

specifies the model to be analysed. It is of the form form y ~ x1+x2 +..., where y is the outcome variable and X's are the predictors.

random

a string variable specifying the "clustering" variable as contained in the data. This must be put between quotes. For example, "school".

intervention

specifies the name of the intervention variable as appeared in formula. This must be put between quotes. For example "intervention" or "treatment" or "group"..

nSim

number of MCMC simulations to generate samples from full conditional posterior distributions. A minimum of 10,000 is recommended.

data

specifies data frame containing the data to be analysed.

Value

S3 mcpi 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
data(iwq)

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

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

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

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

## Covariance matrix
covParm <- output$covParm
covParm

### random effects for schools

randOut <- output$"SchEffects"
randOut <- randOut[order(randOut$Estimate),]
barplot(randOut$Estimate,ylab="Deviations from Overall Average",
		names.arg=randOut$Schools,las=2)



### Posterior probability given a fixed threshold
probES <- output$ProbES
str(probES )

			
plot(probES[,1] ,probES[,2],ylim=c(0,max(probES)),
		ylab="Probability",cex.lab=1,cex.axis=1,
		type="n", xlab=expression("Effect size" >= "x"),
		cex=1)
lines(probES[,1],probES[,2],col="chartreuse3",cex=1.5,
		lwd=1.5,lty=2)
lines(probES[,1],probES[,3],col="violetred",cex=1.5,
		lwd=1.5,lty=3)
lines(probES[,1],probES[,4],col="cornflowerblue",cex=1.5,
		lwd=1.5,lty=1)
points(probES[,1],probES[,2],col="chartreuse3",cex=1.5,
		lwd=1.5,pch=7)
points(probES[,1],probES[,3],col="violetred",cex=1.5,
		lwd=1.5,pch=1)
points(probES[,1],probES[,4],col="cornflowerblue",
		cex=1.5,lwd=1.5,pch=12)
legend(0,0.4,legend=c("Within ","Between ","Total "),
		lty=c(2,3,1),cex=1.5, pch=c(7,1,12),
		col=c("chartreuse3","violetred","cornflowerblue"),
		title="Variance Type")

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.