Analysis of Cluster Randomised Trials using MLM.

Share:

Description

crtFREQ is a frequentist method that can be used to calculate effect size from cluster randomised trials based on residual variance or total variance. .

Usage

1
crtFREQ(formula, random, intervention, nPerm = NULL, nBoot = NULL, 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"..

nPerm

number of permutations required to generate permutation p-value. Default is NULL.

nBoot

number of bootstrap required to generate bootstrap confidence interval. Default is NULL.

data

the data frame to be analysed.

Value

S3 object; a list consisting of

  • Beta. Estimates and confidence intervals for the predictors specified in the model. It will be the slope for a continuous predictor and the mean difference for a dummy variable or a categorical predictor.

  • ES. Hedges' effect size for the intervention effect. If nBoot is not specified, the confidence intervals are 95 they are non-parametric bootstrapped confidence intervals.

  • covParm. A vector of variance decomposition into between-variance (Schools), within-variance (Pupils) and total variance. It also contains the intra-cluster correlation (ICC).

  • SchEffects. Individual school effects at baseline.

  • Perm. A matrix of the distribution of ES under the null hypothesis. The two columns in the matrix represents ES based on within variance and total variance. Produced only if nPerm is specified.

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
data(iwq)

########################################################
## MLM analysis of cluster randomised trials + 1.96SE ##
########################################################

output1 <- crtFREQ(Posttest~ Intervention+Prettest,random="School",
		intervention="Intervention",data=iwq)


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

### Effect size
ES1 <- output1$ES$Intervention1
ES1

## Covariance matrix
covParm <- output1$covParm
covParm

### random effects for schools

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

###############################################
## MLM analysis of cluster randomised trials ##	 
## with bootstrap confidence intervals       ##
###############################################

output2 <- crtFREQ(Posttest~ Intervention+Prettest,random="School",
		intervention="Intervention",nBoot=1000,data=iwq)


### Effect size

ES2 <- output2$ES
ES2


#######################################################################
## MLM analysis of cluster randomised trials with permutation p-value##
#######################################################################

output3 <- crtFREQ(Posttest~ Intervention+Prettest,random="School",
		intervention="Intervention",nPerm=1000,data=iwq)


#### Distribution under the null

perm <- output3$Perm


#### Permutation P-value using total variance


obsg <- output3$ES$Intervention1[2,1]

p_value <- ifelse(mean(perm$"InterventionTotal" > obsg)==0,"<0.001",
		mean(perm$"InterventionTotal" > obsg) )
p_value

hist(perm$"InterventionTotal", breaks=40, col="white", border="blueviolet",
		xlab="Distribution Under Null Hypothesis", 
		main=paste("P(X|NULL)= ",p_value,sep=""), 
		xlim=range(c(perm$"InterventionTotal",obsg), na.rm=TRUE))
abline(v=obsg,lwd=2,col=4)