fit_dist_gamma: Fit Offspring Distribution to the Gamma Distribution

Description Usage Arguments Value Author(s) Examples

View source: R/fit_dist_gamma.R

Description

This function fits offspring data to a special case of the gamma distribution, in which zero values of offspring are excluded and all values are rounded to a whole number, and tests the goodness of fit using the chi-squared test.

Usage

1

Arguments

dist

a numeric vector of data values for number of offspring per dam.

Value

estimate

Shape and rate parameters estimated from the supplied distribution.

sd

Standard deviation of the shape and rate estimates.

vcov

Variance/covariance matrix of the shape and rate estimates.

loglik

the log-likelihood of the shape and rate estimates.

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_gamma

Vector of values generated from a special case of the gamma distribution.

Author(s)

M. Catherine Duryea, Andrew D. Kern, Robert M. Cox, and Ryan Calsbeek

Examples

1
2
3
4
5
6
7
8
#Fit the Shape and Rate parameters to a distribution of offspring.
#Test the goodness of fit.

data(fungus)
fungus_fit<-fit_dist_gamma(fungus$Total_Offspring)
fungus_fit$fit_gamma
fungus_fit$chi_gamma
hist(fungus_fit$data_gamma)

Example output

Loading required package: MASS
Warning message:
In chisq.test(dist, data_gamma) :
  Chi-squared approximation may be incorrect
     shape         rate   
  1.83470164   0.12800243 
 (0.69165781) (0.05542993)

	Pearson's Chi-squared test

data:  dist and data_gamma
X-squared = 67, df = 60, p-value = 0.2495

ABCp2 documentation built on May 1, 2019, 6:31 p.m.

Related to fit_dist_gamma in ABCp2...