% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ild_person_model.R
\name{ild_person_model}
\alias{ild_person_model}
\title{Fit a model separately per person (N-of-1 / idiographic)}
\usage{
ild_person_model(formula, data, method = c("lm"), min_obs = 2L)
}
\arguments{
\item{formula}{A formula (e.g. \code{y ~ x}). Used for each person's \code{lm}.}

\item{data}{An ILD object (see [is_ild()]).}

\item{method}{Character. Currently only \code{"lm"} (default).}

\item{min_obs}{Integer. Minimum observations per person to fit (default 2).
Persons with fewer are omitted or get NA rows.}
}
\value{
A tibble with columns \code{.ild_id} (or the id column name from metadata),
  \code{term}, \code{estimate}, \code{std_error}, \code{p_value}, and optionally
  \code{sigma}, \code{n_obs}. One row per person per term (long format).
}
\description{
Splits the ILD by person and fits the same formula (e.g. \code{lm}) within each.
Returns a tibble of person-level estimates for teaching, N-of-1 analysis, or
inspecting heterogeneity. Use [ild_person_distribution()] to visualize the
distribution of estimates across persons.
}
\examples{
d <- ild_simulate(n_id = 5, n_obs_per = 8, seed = 1)
x <- ild_prepare(d, id = "id", time = "time")
pm <- ild_person_model(y ~ 1, x)
ild_person_distribution(pm, term = "(Intercept)")
}
