BANOVA.Bernoulli
implements a Bayesian ANOVA for binary dependent variable, using a logit link and a normal heterogeneity distribution.
BANOVA.Bernoulli(l1_formula = "NA", l2_formula = "NA", data,
id, l2_hyper = c(1, 1, 0.0001), burnin = 5000, sample = 2000, thin = 10,
adapt = 0, conv_speedup = F, jags = runjags.getOption('jagspath'))# S3 method for BANOVA.Bernoulli
summary(object, ...)
# S3 method for BANOVA.Bernoulli
predict(object, newdata = NULL,...)
# S3 method for BANOVA.Bernoulli
print(x, ...)
formula for level 1 e.g. 'Y~X1+X2'
formula for level 2 e.g. '~Z1+Z2', response variable must not be included
a data.frame in long format including all features in level 1 and level 2(covariates and categorical factors) and responses
subject ID of each response unit
level 2 hyperparameters, c(a, b, \(\gamma\)), default c(1,1,0.0001)
the number of burn in draws in the MCMC algorithm, default 5000
target samples in the MCMC algorithm after thinning, default 2000
the number of samples in the MCMC algorithm that needs to be thinned, default 10
the number of adaptive iterations, default 0 (see run.jags)
whether to speedup convergence, default F
the system call or path for activating 'JAGS'. Default calls findjags() to attempt to locate 'JAGS' on your system
object of class BANOVA.Bern
(returned by BANOVA.Bern
)
test data, either a matrix, vector or a data.frame. It must have the same format with the original data (the same number of features and the same data classes)
object of class BANOVA.Bern
(returned by BANOVA.Bern
)
additional arguments,currently ignored
BANOVA.Bernoulli
returns an object of class "BANOVA.Bernoulli"
. The returned object is a list containing:
table of effect sizes BAnova
table of estimated coefficients
table of p-values table.pvalues
design matrices at level 1 and level 2
posterior samples of level 2 parameters
original data.frame
model.frame of level 1
model.frame of level 2
'JAGS' model
Level 1 model:
\(y_i\) ~ \(Binomial(1,p_i)\), \(p_i = logit^{-1}(\eta_i)\)
where \(\eta_i = \sum_{p = 0}^{P}\sum_{j=1}^{J_p}X_{i,j}^p\beta_{j,s_i}^p\), \(s_i\) is the subject id of data record \(i\). see BANOVA-package
# NOT RUN {
data(bernlogtime)
# model with the dependent variable : response
res <- BANOVA.Bernoulli(response~typical, ~blur + color, bernlogtime,
bernlogtime$subject, burnin = 5000, sample = 2000, thin = 10)
summary(res)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab