Learn R Programming

PredTest (version 0.1.0)

solve_p0_score_ci: Calculate the Adjusted Proportion Estimate and Confidence Interval

Description

This function calculates the adjusted proportion estimate (p0) and the confidence interval for a given proportion estimate (p_hat) and sample size (n) using the score method.

Usage

solve_p0_score_ci(p_hat, n, z = 1.96)

Value

A list with two elements:

p0

The adjusted proportion estimate.

confidence_interval

A numeric vector of length 2 containing the lower and upper bounds of the confidence interval.

Arguments

p_hat

Numeric value. The proportion estimate. Must be between 0 and 1.

n

Numeric value. The sample size. Must be a positive integer.

z

Numeric value. The z-score for the desired confidence level. Default is 1.96 (approximately 95% confidence interval).

Examples

Run this code
solve_p0_score_ci(p_hat = 9/10, n = 10)

Run the code above in your browser using DataLab