将估计的泊松分布与观测的泊松分布和二项式分布进行比较并不能得到充分的结果 #包 图书馆(马萨诸塞州)#帕科特马萨诸塞州 图书馆(汽车)#小型汽车 #创建一些具有二项式负分布的人工数 s # Packages library(MASS)# Pacote MA
将估计的泊松分布与观测的泊松分布和二项式分布进行比较并不能得到充分的结果将估计的泊松分布与观测的泊松分布和二项式分布进行比较并不能得到充分的结果 #包 图书馆(马萨诸塞州)#帕科特马萨诸塞州 图书馆(汽车)#小型汽车 #创建一些具有二项式负分布的人工数 s # Packages library(MASS)# Pacote MA,r,poisson,probability-density,mass,binomial-cdf,R,Poisson,Probability Density,Mass,Binomial Cdf,将估计的泊松分布与观测的泊松分布和二项式分布进行比较并不能得到充分的结果 #包 图书馆(马萨诸塞州)#帕科特马萨诸塞州 图书馆(汽车)#小型汽车 #创建一些具有二项式负分布的人工数 s # Packages library(MASS)# Pacote MASS library(car) # Pacote car # Create some artificial numbers with binomial negative distribution S<-10 P<-0.6 N&l
#包
图书馆(马萨诸塞州)#帕科特马萨诸塞州
图书馆(汽车)#小型汽车
#创建一些具有二项式负分布的人工数
s
# Packages
library(MASS)# Pacote MASS
library(car) # Pacote car
# Create some artificial numbers with binomial negative distribution
S<-10
P<-0.6
N<-rnbinom(n=283, size=S, prob=P)
# Poisson --------------------------------------------------------------------------------------
(poisson <- fitdistr(N,"poisson"))
# Comparation between observed vs estimated values
(n <- length(N))
est1 <-n*dpois(N, lambda=poisson$estimate) ## Estimate the values
fecdf1 <- ecdf(N) ### Empirical Cumulative Distribution Function
knotsX1 <- knots(fecdf1) # Aggregate in classes
emp1 <- fecdf1(c(knotsX1,Inf)) # frequency for each value in the distribution
chisq.test(table(emp1),table(est1))
# Negative binomial ----------------------------------------------------------------------------
( bn <- fitdistr(N,"negative binomial"))
# Comparation between observed vs estimated values
par <- bn$estimate
(size <- par[1])#k
(mu <- par[2])#Media
(n <- length(N))
est2 <-n*dnbinom(N,size=size,mu=mu) ## Estimate the values
fecdf2 <- ecdf(N) ### Empirical distribution function
knotsX2 <- knots(fecdf2) # Aggregate in classes
emp2 <- fecdf2(c(knotsX2,Inf)) # frequency for each value in the distribution
chisq.test(table(emp2),table(est2))