Last data update: 2014.03.03

R: Generate Bootstrap Replicates of Moran's I Autocorrelation...
moranI.bootR Documentation

Generate Bootstrap Replicates of Moran's I Autocorrelation Statistic

Description

Generate bootstrap replicates of Moran's I autocorrelation statistic, by means of function boot form boot library. Notice that these functions should not be used separately but as argument statistic when calling function boot.

moranI.boot is used when performing a non-parametric bootstrap.

moranI.pboot is used when performing a parametric bootstrap.

Usage

moranI.boot(data, i, ...)
moranI.pboot(...)

Arguments

data

A dataframe containing the data, as specified in the DClustermanpage.

i

Permutation generated by the bootstrap procedure

...

Aditional arguments passed when performing a bootstrap.

Value

Both functions return the value of the statistic.

References

Moran, P. A. P. (1948). The interpretation os statistical maps. Journal of the Royal Statistical Society, Series B 10, 243-251.

See Also

DCluster, boot, moranI, moranI.stat

Examples

library(spdep)
data(nc.sids)
col.W <- nb2listw(ncCR85.nb, zero.policy=TRUE)

sids<-data.frame(Observed=nc.sids$SID74)
sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74)) 

niter<-100

#Permutation model
moran.boot<-boot(sids, statistic=moranI.boot, R=niter, listw=col.W, 
	n=length(ncCR85.nb), S0=Szero(col.W) )
plot(moran.boot)#Display results

#Multinomial model
moran.mboot<-boot(sids, statistic=moranI.pboot, sim="parametric", 
	ran.gen=multinom.sim,  R=niter, listw=col.W,n=length(ncCR85.nb), 
	S0=Szero(col.W) )
plot(moran.mboot)#Display results

#Poisson model
moran.pboot<-boot(sids, statistic=moranI.pboot, sim="parametric", 
	ran.gen=poisson.sim,  R=niter, listw=col.W,n=length(ncCR85.nb),
	S0=Szero(col.W) )
		
plot(moran.pboot)#Display results

#Poisson-Gamma model
moran.pgboot<-boot(sids, statistic=moranI.pboot, sim="parametric", 
	ran.gen=negbin.sim, R=niter,  listw=col.W,n=length(ncCR85.nb),
	S0=Szero(col.W) )
		
plot(moran.pgboot)#Display results

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(DCluster)
Loading required package: boot
Loading required package: spdep
Loading required package: sp
Loading required package: Matrix
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DCluster/moranI.boot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: moranI.boot
> ### Title: Generate Bootstrap Replicates of Moran's I Autocorrelation
> ###   Statistic
> ### Aliases: moranI.boot moranI.pboot
> ### Keywords: spatial
> 
> ### ** Examples
> 
> library(spdep)
> data(nc.sids)
> col.W <- nb2listw(ncCR85.nb, zero.policy=TRUE)
> 
> sids<-data.frame(Observed=nc.sids$SID74)
> sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74)) 
> 
> niter<-100
> 
> #Permutation model
> moran.boot<-boot(sids, statistic=moranI.boot, R=niter, listw=col.W, 
+ 	n=length(ncCR85.nb), S0=Szero(col.W) )
> plot(moran.boot)#Display results
> 
> #Multinomial model
> moran.mboot<-boot(sids, statistic=moranI.pboot, sim="parametric", 
+ 	ran.gen=multinom.sim,  R=niter, listw=col.W,n=length(ncCR85.nb), 
+ 	S0=Szero(col.W) )
> plot(moran.mboot)#Display results
> 
> #Poisson model
> moran.pboot<-boot(sids, statistic=moranI.pboot, sim="parametric", 
+ 	ran.gen=poisson.sim,  R=niter, listw=col.W,n=length(ncCR85.nb),
+ 	S0=Szero(col.W) )
> 		
> plot(moran.pboot)#Display results
> 
> #Poisson-Gamma model
> moran.pgboot<-boot(sids, statistic=moranI.pboot, sim="parametric", 
+ 	ran.gen=negbin.sim, R=niter,  listw=col.W,n=length(ncCR85.nb),
+ 	S0=Szero(col.W) )
> 		
> plot(moran.pgboot)#Display results
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>