effect_alt.manyglm {ecopower} | R Documentation |
Specify multivariate effect sizes
Description
effect_alt
returns a coefficient matrix to be parsed to extend
, powersim
and equivtest
to specify an effect size of interest.
Usage
## S3 method for class 'manyglm'
effect_alt(object, effect_size, increasers, decreasers, term, K = NULL)
effect_alt(object, effect_size, increasers, decreasers, term, K = NULL)
Arguments
object |
objects of class |
effect_size |
An effect size of interest, see details for interpretation. |
increasers |
A vector list of responses which increase relative to the control group/intercept. |
decreasers |
A vector list of responses which decrease relative to the control group/intercept. |
term |
Name of predictor of interest in quotes. |
K |
A vector of length |
Details
effect_alt
helps users to create interpretable multivariate effect sizes to be parsed into extend
,
powersim
and equivtest
, so that researchers can investigate the relationship between effect size, power and
sample size in a complicated multivariate abundance setting.
effect_alt
creates an effect of size log(effect_size)
for a predictor of interest (term
), for responses
who have been specified to increase (increasers
) and -log(effect_size)
for responses who have been specified
to decrease (decreasers
). Responses that have not been specified in the increasers
or decreasers
vectors
are specified to have no effect with a coefficient of 0. The effect has been logged to make the effect size
interpretable within the coefficient matrix.
For poisson regression family=poisson()
and negative binomial regression family="negative.binomial"
the effect
size is interpreted for a categorical variable as the multiplicative change in mean abundance in the treatment
group relative to the control group, whilst for a continuous variable it is interpreted as the multiplicative
change in abundance for a 1 unit increase in the predictor of interest.
For logit regression family=binomial("logit")
the effect size is interpreted as an odds ratio. For a categorical
variable this is the change in odds of obtaining outcome 1
when being in the treatment group relative to the
control group. Whilst for continuous variables, this is interpreted as the change in odds of obtaining outcome 1
with a 1 unit increase in the predictor of interest.
For cloglog regression family=binomial("cloglog")
the effect size is interpreted similarly to poisson and
negative binomial regression. For a categorical variable it is interpreted as the multiplicative change in
the mean of the underlying count in the treatment group relative to the control. Whilst for a continuous
variable it is interpreted as the multiplicative change in the mean of the underlying count for a 1 unit
increase in the predictor of interest.
For categorical variables, the intercept is also changed to be the group mean intercept by taking the intercept of a model without the categorical predictor of interest. This is done to avoid messy comparisons of null control groups.
For categorical variables with more than two levels, effect size is changed to effect_size^K[i]
where K defaults
to be c(1,2,...,nlevels - 1)
, where nlevels
are the number of levels of the categorical variable and is
specified along the order of the levels. To change this, specify a vector K
with length of nlevels - 1
.
To change the control group, this must be done prior to specifying the manyglm
object
using relevel
(which can also change the order of the levels).
Note that if the predictor of interest is a categorical variable it must be classed either as a factor or character otherwise results may be misleading.
Value
A coefficient matrix with the specified effect size.
Functions
-
effect_alt()
: Specify multivariate effect sizes
See Also
Examples
library(mvabund)
data(spider)
spiddat = mvabund(spider$abund)
X = data.frame(spider$x)
# Specify increasers and decreasers
increasers = c("Alopacce", "Arctlute", "Arctperi", "Pardnigr", "Pardpull")
decreasers = c("Alopcune", "Alopfabr", "Zoraspin")
# Obtain an effect matrix of effect_size=3
spid.glm = manyglm(spiddat~soil.dry, family="negative.binomial", data=X)
effect_mat = effect_alt(spid.glm, effect_size=3,
increasers, decreasers, term="soil.dry")
# Obtain an effect matrix of effect_size=1.5
X$Treatment = rep(c("A","B","C","D"),each=7)
spid.glm = manyglm(spiddat~Treatment, family="negative.binomial", data=X)
effect_mat = effect_alt(spid.glm, effect_size=1.5,
increasers, decreasers, term="Treatment")
# Change effect size parameterisation
effect_mat = effect_alt(spid.glm, effect_size=1.5,
increasers, decreasers, term="Treatment",
K=c(3,1,2))