GriegSmith: Grieg-Smith Calculation

Description Usage Arguments Author(s) References Examples

View source: R/GriegSmith.R

Description

This function accepts a point process object, a two column matrix of x-y coordinate pairs or a three column matrix containing x-y coordinates and quadrat counts in the third column. If the data contains quadrat counts, then the counts=TRUE option must be selected. The function returns a GriegSmith object which is a matrix with block sizes, sum of squares for each block size as well as mean sums of squares. Simulation envelopes are produced as well through randombly permuting the quadrat counts. The 5th and 95th percentiles of the permutations create the simulation envelope.

Ploting the GriegSmith object produces a plot of the MSr as well as the simulation envelopes.

Usage

1
2
3
GriegSmith(datapoints, counts = FALSE, env = 100)
## S3 method for class 'GriegSmith'
plot(x,main, ...)

Arguments

datapoints

datapoints is either a point process object (ppp), a two column matrix of x-y coordinates, or a three column matrix of x-y quadrat coords with a third column of quadrat counts.

counts

If datapoints is a three column matrix with quadrat counts, then set counts=T

env

How many permuatations should be used to create the simulation envelopes default=100.

x

A GriegSmith object created with GriegSmith()

main

the graph title

...

other parameters passed to the plot function

Author(s)

Brian McGuire

References

Statistical Methods for Spatial Data Analysis. Oliver Schabenberger and Carol A. Gotway . Boca Raton, FL: Chapman & Hall/CRC, 2005.

Greig-Smith, P. 1952. The use of random and contiguous quadrats in the study of structure in plant communities. Annals of Botany 16:293-316.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
data(amacrine,package="spatstat")
GS_ama<-GriegSmith(amacrine);
plot(GS_ama)




## The function is currently defined as
function(datapoints,counts=FALSE,env=100){


	if(counts==FALSE){

	if(is.ppp(datapoints)){

		xmin<-datapoints$window$xrange[1]
		xmax<-datapoints$window$xrange[2]

		ymin<-datapoints$window$yrange[1]
		ymax<-datapoints$window$yrange[2]


		datapoints<-cbind(datapoints$x,datapoints$y);


		
	}
	else{

		xmax<-max(datapoints[,1]);
		xmin<-min(datapoints[,1]);

		ymax<-max(datapoints[,2]);
		ymin<-min(datapoints[,2]);





	}


		
	
	numpts<-length(datapoints[,1]);
	startingdim<-ceiling(log(numpts)/(2*log(2)));
	counts<-sums(datapoints,2^startingdim,xmin,xmax,ymin,ymax)
		

	}
	else {
		if (max(datapoints[,1]) != max(datapoints[,2])) stop("Your count data must have equal dimensions")


		datapoints<-datapoints[order(datapoints[,2],datapoints[,1]),]
		numpts<-sum(datapoints[,3])
		startingdim<-ceiling(log(max(datapoints[,1]))/log(2))
		counts<-matrix(datapoints[,3],nrow=2^startingdim,byrow=TRUE);
	
		
	}	


	actual<-iterate(counts,startingdim);
	sims<-envelopes(env,counts,startingdim);
	final<-cbind(actual,sims);
	

	colnames(final)<-c("blocksize","SSr","MSr","MSr.05","MSr.95");

	
	class(final) <- "GriegSmith"


	final;

	


  }

GriegSmith documentation built on May 2, 2019, 12:07 p.m.