Learn R Programming

emon (version 1.3)

size2.samevar: Calculates negative binomial size to preserve constant variance.

Description

Calculates the Negative Binomial size parameter s2 such that the variance of the distribution with mean mu2 and size s2 is the same as the Negative Binomial distribution with mean mu1 and size s1. This can be useful when computing power for a Negative Binomial distribution in the packages power.groups and power.BACI.

Usage

size2.samevar(mu1, mu2, s1)

Arguments

mu1
Negative Binomial mean for group 1
mu2
Negative Binomial mean for group 2
s1
Negative Binomial size for group 1

Value

The size for group 1.

See Also

power.groups, power.BACI

Examples

Run this code
mu1=5; mu2=10; s1=3
s2 = size2.samevar(mu1, mu2, s1)
s2
# Check variances are the same
v1 = mu1 + mu1^2 / s1
v2 = mu2 + mu2^2 / s2
v1; v2

Run the code above in your browser using DataLab