% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fitLMMs.R
\name{fitLMMs}
\alias{fitLMMs}
\title{Fit linear (mixed) models for all probabilistic indices (PIs) and all genes}
\usage{
fitLMMs(
  obj,
  pis = obj$pis,
  fixedVars = NULL,
  randomVars = NULL,
  verbose = TRUE,
  returnModels = FALSE,
  Formula = NULL,
  randomNested = TRUE,
  features = getFeatures(obj),
  moranFormula = NULL,
  addMoransI = FALSE,
  numNNs = 10,
  ...
)
}
\arguments{
\item{obj}{The result object}

\item{pis}{Optional, the pis required. Defaults to all pis in the object}

\item{fixedVars}{Names of fixed effects}

\item{randomVars}{Names of random variables, possibly in a single vector to
reflect nesting structure, see details.}

\item{verbose}{A boolean, should the formula be printed?}

\item{returnModels}{a boolean: should the full models be returned?
Otherwise only summary statistics are returned}

\item{Formula}{A formula; if not supplied it will be constructed
from the fixed and random variables}

\item{randomNested}{A boolean, indicating if random effects are nested within
point patterns. See details.}

\item{features}{The features for which to fit linear mixed models.
Defaults to all features in the object}

\item{moranFormula}{Formula for Moran's I model fitting}

\item{addMoransI}{A boolean, include Moran's I of the cell-wise PIs in the calculation}

\item{numNNs}{An integer, the number of nearest neighbours in the
weight matrix for the calculation of the Moran's I statistic}

\item{...}{Passed onto fitLMMsSingle}
}
\value{
A list of fitted objects
}
\description{
The PI is used as outcome variable in a linear (mixed) model,
with design variables as regressors. Separate models are fitted for every combination of gene
and PI.
}
\details{
Genes or gene pairs with insufficient observations will be silently
omitted. When randomVars is provided as a vector, independent random
intercepts are fitted for them by default. Providing them separated by '\' or
':' as in the lmer formulas is also allowed to reflect nesting structure.

It is by default assumed that random effects are nested within the point
 patterns. This means for instance that cells with the same name but from
 different point patterns are assigned to different random effects. Set
 'randomNested' to FALSE to override this behaviour.

 The weights for the Moran's I statistic are inversely proportional to the distance between cell centroids.
}
\examples{
example(addWeightFunction, "smoppix")
lmmModels <- fitLMMs(yangObj, fixedVars = "day", randomVars = "root")
}
