eqgeom(x, p = 0.5, method = "mle/mme", digits = 0)
Arguments
x
a numeric vector of observations, or an object resulting from a call to an
estimating function that assumes a geometric distribution
(e.g., egeom). If x is a numeric vector,
missing (NA), undefined (NaN), and infinite (Inf, -Inf)
values are allowed but will be removed.
p
numeric vector of probabilities for which quantiles will be estimated.
All values of p must be between 0 and 1. The default value is p=0.5.
method
character string specifying the method to use to estimate the probability parameter.
Possible values are "mle/mme" (maximum likelihood and method of moments;
the default) and "mvue" (minimum variance unbiased). You cannot use
method="mvue" if length(x)=1. See the DETAILS section of the help file
for egeom for more information on these estimation methods.
digits
an integer indicating the number of decimal places to round to when printing out
the value of 100*p. The default value is digits=0.
Details
The function eqgeom returns estimated quantiles as well as
the estimate of the rate parameter.
Quantiles are estimated by 1) estimating the probability parameter by
calling egeom, and then 2) calling the function
qgeom and using the estimated value for
the probability parameter.
Value
If x is a numeric vector, eqgeom 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, eqgeom
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.
Note
The geometric distribution with parameter
prob=p is a special case of the
negative binomial distribution with parameters
size=1 and prob=p.
The negative binomial distribution has its roots in a gambling game where
participants would bet on the number of tosses of a coin necessary to achieve
a fixed number of heads. The negative binomial distribution has been applied
in a wide variety of fields, including accident statistics, birth-and-death
processes, and modeling spatial distributions of biological organisms.
# Generate an observation from a geometric distribution with parameter
# prob=0.2, then estimate the parameter prob and the 90'th percentile.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(250)
dat <- rgeom(1, prob = 0.2)
dat
#[1] 4
eqgeom(dat, p = 0.9)
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Geometric
#
#Estimated Parameter(s): prob = 0.2
#
#Estimation Method: mle/mme
#
#Estimated Quantile(s): 90'th %ile = 10
#
#Quantile Estimation Method: Quantile(s) Based on
# mle/mme Estimators
#
#Data: dat
#
#Sample Size: 1
#----------
# Clean up
#---------
rm(dat)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(EnvStats)
Attaching package: 'EnvStats'
The following objects are masked from 'package:stats':
predict, predict.lm
The following object is masked from 'package:base':
print.default
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EnvStats/eqgeom.Rd_%03d_medium.png", width=480, height=480)
> ### Name: eqgeom
> ### Title: Estimate Quantiles of a Geometric Distribution
> ### Aliases: eqgeom
> ### Keywords: distribution htest
>
> ### ** Examples
>
> # Generate an observation from a geometric distribution with parameter
> # prob=0.2, then estimate the parameter prob and the 90'th percentile.
> # (Note: the call to set.seed simply allows you to reproduce this example.)
>
> set.seed(250)
> dat <- rgeom(1, prob = 0.2)
> dat
[1] 4
> #[1] 4
>
> eqgeom(dat, p = 0.9)
Results of Distribution Parameter Estimation
--------------------------------------------
Assumed Distribution: Geometric
Estimated Parameter(s): prob = 0.2
Estimation Method: mle/mme
Estimated Quantile(s): 90'th %ile = 10
Quantile Estimation Method: Quantile(s) Based on
mle/mme Estimators
Data: dat
Sample Size: 1
>
> #Results of Distribution Parameter Estimation
> #--------------------------------------------
> #
> #Assumed Distribution: Geometric
> #
> #Estimated Parameter(s): prob = 0.2
> #
> #Estimation Method: mle/mme
> #
> #Estimated Quantile(s): 90'th %ile = 10
> #
> #Quantile Estimation Method: Quantile(s) Based on
> # mle/mme Estimators
> #
> #Data: dat
> #
> #Sample Size: 1
>
> #----------
>
> # Clean up
> #---------
> rm(dat)
>
>
>
>
>
> dev.off()
null device
1
>