% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_setup.R
\name{set_ipd}
\alias{set_ipd}
\title{Set up individual patient data (IPD)}
\usage{
set_ipd(
  data,
  treatment,
  outcome,
  covariates,
  family = c("binomial", "normal", "poisson"),
  exposure = NULL,
  study = NULL
)
}
\arguments{
\item{data}{Data frame containing IPD}

\item{treatment}{Column name for treatment variable}

\item{outcome}{Column name for outcome variable. For \code{family = "binomial"},
must be binary (0/1). For \code{family = "normal"}, any numeric. For
\code{family = "poisson"}, non-negative integer counts.}

\item{covariates}{Character vector of covariate column names}

\item{family}{Outcome family: \code{"binomial"}, \code{"normal"}, or \code{"poisson"}}

\item{exposure}{Column name for exposure/time-at-risk (required when
\code{family = "poisson"})}

\item{study}{Column name for study identifier (optional)}
}
\value{
An object of class \code{mlumr_ipd}
}
\description{
Prepare IPD from the index treatment for an unanchored indirect comparison.
}
\examples{
\dontrun{
# Binary outcome
ipd <- set_ipd(
  data = trial_a,
  treatment = "trt",
  outcome = "response",
  covariates = c("age", "sex")
)

# Continuous outcome
ipd <- set_ipd(
  data = trial_a,
  treatment = "trt",
  outcome = "score",
  covariates = c("age", "sex"),
  family = "normal"
)

# Count outcome with exposure
ipd <- set_ipd(
  data = trial_a,
  treatment = "trt",
  outcome = "events",
  covariates = c("age", "sex"),
  family = "poisson",
  exposure = "person_years"
)
}
}
