funsPseg.ss | R Documentation |

Two functions: `Pseg.ss.ct`

and `Pseg.ss`

.

Both functions are objects of class `"Chisqtest"`

but with different arguments (see the parameter list below).
Each one performs hypothesis tests of deviations of
cell counts from the expected values under independence for all cells (i.e., entries) combined in the NNCT.
That is, each test is Pielou's overall test of segregation based on NNCTs for *k ≥ 2* classes.
This overall test is based on the chi-squared approximation,
is equivalent to Pearson's chi-squared test on NNCT and
is due to \insertCitepielou:1961;textualnnspat.
Each test is appropriate (i.e. have the appropriate asymptotic sampling distribution)
when that data is obtained by sparse sampling.

Each function yields the test statistic, *p*-value and `df`

which is *(k-1)^2*, description of the
alternative with the corresponding null values (i.e. expected values) of NNCT entries,
sample estimates (i.e. observed values) of the entries in NNCT.
The functions also provide names of the test statistics, the method and the data set used.

The null hypothesis is that *E(N_{ij})=n_i c_j /n* for all entries in the NNCT
where *n_i* is the sum of row *i* (i.e. size of class *i*), *c_j* is the sum of column *j* in the *k \times k* NNCT for *k ≥ 2*.
In the output, the test statistic and the *p*-value are valid only
for (properly) sparsely sampled data.

See also (\insertCitepielou:1961,ceyhan:eest-2010;textualnnspat) and the references therein.

Pseg.ss.ct(ct, yates = TRUE, sim = FALSE, Nsim = 2000) Pseg.ss(dat, lab, yates = TRUE, sim = FALSE, Nsim = 2000, ...)

`ct` |
A nearest neighbor contingency table, used in |

`yates` |
A logical parameter (default= |

`sim` |
A logical parameter (default= |

`Nsim` |
A positive integer specifying the number of replicates used in the Monte Carlo test.
Equivalent to the |

`dat` |
The data set in one or higher dimensions, each row corresponds to a data point,
used in |

`lab` |
The |

`...` |
are for further arguments, such as |

A `list`

with the elements

`statistic` |
The overall chi-squared statistic |

`stat.names` |
Name of the test statistic |

`p.value` |
The |

`df` |
Degrees of freedom for the chi-squared test, which is (k-1)^2 for this function.
Yields |

`estimate` |
Estimates of the parameters, NNCT, i.e., matrix of the observed |

`est.name,est.name2` |
Names of the estimates, they are identical for this function. |

`null.value` |
Matrix of hypothesized null values for the parameters which are expected values of the
the |

`null.name` |
Name of the null values |

`method` |
Description of the hypothesis test |

`ct.name` |
Name of the contingency table, |

`data.name` |
Name of the data set, |

Elvan Ceyhan

`overall.nnct.ct`

, `overall.nnct`

, `overall.seg.ct`

,
`overall.seg`

and `chisq.test`

n<-20 #or try sample(1:20,1) Y<-matrix(runif(3*n),ncol=3) ipd<-ipd.mat(Y) cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10)) ct<-nnct(ipd,cls) ct Pseg.ss(Y,cls) Pseg.ss.ct(ct) Pseg.ss.ct(ct,yates=FALSE) Pseg.ss.ct(ct,yates=FALSE,sim=TRUE) Pseg.ss.ct(ct,yates=FALSE,sim=TRUE,Nsim=10000) Pseg.ss(Y,cls,method="max") Pseg.ss(Y,cls,yates=FALSE,sim=TRUE,Nsim=10000,method="max") #cls as a factor na<-floor(n/2); nb<-n-na fcls<-rep(c("a","b"),c(na,nb)) ct<-nnct(ipd,fcls) Pseg.ss(Y,fcls) Pseg.ss.ct(ct) ############# n<-40 Y<-matrix(runif(3*n),ncol=3) ipd<-ipd.mat(Y) cls<-sample(1:4,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10)) ct<-nnct(ipd,cls) Pseg.ss(Y,cls) Pseg.ss.ct(ct,yates=FALSE) Pseg.ss(Y,cls, sim = TRUE, Nsim = 2000) Pseg.ss.ct(ct,yates=FALSE)

nnspat documentation built on Aug. 30, 2022, 9:06 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.