% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mixed_anova_slopes.R
\name{mixed_anova_slopes}
\alias{mixed_anova_slopes}
\title{ANOVA table from linear mixed effects analysis.}
\usage{
mixed_anova_slopes(
  data,
  Y_value,
  Fixed_Factor,
  Slopes_Factor,
  Random_Factor,
  Df_method = "Kenward-Roger",
  SS_method = "II",
  ...
)
}
\arguments{
\item{data}{a data table object, e.g. data.frame or tibble.}

\item{Y_value}{name of column containing quantitative (dependent) variable, provided within "quotes".}

\item{Fixed_Factor}{name(s) of categorical fixed factors (independent variables) provided as a vector if more than one or within "quotes".}

\item{Slopes_Factor}{name of factor to allow varying slopes on.}

\item{Random_Factor}{name(s) of random factors to allow random intercepts; to be provided as a vector when more than one or within "quotes".}

\item{Df_method}{method for calculating degrees of freedom. Default is Kenward-Roger, can be changed to "Satterthwaite".}

\item{SS_method}{type of sum of square, default is type II, can be changed to "I", "III", "1" or "2", or others.}

\item{...}{any additional arguments to pass on to \code{\link[lme4]{lmer}} if required.}
}
\value{
ANOVA table of class "anova" and "data.frame".
}
\description{
One of four related functions for mixed effects analyses (based on \code{\link[lme4]{lmer}} and \code{\link[lmerTest]{as_lmerModLmerTest}}) to get a linear model for downstream steps, or an ANOVA table.
\enumerate{
\item \code{mixed_model}
\item \code{mixed_anova}
\item \code{mixed_model_slopes}
\item \code{mixed_anova_slopes}.
}
}
\details{
These functions require a data table, one dependent variable (Y_value), one or more independent variables (Fixed_Factor), and at least one random factor (Random_Factor). These should match names of variables in the long-format data table exactly.

Outputs of \code{mixed_model} and \code{mixed_model_slopes} can be used for post-hoc comparisons with \code{\link{posthoc_Pairwise}}, \code{\link{posthoc_Levelwise}}, \code{\link{posthoc_vsRef}}, \code{\link{posthoc_Trends_Pairwise}}, \code{\link{posthoc_Trends_Levelwise}} and \code{\link{posthoc_Trends_vsRef}}or with \code{\link[emmeans]{emmeans}}.

More than one fixed factors can be provided as a vector (e.g. c("A", "B")). A full model with interaction term is fitted.
This means when \code{Y_value = Y, Fixed_factor = c("A", "B"), Random_factor = "R"} are entered as arguments, these are passed on as \code{Y ~ A*B + (1|R)} (which is equivalent to \code{Y ~ A + B + A:B + (1|R)}).

In \code{mixed_model_slopes} and \code{mixed_anova_slopes}, the following kind of formula is used: \code{Y ~ A*B + (S|R)} (which is equivalent to \code{Y ~ A + B + A:B + (S|R)}).
In this experimental implementation, random slopes and intercepts are fitted (\code{(Slopes_Factor|Random_Factor)}). Only one term each is allowed for \code{Slopes_Factor} and \code{Random_Factor}.
}
\examples{
mixed_anova_slopes(data = data_2w_Tdeath,
Y_value = "PI",
Fixed_Factor = c("Genotype", "Time"),
Slopes_Factor = "Time",
Random_Factor = "Experiment")

}
