Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


exams.forge (version 1.0.10)

sqrtnp: Calculating Square Roots of np(1-p) Combinations

Description

Computes sqrt(n*p*(1-p)) for all combinations of n and p. If the result has only digits after the decimal point, then n, p, and sqrt(n*p*(1-p)) are returned in a data frame.

Usage

sqrtnp(n, p, digits = 2, tol = 10^(-digits - 4))

Value

A data frame with the columns n, p, np (=np) and snp (=sqrt(np(1p))).

Arguments

n

numeric: vector of observations numbers

p

numeric: vector of probabilities

digits

numeric: number of digits to check (default: 2)

tol

numeric: tolerance (default: 10^(-digits-4))

Details

If abs(v-round(v, digits))<tol then a number v is considered as a number with only digits after the decimal point.

Examples

Run this code
n <- 30:250
p <- (10:40)/100
sqrtnp(n, p)

Run the code above in your browser using DataLab