View source: R/calculate.mle.R
calculate.mle | R Documentation |
When boostrap is used to sample values of the statistic under study, it is possible to use argument mle to pass the values of the parameters involved in the sampling procedure.
calculate.mle(d, model="poisson")
d |
A dataframe as described in the DCluster manual page. |
model |
Model used to sample data. It can be either "multinomial", "poisson" or "negbin". |
A list with the estimates of the parameters involved in the model:
Multimonial |
Total observed cases (n) and vector of probabilities (p). |
Poisson |
Total number of regions (n) and vector of means (lambda). |
Negative Binomial (Poisson-Gamma) |
Total number of regions (n), size and probabilites, calculated after estimating parameters parameters nu and alpha of the Gamma distribution following equations proposed by Clayton and Kaldor (1989). |
DCluster, observed.sim
library(spdep)
data(nc.sids)
sids<-data.frame(Observed=nc.sids$SID74)
sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74))
sids<-cbind(sids, x=nc.sids$x, y=nc.sids$y)
#Carry out simulations
datasim<-multinom.sim(sids, mle=calculate.mle(sids, model="multinomal") )
#Estimators for Poisson distribution
datasim<-poisson.sim(sids, mle=calculate.mle(sids, model="poisson") )
#Estimators for Negative Binomial distribution
datasim<-negbin.sim(sids, mle=calculate.mle(sids, model="negbin") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.