View source: R/BANOVA.Poisson.R
| BANOVA.Poisson | R Documentation | 
BANOVA.Poisson implements a Hierarchical Bayesian ANOVA for models with a count-data response variable and normal heterogeneity distribution.
BANOVA.Poisson(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 class 'BANOVA.Poisson'
summary(object, ...)
## S3 method for class 'BANOVA.Poisson'
predict(object, newdata = NULL,...)
## S3 method for class 'BANOVA.Poisson'
print(x, ...)
| l1_formula | formula for level 1 e.g. 'Y~X1+X2' | 
| l2_formula | formula for level 2 e.g. '~Z1+Z2', response variable must not be included, if missing, the single level model will be generated | 
| data | a data.frame in long format including all features in level 1 and level 2(covariates and categorical factors) and responses | 
| id | subject ID of each response unit | 
| l2_hyper | level 2 hyperparameters, c(a, b, γ), default c(1,1,0.0001) | 
| burnin | the number of burn in draws in the MCMC algorithm, default 5000 | 
| sample | target samples in the MCMC algorithm after thinning, default 2000 | 
| thin | the number of samples in the MCMC algorithm that needs to be thinned, default 10 | 
| adapt | the number of adaptive iterations, default 0 (see run.jags) | 
| conv_speedup | whether to speedup convergence, default F | 
| jags | the system call or path for activating 'JAGS'. Default calls findjags() to attempt to locate 'JAGS' on your system | 
| object | object of class  | 
| newdata | test data, either a matrix, vector or a data frame. It must have the same format with the original data (the same column number) | 
| x | object of class  | 
| ... | additional arguments,currently ignored | 
Level 1 model: 
y_i ~ Poisson(λ_i), λ_i = exp(η_i + ε_i) 
where η_i = ∑_{p = 0}^{P}∑_{j=1}^{J_p}X_{i,j}^pβ_{j,s_i}^p, s_i is the subject id of response i, see BANOVA-package. ε_i is a dispersion term.
BANOVA.Poisson returns an object of class "BANOVA.Poisson". The returned object is a list containing:
| anova.table | table of effect sizes  | 
| coef.tables | table of estimated coefficients | 
| pvalue.table | table of p-values  | 
| dMatrice | design matrices at level 1 and level 2 | 
| samples_l2_param | posterior samples of level 2 parameters | 
| samples_l2_sigma_param | posterior samples of level 2 standard deviations | 
| data | original data.frame | 
| mf1 | model.frame of level 1 | 
| mf2 | model.frame of level 2 | 
| JAGSmodel | 'JAGS' model | 
# use the bpndata dataset data(bpndata) # within-subjects model using the dependent variable : PIC_FIX res1 <- BANOVA.Poisson(PIC_FIX ~ AD_ID + PIC_SIZE+ PAGE_NUM + PAGE_POS, ~1, bpndata, bpndata$RESPONDENT_ID, burnin = 500, sample = 200, thin = 5) summary(res1) # use the goalstudy dataset data(goalstudy) goalstudy$bid <- as.integer(goalstudy$bid + 0.5) res2<-BANOVA.Poisson(bid~1, ~progress*prodvar, goalstudy, goalstudy$id, burnin = 5000, sample = 2000, thin = 10) summary(res2) # or use the BANOVA.run based on 'Stan' require(rstan) res3 <- BANOVA.run(bid~progress*prodvar, data = goalstudy, model_name = 'Poisson', id = 'id', iter = 100, thin = 1, chains = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.