Description Usage Arguments Value Examples
View source: R/eefAnalytics_14_09_2020.R
crtBayes
performs analysis of randomised eduation trials using multilevel model under Bayesian framework
assuming vague priors.
1 2 3 4 5 6 7 8 9 10 |
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 |
adaptD |
As this function uses stan, this term means the target average proposal acceptance probability during Stan’s adaptation period. Default is NULL. |
nsim |
number of MCMC iterations per chain. Default is 2000. |
data |
data frame containing the data to be analysed. |
threshold |
a vector of pre-specified threshold(s) to be compared with effect size. |
... |
additional arguments of stan_lmer to be passed to the function. |
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) with its(their) credible intervals are 95
covParm
. Vector of variance decomposition into between cluster variance (Schools) and within cluster variance (Pupils). It also contains the intra-cluster correlation (ICC).
SchEffects
. Random intercepts for clusters, e.g schools.
ProbES
. A matrix containing the probability of observing effect size greater than a pre-specified threshold.
Unconditional
. A list of ES, covParm and ProbES obtained based on between and within cluster variances from the unconditional model (model without covariate).
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 <- crtBayes(Posttest~ Intervention+Prettest,random="School",
intervention="Intervention",nsim=2000,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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.