ga_anova | R Documentation |
gam
)One of two functions for fitting generalised additive models (gam
) with the mgcv
package. It will use the gam()
function in mgcv
for ANOVA designs with up to two categorical fixed factors (with two or more levels; Fixed_Factor
), and exactly one factor is a continuous variable (e.g. time), which is called Smooth_Factor
.
ga_model
ga_anova
ga_anova(
data,
Y_value,
Fixed_Factor,
Smooth_Factor,
Random_Factor = NULL,
Nodes = NULL,
...
)
data |
a data frame where categorical independent variables are converted to factors using |
Y_value |
name of column containing quantitative (dependent) variable, provided within "quotes". |
Fixed_Factor |
name(s) of categorical fixed factors (independent variables) provided as a vector if more than one or within "quotes". Convert to factors first with |
Smooth_Factor |
the continuous variable to fit smoothly with a basis function, provided within "quotes" (only 1 Smooth_Factor allowed). |
Random_Factor |
name(s) of random factors to be provided in "quotes" (only 1 Random_Factor allowed). Convert to factor with |
Nodes |
number of nodes (the parameter |
... |
any additional variables to pass on to |
A smooth function is fitted with factor-wise smooth basis function (by =
). A default value for number of nodes (the argument k
in gam
) may work, but a specific number can be provided using the Nodes
argument. The model is fit using the REML
method. When two categorical fixed factors are provided, an interaction term is included for main effects and smooth basis functions.
If a Random_Factor
is also provided, it is fitted using bs = "re"
smooth.
ANOVA table of class "anova" and "data.frame".
#with zooplankton data
ga_anova(data = data_zooplankton,
Y_value = "log(density_adj)",
Fixed_Factor = "taxon",
Smooth_Factor = "day")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.