% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ild_missing_bias.R
\name{ild_missing_bias}
\alias{ild_missing_bias}
\title{Test whether missingness is associated with a predictor (informative missingness)}
\usage{
ild_missing_bias(x, outcome_var, predictor_var, random = FALSE)
}
\arguments{
\item{x}{An ILD object (see [is_ild()]).}

\item{outcome_var}{Character. Name of the variable with missingness (e.g. \code{"mood"}).}

\item{predictor_var}{Character. Name of the suspected predictor of missingness (e.g. \code{"stress"}).}

\item{random}{Logical. If \code{TRUE}, fit a mixed-effects logistic model
\code{is_missing ~ predictor + (1 | id)} via \code{lme4::glmer}; if \code{FALSE}
(default), fit \code{glm(is_missing ~ predictor, family = binomial)}.}
}
\value{
A list with \code{predictor} (name), \code{estimate}, \code{std_error},
  \code{p_value}, and \code{message} (short note about informative missingness).
}
\description{
Fits a logistic model of missingness (binary: is the outcome NA?) on a
predictor variable. Use as a diagnostic: if the predictor is significant,
missingness may be informative and results could be biased. This function
does not correct for missingness; it flags the assumption for sensitivity analyses.
}
\examples{
set.seed(1)
d <- ild_simulate(n_id = 20, n_obs_per = 10, seed = 1)
d$stress <- rnorm(nrow(d))
d$mood <- d$y
d$mood[sample(nrow(d), 30)] <- NA  # some missing
x <- ild_prepare(d, id = "id", time = "time")
ild_missing_bias(x, "mood", "stress")
}
