eqhyper(x, m = NULL, total = NULL, k = NULL, p = 0.5, method = "mle", digits = 0)
k
drawn without replacement from the urn, or an object resulting
from a call to an estimating function that assumes a hypergeometric distribution
(em
or total
, but not both.
Missing values (NA
s) are not allowed.m+n
). You must supply m
or total
, but not both.
Missing values (NA
s) are not allowed.NA
s) are not allowed.p
must be between 0 and 1. The default value is p=0.5
."mle"
(maximum likelihood; the default) and "mvue"
(minimum variance unbiased). The mvue me100*p
. The default value is digits=0
.x
is a numeric vector, eqhyper
returns a
list of class "estimate"
containing the estimated quantile(s) and other
information. See estimate.object
for details.
If x
is the result of calling an estimation function, eqhyper
returns a list whose class is the same as x
. The list
contains the same components as x
, as well as components called
quantiles
and quantile.method
.eqhyper
returns estimated quantiles as well as
estimates of the hypergeometric distribution parameters.
Quantiles are estimated by 1) estimating the distribution parameters by
calling ehyper
, and then 2) calling the function
qhyper
and using the estimated values for
the distribution parameters.ehyper
, Hypergeometric, estimate.object
.# Generate an observation from a hypergeometric distribution with
# parameters m=10, n=30, and k=5, then estimate the parameter m, and
# the 80'th percentile.
# Note: the call to set.seed simply allows you to reproduce this example.
# Also, the only parameter actually estimated is m; once m is estimated,
# n is computed by subtracting the estimated value of m (8 in this example)
# from the given of value of m+n (40 in this example). The parameters
# n and k are shown in the output in order to provide information on
# all of the parameters associated with the hypergeometric distribution.
set.seed(250)
dat <- rhyper(nn = 1, m = 10, n = 30, k = 5)
dat
#[1] 1
eqhyper(dat, total = 40, k = 5, p = 0.8)
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Hypergeometric
#
#Estimated Parameter(s): m = 8
# n = 32
# k = 5
#
#Estimation Method: mle for 'm'
#
#Estimated Quantile(s): 80'th %ile = 2
#
#Quantile Estimation Method: Quantile(s) Based on
# mle for 'm' Estimators
#
#Data: dat
#
#Sample Size: 1
#----------
# Clean up
#---------
rm(dat)
Run the code above in your browser using DataLab