% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/link_functions.R
\name{check_link}
\alias{check_link}
\title{Validate and resolve link function for a given family}
\usage{
check_link(family, link = NULL)
}
\arguments{
\item{family}{Character: canonical (\code{"binomial"}, \code{"normal"}, \code{"poisson"})
or alias (\code{"binary"}, \code{"count"}, \code{"rate"}, \code{"continuous"}).}

\item{link}{Character or \code{NULL}. If \code{NULL}, uses default for family.}
}
\value{
List with components:
\describe{
\item{family}{Canonical family name (e.g. \code{"binomial"})}
\item{link}{Resolved link name (e.g. \code{"probit"})}
\item{code}{Integer code for Stan data block}
}
}
\description{
Checks that \code{link} is valid for \code{family} and returns the resolved link name
plus an integer code for Stan. Accepts canonical family names (\code{"binomial"},
\code{"normal"}, \code{"poisson"}) and data-type aliases (\code{"binary"}, \code{"count"},
\code{"rate"}, \code{"continuous"}).
}
\details{
The V1 likelihood/link matrix is:

\tabular{llll}{
\strong{Data type} \tab \strong{Family} \tab \strong{Likelihoods} \tab \strong{Link functions} \cr
Binary  \tab binomial \tab bernoulli (IPD), binomial (AgD)  \tab logit, probit, cloglog \cr
Count*  \tab binomial \tab bernoulli (IPD), binomial (AgD)  \tab logit, probit, cloglog \cr
Rate    \tab poisson  \tab poisson                          \tab log                    \cr
Continuous \tab normal \tab normal                           \tab identity, log          \cr
}

*\code{"count"} refers to count/total (binomial denominator) data, not Poisson
event counts. For Poisson rate or count outcomes, use \code{"poisson"} or \code{"rate"}.
}
\keyword{internal}
