Learn R Programming

ltable (version 2.0.2)

MCPower: Function MCPower

Description

Performs power analyses for constructed tabulated data based on based on Gibbs sampler with NB2 posterior marginal distribution for counts

Usage

MCPower(formula, data, contrasts=NULL, XLB=-100, XUB=100, a=0.1, b=0.1,
scale_min=1, scale_max=5, effect, p_alpha=0.05, draw=10000, burnin=3000)

Value

returns object of S4 class PowerClass

Arguments

formula

a symbolic description of the model to be fit.

data

name of the data set; object of data.frame class

contrasts

serves to choose types of contrasts to study effects of factors, same with glm{stats}), orthogonal polynomials by default

XLB

the vector of smallest possible values of regression effects betas; can be number if pertains to all betas.

XUB

the vector of largest possible values of regression effects betas; can be number if pertains to all betas.

a

the value of shape parameter of gamma distributed inverce dispersion parameter (phi), i.e., phi~Ga(a,b), so that mean(phi)=a/b and var(phi)=a/b^2

b

the value of rate (1/scale) parameter of gamma distributed inverce dispersion parameter (phi), i.e., phi~Ga(a,b), so that mean(phi)=a/b and var(phi)=a/b^2

scale_min

the smallest number of sample size scale range, 1 signifies the given data sample size (observed total counts).

scale_max

the max number of sample size considered in power analysis. 5 by default means 5 times augmented observed counts

effect

quoted effect tested by hypothesis; it should be one from the model formula, of second or higher order, introduced by * delimiter, i.e., "y*x", "y1*y2*x1*x2", etc.

p_alpha

serves to signify Z to check simulated z-scores against in power analysis, 0.05 by default

draw

indicates requested number of samples

burnin

indicates requested number of initial samples to discard

Author

Ocheredko Oleksandr Ocheredko@yahoo.com

Details

  • Performs power analysis in a given range of sample sizes (scale_min - scale_max).

  • Creates object of S4 class PowerClass with accessing methods

See Also

glm MCMCglmm

Examples

Run this code
require(ltable)
data(tdata, package="ltable")
## For better illustration You should increase draw and burnin pars
pres1<-MCPower(Counts~smoker +contraceptive +tromb +contraceptive*tromb,
scale_min=0.5, scale_max=1.5, effect="contraceptive*tromb", data=tdata, 
draw=1000, burnin=300)
print(pres1, "model")
print(pres1)
plot(pres1, stencil=3)

Run the code above in your browser using DataLab