% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/core-classes.R
\name{survey_twophase}
\alias{survey_twophase}
\title{Two-Phase Survey Design}
\usage{
survey_twophase(
  data = data.frame(),
  metadata = survey_metadata(),
  variables = list(),
  groups = character(0),
  call = NULL
)
}
\arguments{
\item{data}{A \code{data.frame} containing the survey data (all Phase 1 rows,
with a logical indicator for Phase 2 membership). Prefer
\code{\link[=as_survey_twophase]{as_survey_twophase()}} over calling this constructor directly.}

\item{metadata}{A \link{survey_metadata} object. Inherited from the Phase 1
design when using \code{\link[=as_survey_twophase]{as_survey_twophase()}}.}

\item{variables}{A named list of design specification (phase1, phase2,
subset, method). Set automatically by \code{\link[=as_survey_twophase]{as_survey_twophase()}}.}

\item{groups}{Set by surveytidy's \code{group_by()}. Always \code{character(0)} in
standalone surveycore use.}

\item{call}{Language object capturing the construction call.}
}
\value{
A \code{survey_twophase} object.
}
\description{
A survey design object for two-phase (double) sampling. Create with
\code{\link[=as_survey_twophase]{as_survey_twophase()}}.
}
\section{Design variables (\verb{@variables})}{

\describe{
\item{\code{phase1}}{Named list containing the Phase 1 design specification
(from a \code{survey_taylor} object's \verb{@variables}).}
\item{\code{phase2}}{Named list with optional Phase 2 design columns:
\code{ids}, \code{strata}, \code{probs}, \code{fpc} — each \code{NULL} or a character vector
of column names.}
\item{\code{subset}}{Character string naming the logical column that
indicates Phase 2 membership (\code{TRUE} = selected into Phase 2).}
\item{\code{method}}{\code{"full"}, \code{"approx"}, or \code{"simple"}.}
}
}

\examples{
# Prefer as_survey_twophase() over calling survey_twophase() directly
set.seed(1)
df <- data.frame(id = 1:100, y = rnorm(100), x = rnorm(100),
                 wt = runif(100, 1, 3),
                 in_phase2 = c(rep(TRUE, 40), rep(FALSE, 60)))
phase1 <- as_survey(df, weights = wt)
d <- as_survey_twophase(phase1, subset = in_phase2)
class(d)

}
\seealso{
\code{\link[=as_survey_twophase]{as_survey_twophase()}} to create a \code{survey_twophase} object.

Other constructors: 
\code{\link{as_survey}()},
\code{\link{as_survey_nonprob}()},
\code{\link{as_survey_replicate}()},
\code{\link{as_survey_twophase}()},
\code{\link{survey_data}()},
\code{\link{survey_glm}()},
\code{\link{survey_glm_fit}()},
\code{\link{survey_nonprob}()},
\code{\link{survey_replicate}()},
\code{\link{survey_taylor}()}
}
\concept{constructors}
