% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/core-constructors.R
\name{as_survey_nonprob}
\alias{as_survey_nonprob}
\title{Create a Calibrated / Non-Probability Survey Design}
\usage{
as_survey_nonprob(data, weights, calibration = NULL)
}
\arguments{
\item{data}{A \code{data.frame} containing the survey responses with
pre-computed calibration weights. Must have at least one row and
unique column names.}

\item{weights}{<\code{\link[tidyselect:language]{tidy-select}}> Calibration weight
column (a single column, values strictly > 0). Typically produced by
an external raking function (e.g., \code{anesrake::anesrake()}) or a
\pkg{surveywts} calibration function.}

\item{calibration}{Optional. The calibration provenance object returned by
a \pkg{surveywts} calibration function (e.g., \code{surveywts::rake()}).
Stored in \verb{@calibration} for reproducibility. Supply \code{NULL} (the default)
when calibration was performed externally and provenance metadata is not
available. The object's structure is defined by \pkg{surveywts} and will
be formally specified in Phase 2.5.}
}
\value{
A \code{survey_nonprob} object.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
}
\details{
Creates a survey design object for non-probability samples and post-hoc
calibrated designs (e.g., raked online panels, post-stratified samples).
Accepts pre-computed calibration weights and optionally stores calibration
provenance from \pkg{surveywts} output for reproducibility.
}
\section{Phase 2.5 skeleton}{

This constructor is a \strong{skeleton}. The resulting \code{survey_nonprob} object
supports estimation via a model-assisted SRS variance assumption — the same
as calling \code{\link[=as_survey]{as_survey()}} with weights only. Full bootstrap re-calibration
variance (which re-applies the raking procedure on each replicate) will be
implemented in Phase 2.5 alongside the \pkg{surveywts} package.
}

\section{When to use}{

Use \code{as_survey_nonprob()} instead of \code{\link[=as_survey]{as_survey()}} when:
\itemize{
\item Your data comes from a non-probability sample (online panel, quota
sample, MTurk/Prolific, etc.)
\item You have calibration or raking weights but no probability sampling
design structure (no PSU IDs, strata, etc.)
\item You want to explicitly record the provenance of your calibration
weights for reproducibility
}

If your data comes from a probability sample with known design structure,
use \code{\link[=as_survey]{as_survey()}}, \code{\link[=as_survey_replicate]{as_survey_replicate()}}, or \code{\link[=as_survey_twophase]{as_survey_twophase()}}
instead.
}

\section{Variance estimation note}{

Standard errors from a \code{survey_nonprob} object assume simple random
sampling within the calibrated weights. This is consistent with common
applied practice for raked non-probability samples, but is technically
a model-assisted approximation rather than design-based variance. See
\code{vignette("creating-survey-objects")} for details and limitations.
}

\examples{
# Minimal: pre-computed calibration weights from an external tool
df <- data.frame(
  y      = rnorm(200),
  age    = sample(c("18-34", "35-54", "55+"), 200, replace = TRUE),
  cal_wt = runif(200, 0.5, 2.5)
)
d <- as_survey_nonprob(df, weights = cal_wt)

}
\seealso{
\code{\link[=as_survey]{as_survey()}} for probability designs with Taylor variance,
\code{\link[=as_survey_replicate]{as_survey_replicate()}} for replicate-weight designs

Other constructors: 
\code{\link{as_survey}()},
\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}()},
\code{\link{survey_twophase}()}
}
\concept{constructors}
