R: Fit Offspring Distribution to the Poisson Distribution
fit_dist_pois
R Documentation
Fit Offspring Distribution to the Poisson Distribution
Description
This function fits offspring data to the Poisson distribution, and tests the goodness of fit using the chi-squared test.
Usage
fit_dist_pois(dist)
Arguments
dist
a numeric vector of data values for number of offspring per dam.
Value
estimate
Lambda parameter estimated from the supplied distribution.
sd
Standard deviation of the lambda estimate.
vcov
Variance/covariance matrix of the lambda estimate.
loglik
the log-likelihood of the lambda estimate.
n
The number of observations.
statistic
The chi-squared test statistic.
parameter
Degrees of freedom for the chi-squared test.
p.value
P-value for the chi-squared test.
data_pois
Vector of values generated from the Poisson distribution.
Author(s)
M. Catherine Duryea, Andrew D. Kern, Robert M. Cox, and Ryan Calsbeek
Examples
#Fit the Lambda parameter to a distribution of offspring.
#Test the goodness of fit.
data(fungus)
fungus_fit<-fit_dist_pois(fungus$Total_Offspring)
fungus_fit$fit_pois
fungus_fit$chi_pois
hist(fungus_fit$data_pois)
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(ABCp2)
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ABCp2/fit_dist_pois.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fit_dist_pois
> ### Title: Fit Offspring Distribution to the Poisson Distribution
> ### Aliases: fit_dist_pois
> ### Keywords: ~kwd1 ~kwd2
>
> ### ** Examples
>
> #Fit the Lambda parameter to a distribution of offspring.
> #Test the goodness of fit.
>
> data(fungus)
> fungus_fit<-fit_dist_pois(fungus$Total_Offspring)
Warning message:
In chisq.test(dist, data_pois) : Chi-squared approximation may be incorrect
> fungus_fit$fit_pois
lambda
14.333333
( 1.092906)
> fungus_fit$chi_pois
Pearson's Chi-squared test
data: dist and data_pois
X-squared = 44.5, df = 36, p-value = 0.1564
> hist(fungus_fit$data_pois)
>
>
>
>
>
> dev.off()
null device
1
>