srtFREQ: Analysis of Simple Randomised Education Trial using Linear...

View source: R/srtFREQ.R

srtFREQR Documentation

Analysis of Simple Randomised Education Trial using Linear Regression Model.

Description

srtFREQ performs analysis of educational trials under the assumption of independent errors among pupils. This can also be used with schools as fixed effects.

Usage

srtFREQ(formula, intervention, baseln, nBoot, nPerm, ci, seed, data)

Arguments

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.

intervention

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

baseln

A string variable allowing the user to specify the reference category for intervention variable. When not specified, the first level will be used as a reference.

nBoot

number of bootstraps required to generate bootstrap confidence intervals.

nPerm

number of permutations required to generate permutated p-value.

ci

method for bootstrap confidence interval calculations; options are the Basic (Hall's) confidence interval "basic" or the simple percentile confidence interval "percentile". If not provided default will be percentile.

seed

seed required for bootstrapping and permutation procedure, if not provided default seed will be used.

data

data frame containing the data to be analysed.

Value

S3 object; a list consisting of

  • Beta: Estimates and confidence intervals for the variables specified in the model.

  • ES: Conditional Hedges'g effect size and its 95% confidence intervals. If nBoot is not specified, 95% confidence intervals are based on standard errors. If nBoot is specified, they are non-parametric bootstrapped confidence intervals.

  • sigma2: Residual variance.

  • Perm: A "nPerm x w" matrix containing permutated effect sizes using residual variance. "w" denotes number of intervention. "w=1" for two arm trial and "w=2" for three arm trial excluding the control group. It is produced only if nPerm is specified.

  • Bootstrap: A "nBoot x w" matrix containing the bootstrapped effect sizes using residual variance. "w" denotes number of intervention. "w=1" for two arm trial and "w=2" for three arm trial excluding the control group. It is produced only if nBoot is specified.

  • Unconditional: A list of unconditional effect size, sigma2, Perm and Bootstrap obtained based on variances from the unconditional model (model with only intercept as fixed effect).

Examples

if(interactive()){

data(mstData)

###################################################################
## Analysis of simple randomised trials using Hedges Effect Size ##
###################################################################

output1 <- srtFREQ(Posttest~ Intervention+Prettest,
		intervention="Intervention",data=mstData )
ES1 <- output1$ES
ES1

###################################################################
## Analysis of simple randomised trials using Hedges Effect Size ##
## with Permutation p-value                                      ##
###################################################################

output2 <- srtFREQ(Posttest~ Intervention+Prettest,
		intervention="Intervention",nPerm=1000,data=mstData )

ES2 <- output2$ES
ES2


#### plot permutated values

plot(output2, group=1)



###################################################################
## Analysis of simple randomised trials using Hedges Effect Size ##
## with non-parametric Basic bootstrap confidence intervals      ##
###################################################################

output3 <- srtFREQ(Posttest~ Intervention+Prettest,
		intervention="Intervention",nBoot=1000,ci="basic",data=mstData)

ES3 <- output3$ES
ES3

### plot bootstrapped values

plot(output3, group=1)

####################################################################
## Analysis of simple randomised trials using Hedges' effect size  ##
##  with schools as fixed effects                                  ##
####################################################################

output4 <- srtFREQ(Posttest~ Intervention+Prettest+as.factor(School),
		intervention="Intervention",data=mstData )

ES4 <- output4$ES
ES4

####################################################################
## Analysis of simple randomised trials using Hedges' effect size ##
## with schools as fixed effects and with permutation p-value     ##
####################################################################

output5 <- srtFREQ(Posttest~ Intervention+Prettest+as.factor(School),
		intervention="Intervention",nPerm=1000,data=mstData )

ES5 <- output5$ES
ES5

#### plot permutated values

plot(output5, group=1)

####################################################################
## Analysis of simple randomised trials using Hedges' effect size ##
## with schools as fixed effects and with permutation p-value      ##
####################################################################

output6 <- srtFREQ(Posttest~ Intervention+Prettest+as.factor(School),
		intervention="Intervention",nBoot=1000,data=mstData)

ES6 <- output6$ES
ES6

### plot bootstrapped values

plot(output6, group=1)
}

eefAnalytics documentation built on July 3, 2022, 1:05 a.m.