R: Fit Offspring Distribution to the Normal Distribution
fit_dist_norm
R Documentation
Fit Offspring Distribution to the Normal Distribution
Description
This function fits offspring data to a special case of the normal distribution, in which zero and negative values of offspring are excluded, and tests the goodness of fit using the chi-squared test.
Usage
fit_dist_norm(dist)
Arguments
dist
a numeric vector of data values for number of offspring per dam.
Value
estimate
Mean and standard deviation parameters estimated from the supplied distribution.
sd
Standard deviation of the mean and standard deviation estimates.
vcov
Variance/covariance matrix of the mean and standard deviation estimates.
loglik
the log-likelihood of the mean and standard deviation 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_norm
Vector of values generated from a special case of the normal distribution.
Author(s)
M. Catherine Duryea, Andrew D. Kern, Robert M. Cox, and Ryan Calsbeek
Examples
#Fit the Mean and Standard Deviation parameters to a distribution of offspring.
#Test the goodness of fit.
data(fungus)
fungus_fit<-fit_dist_norm(fungus$Total_Offspring)
fungus_fit$fit_norm
fungus_fit$chi_norm
fungus_fit$data_norm
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_norm.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fit_dist_norm
> ### Title: Fit Offspring Distribution to the Normal Distribution
> ### Aliases: fit_dist_norm
> ### Keywords: ~kwd1 ~kwd2
>
> ### ** Examples
>
> #Fit the Mean and Standard Deviation parameters to a distribution of offspring.
> #Test the goodness of fit.
>
> data(fungus)
> fungus_fit<-fit_dist_norm(fungus$Total_Offspring)
Warning message:
In chisq.test(dist, data_norm) : Chi-squared approximation may be incorrect
> fungus_fit$fit_norm
mean sd
14.333333 10.330645
( 2.982200) ( 2.108734)
> fungus_fit$chi_norm
Pearson's Chi-squared test
data: dist and data_norm
X-squared = 52.333, df = 48, p-value = 0.3095
> fungus_fit$data_norm
[1] 12 25 2 19 2 23 6 7 23 21 11 2
>
>
>
>
>
> dev.off()
null device
1
>