% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/m2dt_utils.R
\name{get_analysis_data}
\alias{get_analysis_data}
\title{Restrict data to the observations used in model fitting}
\usage{
get_analysis_data(model, model_class, data)
}
\arguments{
\item{model}{Fitted model object.}

\item{model_class}{Character string of the model class.}

\item{data}{Data frame or data.table supplied to the model call.}
}
\value{
Data.table restricted to the observations used in fitting. The input
  is returned unchanged when the analysis rows cannot be determined.
}
\description{
Group-level sample sizes must be counted over the observations that entered
the model, not over every row supplied by the user. Several fitted objects
carry no model frame from which those observations can be read directly:
\code{survival::coxph()} does not store one by default, \pkg{coxme} models
never store one, and the memory-conserving fits performed internally by
\code{uniscreen()} and \code{multifit()} pass \code{model = FALSE}. In these
cases the supplied data still contains the observations dropped during
fitting, and counting them inflates group sizes whenever the response or a
covariate is missing.
}
\keyword{internal}
