% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/estGradients.R
\name{estGradients}
\alias{estGradients}
\title{Estimate gradients over multiple single-molecule point patterns}
\usage{
estGradients(
  hypFrame,
  gradients = c("overall", if (!is.null(hypFrame$owins)) "cell"),
  fixedEffects = NULL,
  randomEffects = NULL,
  verbose = FALSE,
  features = getFeatures(hypFrame),
  silent = TRUE,
  loopFun = "bplapply",
  ...
)
}
\arguments{
\item{hypFrame}{A hyperframe}

\item{gradients}{The gradients indices to be estimated}

\item{fixedEffects, randomEffects}{Character vectors of fixed and random effects present in the hyperframe,
modifying the baseline intensity. See details.}

\item{verbose}{A boolean, whether to report on progress of the fitting process.}

\item{features}{A character vector, for which features should the
gradients indices be calculated?}

\item{silent}{A boolean, should error messages from spatstat.model::mppm be printed?}

\item{loopFun}{The function to use to loop over the features.}

\item{...}{additional arguments, passed on to \link{fitGradient}.}
}
\value{
A list with the estimated gradients
}
\description{
Estimate gradients on all point patterns of a hyperframe,
}
\details{
The test for existence of a gradient revolves around interaction terms
between x and y coordinates and image identifiers. If this interactions are
significant, this implies existence of gradients in the different point patterns,
albeit with different directions. Yet be aware that a gradient that is significant
for a computer may look very different from the human perspective; many
spatial patterns can be captured by a gradient to some extent.
Baseline intensity corrections for every image or cell are included by default.
The fixed and random effects modify the baseline intensity of the point pattern, not the gradient!
Random effects can lead to problems with fitting and are dissuaded.
}
\note{
Fitting Poisson point processes is computation-intensive.
}
\examples{
# Overall Gradients
data(Yang)
hypYang <- buildHyperFrame(Yang,
    coordVars = c("x", "y"),
    imageVars = c("day", "root", "section")
)
yangGrads <- estGradients(hypYang[seq_len(10), ],
    features =
        getFeatures(hypYang)[seq_len(2)],
    fixedEffects = "day", randomEffects = "root"
)
# Gradients within cell
data(Eng)
hypEng <- buildHyperFrame(Eng,
    coordVars = c("x", "y"),
    imageVars = c("fov", "experiment")
)
hypEng <- addCell(hypEng, EngRois, verbose = FALSE)
# Limit number of cells for computational reasons
engGrads <- estGradients(hypEng[seq_len(2), ],
    features =
        feat <- getFeatures(hypEng)[seq_len(2)]
)
}
\seealso{
\link{fitGradient}, \link{estGradientsSingle}
}
