% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/environment-confounds-and-ipfm.R
\name{regress_gazepoint_pupil_luminance}
\alias{regress_gazepoint_pupil_luminance}
\title{Regress stimulus luminance from pupil diameter}
\usage{
regress_gazepoint_pupil_luminance(
  dat,
  pupil_col,
  luminance_col,
  group_cols = NULL,
  time_col = NULL,
  output_col = "pupil_luminance_adjusted",
  fitted_col = "pupil_luminance_fitted",
  include_quadratic = TRUE,
  model_by_group = TRUE,
  add_intercept_mean = TRUE
)
}
\arguments{
\item{dat}{A data frame.}

\item{pupil_col}{Numeric pupil column.}

\item{luminance_col}{Numeric luminance/brightness column.}

\item{group_cols}{Optional grouping columns.}

\item{time_col}{Optional time column.}

\item{output_col}{Output luminance-adjusted pupil column.}

\item{fitted_col}{Output fitted luminance component column.}

\item{include_quadratic}{Logical. If \code{TRUE}, include luminance squared.}

\item{model_by_group}{Logical. If \code{TRUE}, fit models per group.}

\item{add_intercept_mean}{Logical. If \code{TRUE}, add mean pupil size back to
residuals.}
}
\value{
A data frame with luminance-adjusted pupil columns and attributes.
}
\description{
Regresses continuous pupil diameter on frame-wise or sample-wise stimulus
luminance and returns a luminance-adjusted pupil series. This controls a
major visual confound but does not prove that residual pupil changes are
cognitive-load-only effects.
}
