diff --git a/R/estimators.R b/R/estimators.R index 8d2e062..50d0642 100644 --- a/R/estimators.R +++ b/R/estimators.R @@ -8,7 +8,7 @@ #' of a \code{\link{Statistic}} for a given dataset. #' #' The function \code{\link{evaluate_estimator}} can be used to evaluate -#' \link[EstimatorScore]{distributional quantities} of an \code{\link{Estimator}} +#' \link[adestr:EstimatorScore]{distributional quantities} of an \code{\link{Estimator}} #' like the \code{\link{MSE}} for a \code{\link{PointEstimator}} or the #' \code{\link{Coverage}} for a \code{\link{ConfidenceInterval}}. #' diff --git a/R/evaluate_estimator.R b/R/evaluate_estimator.R index 7e6e086..fcf2afd 100644 --- a/R/evaluate_estimator.R +++ b/R/evaluate_estimator.R @@ -70,7 +70,11 @@ setGeneric("evaluate_estimator", function(score, early_efficacy_part = TRUE, conditional_integral = FALSE) standardGeneric("evaluate_estimator")) -#' @rdname evaluate_estimator +#' @inherit evaluate_estimator +#' @name evaluate_estimator-methods +NULL + +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("PointEstimatorScore", "IntervalEstimator"), function(score, estimator, @@ -90,7 +94,7 @@ setMethod("evaluate_estimator", signature("PointEstimatorScore", "IntervalEstima conditional_integral) { stop("Cannot evaluate PointEstimatorScore on IntervalEstimator.") }) -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("IntervalEstimatorScore", "PointEstimator"), function(score, estimator, @@ -110,7 +114,7 @@ setMethod("evaluate_estimator", signature("IntervalEstimatorScore", "PointEstima conditional_integral) { stop("Cannot evaluate IntervalEstimatorScore on PointEstimator.") }) -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("list", "Estimator"), function(score, estimator, @@ -285,7 +289,7 @@ setClass("Expectation", contains = "PointEstimatorScore") #' @rdname EstimatorScore-class #' @export Expectation <- function() new("Expectation", label = "Expectation") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("Expectation", "PointEstimator"), function(score, estimator, @@ -335,7 +339,7 @@ setClass("Bias", contains = "PointEstimatorScore") #' @rdname EstimatorScore-class #' @export Bias <- function() new("Bias", label = "Bias") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("Bias", "PointEstimator"), function(score, estimator, @@ -380,7 +384,7 @@ setClass("Variance", contains = "PointEstimatorScore") #' @rdname EstimatorScore-class #' @export Variance <- function() new("Variance", label = "Variance") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("Variance", "PointEstimator"), function(score, estimator, @@ -448,7 +452,7 @@ setClass("MSE", contains = "PointEstimatorScore") #' @rdname EstimatorScore-class #' @export MSE <- function() new("MSE", label = "MSE") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("MSE", "PointEstimator"), function(score, estimator, @@ -529,7 +533,7 @@ setClass("OverestimationProbability", contains = "PointEstimatorScore") #' @rdname EstimatorScore-class #' @export OverestimationProbability <- function() new("OverestimationProbability", label = "Probability of overestimation") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("OverestimationProbability", "PointEstimator"), function(score, estimator, @@ -577,7 +581,7 @@ setClass("Coverage", contains = "IntervalEstimatorScore") #' @rdname EstimatorScore-class #' @export Coverage <- function() new("Coverage", label = "Coverage") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("Coverage", "IntervalEstimator"), function(score, estimator, @@ -628,7 +632,7 @@ setClass("SoftCoverage", contains = "IntervalEstimatorScore", slots = c(shrinkag #' @param shrinkage shrinkage factor for bump function. #' @export SoftCoverage <- function(shrinkage = 1) new("SoftCoverage", shrinkage = shrinkage, label = "Coverage") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("SoftCoverage", "IntervalEstimator"), function(score, estimator, @@ -685,7 +689,7 @@ setClass("Width", contains = "IntervalEstimatorScore") #' @rdname EstimatorScore-class #' @export Width <- function() new("Width", label = "Width") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("Width", "IntervalEstimator"), function(score, estimator, @@ -735,7 +739,7 @@ setClass("TestAgreement", contains = "IntervalEstimatorScore") #' @rdname EstimatorScore-class #' @export TestAgreement <- function() new("TestAgreement", label = "Agreement with test decision") -#' @rdname evaluate_estimator +#' @rdname evaluate_estimator-methods setMethod("evaluate_estimator", signature("TestAgreement", "IntervalEstimator"), function(score, estimator, diff --git a/man/EstimatorScore-class.Rd b/man/EstimatorScore-class.Rd index 28e390d..ed1551a 100644 --- a/man/EstimatorScore-class.Rd +++ b/man/EstimatorScore-class.Rd @@ -40,7 +40,7 @@ TestAgreement() an \code{EstimatorScore} object. } \description{ -These functions encode various metrics which can be used to evaluate +These classes encode various metrics which can be used to evaluate the performance characteristics of point and interval estimators. } \section{Slots}{ diff --git a/man/Statistic-class.Rd b/man/Statistic-class.Rd index 69d5c7c..fe7ed16 100644 --- a/man/Statistic-class.Rd +++ b/man/Statistic-class.Rd @@ -20,7 +20,7 @@ The function \code{\link{analyze}} can be used to calculate the value of a \code{\link{Statistic}} for a given dataset. The function \code{\link{evaluate_estimator}} can be used to evaluate -\link[EstimatorScore]{distributional quantities} of an \code{\link{Estimator}} +\link[adestr:EstimatorScore]{distributional quantities} of an \code{\link{Estimator}} like the \code{\link{MSE}} for a \code{\link{PointEstimator}} or the \code{\link{Coverage}} for a \code{\link{ConfidenceInterval}}. } diff --git a/man/evaluate_estimator-methods.Rd b/man/evaluate_estimator-methods.Rd new file mode 100644 index 0000000..215f9e6 --- /dev/null +++ b/man/evaluate_estimator-methods.Rd @@ -0,0 +1,321 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/evaluate_estimator.R +\name{evaluate_estimator-methods} +\alias{evaluate_estimator-methods} +\alias{evaluate_estimator,PointEstimatorScore,IntervalEstimator-method} +\alias{evaluate_estimator,IntervalEstimatorScore,PointEstimator-method} +\alias{evaluate_estimator,list,Estimator-method} +\alias{evaluate_estimator,Expectation,PointEstimator-method} +\alias{evaluate_estimator,Bias,PointEstimator-method} +\alias{evaluate_estimator,Variance,PointEstimator-method} +\alias{evaluate_estimator,MSE,PointEstimator-method} +\alias{evaluate_estimator,OverestimationProbability,PointEstimator-method} +\alias{evaluate_estimator,Coverage,IntervalEstimator-method} +\alias{evaluate_estimator,SoftCoverage,IntervalEstimator-method} +\alias{evaluate_estimator,Width,IntervalEstimator-method} +\alias{evaluate_estimator,TestAgreement,IntervalEstimator-method} +\title{Evaluate performance characteristics of an estimator} +\usage{ +\S4method{evaluate_estimator}{PointEstimatorScore,IntervalEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{IntervalEstimatorScore,PointEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{list,Estimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{Expectation,PointEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{Bias,PointEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{Variance,PointEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{MSE,PointEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{OverestimationProbability,PointEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{Coverage,IntervalEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{SoftCoverage,IntervalEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{Width,IntervalEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) + +\S4method{evaluate_estimator}{TestAgreement,IntervalEstimator}( + score, + estimator, + data_distribution, + use_full_twoarm_sampling_distribution = FALSE, + design, + true_parameter = mu, + mu, + sigma, + tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), + maxEval = getOption("adestr_maxEval_outer", default = + .adestr_options[["adestr_maxEval_outer"]]), + absError = getOption("adestr_absError_outer", default = + .adestr_options[["adestr_absError_outer"]]), + exact = FALSE, + early_futility_part = TRUE, + continuation_part = TRUE, + early_efficacy_part = TRUE, + conditional_integral = FALSE +) +} +\arguments{ +\item{score}{performance measure to evaluate.} + +\item{estimator}{object of class \code{PointEstimator}, \code{IntervalEstimator} or \code{PValue}.} + +\item{data_distribution}{object of class \code{Normal} or \code{Student}.} + +\item{use_full_twoarm_sampling_distribution}{logical indicating whether this estimator is intended to be used +with the full sampling distribution in a two-armed trial} + +\item{design}{object of class \code{TwoStageDesign}.} + +\item{true_parameter}{true value of the parameter (used e.g. when evaluating bias)} + +\item{mu}{expected value of the underlying normal distribution} + +\item{sigma}{assumed standard deviation.} + +\item{tol}{relative tolerance} + +\item{maxEval}{maximum number of iterations} + +\item{absError}{absolute tolerance} + +\item{exact}{logical indicating usage of exact n2 function.} + +\item{early_futility_part}{include early futility part of integral} + +\item{continuation_part}{include continuation part of integral} + +\item{early_efficacy_part}{include early efficacy part of integral} + +\item{conditional_integral}{treat integral as a conditional integral.} +} +\value{ +\code{EstimatorScoreResult} object containing the performance characteristics of the estimator. +} +\description{ +Evaluate performance characteristics of an estimator +} +\examples{ +evaluate_estimator( + score = MSE(), + estimator = SampleMean(), + data_distribution = Normal(FALSE), + design = get_example_design(), + mu = c(0.3), + sigma = 1, + exact = FALSE +) +} diff --git a/man/evaluate_estimator.Rd b/man/evaluate_estimator.Rd index dc20ae5..1a8a8d6 100644 --- a/man/evaluate_estimator.Rd +++ b/man/evaluate_estimator.Rd @@ -2,18 +2,6 @@ % Please edit documentation in R/evaluate_estimator.R \name{evaluate_estimator} \alias{evaluate_estimator} -\alias{evaluate_estimator,PointEstimatorScore,IntervalEstimator-method} -\alias{evaluate_estimator,IntervalEstimatorScore,PointEstimator-method} -\alias{evaluate_estimator,list,Estimator-method} -\alias{evaluate_estimator,Expectation,PointEstimator-method} -\alias{evaluate_estimator,Bias,PointEstimator-method} -\alias{evaluate_estimator,Variance,PointEstimator-method} -\alias{evaluate_estimator,MSE,PointEstimator-method} -\alias{evaluate_estimator,OverestimationProbability,PointEstimator-method} -\alias{evaluate_estimator,Coverage,IntervalEstimator-method} -\alias{evaluate_estimator,SoftCoverage,IntervalEstimator-method} -\alias{evaluate_estimator,Width,IntervalEstimator-method} -\alias{evaluate_estimator,TestAgreement,IntervalEstimator-method} \title{Evaluate performance characteristics of an estimator} \usage{ evaluate_estimator( @@ -36,258 +24,6 @@ evaluate_estimator( early_efficacy_part = TRUE, conditional_integral = FALSE ) - -\S4method{evaluate_estimator}{PointEstimatorScore,IntervalEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{IntervalEstimatorScore,PointEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{list,Estimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{Expectation,PointEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{Bias,PointEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{Variance,PointEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{MSE,PointEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{OverestimationProbability,PointEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{Coverage,IntervalEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{SoftCoverage,IntervalEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{Width,IntervalEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) - -\S4method{evaluate_estimator}{TestAgreement,IntervalEstimator}( - score, - estimator, - data_distribution, - use_full_twoarm_sampling_distribution = FALSE, - design, - true_parameter = mu, - mu, - sigma, - tol = getOption("adestr_tol_outer", default = .adestr_options[["adestr_tol_outer"]]), - maxEval = getOption("adestr_maxEval_outer", default = - .adestr_options[["adestr_maxEval_outer"]]), - absError = getOption("adestr_absError_outer", default = - .adestr_options[["adestr_absError_outer"]]), - exact = FALSE, - early_futility_part = TRUE, - continuation_part = TRUE, - early_efficacy_part = TRUE, - conditional_integral = FALSE -) } \arguments{ \item{score}{performance measure to evaluate.} diff --git a/tests/testthat/test_LR_boundaries.R b/tests/testthat/test_LR_boundaries.R index 3c9cf0b..9ed9e76 100644 --- a/tests/testthat/test_LR_boundaries.R +++ b/tests/testthat/test_LR_boundaries.R @@ -1,12 +1,16 @@ test_that("implicit rejection boundary from Neyman-Pearson test matches c2", { + p2 <- get_stagewise_estimators(NeymanPearsonOrderingPValue(0, 0.4), + Normal(FALSE), + FALSE, + designad, + 1, + FALSE)[[2]] expect_equal( - c2_np( + implied_c2( designad, adoptr:::scaled_integration_pivots(designad), - 0, - 0, - 0.4, + p2, 1, FALSE, 0.025 diff --git a/tests/testthat/test_against_reference.R b/tests/testthat/test_against_reference.R index 4c96f41..9ce503e 100644 --- a/tests/testthat/test_against_reference.R +++ b/tests/testthat/test_against_reference.R @@ -17,7 +17,7 @@ test_that("MLE densities agree with reference implementation.", 1, exact = FALSE, combine_components = TRUE - )) + ), tolerance = 1e-4) expect_equal(.mle_pdf(1.5, 1, 1, 1, designad), dsmean( Normal(two_armed = FALSE), @@ -27,7 +27,7 @@ test_that("MLE densities agree with reference implementation.", 1, exact = FALSE, combine_components = TRUE - )) + ), tolerance = 1e-4) }) test_that("pseudo Rao-Blackwell estimator agrees with reference implementation.", { diff --git a/tests/testthat/test_analyze.R b/tests/testthat/test_analyze.R index 2b785fe..7001137 100644 --- a/tests/testthat/test_analyze.R +++ b/tests/testthat/test_analyze.R @@ -8,7 +8,7 @@ test_that("Analysis function doesn't throw an error.", { expect_error(analyze( data = dat, - estimator = list(FirstStageSampleMean(), SampleMean(), NaiveCI()), + statistics = list(FirstStageSampleMean(), SampleMean(), NaiveCI()), data_distribution = Normal(), sigma = 1, design = get_example_design()