View source: R/NNCTFunctions.R
| Qsym.ct | R Documentation |
Q-symmetry Contingency Table (QCT)Returns the k \times 3 contingency table for Q-symmetry (i.e., Q-symmetry contingency table (QCT)) given the
IPD matrix or data set x where k is the number of classes in the data set.
Each row in the QCT is the vector of number of points with shared NNs,
Q_i=(Q_{i0},Q_{i1},Q_{i2}) where Q_{ij} is the number of class i points that are NN to class j points
for j=0,1 and Q_{i2} is the number of class i points that are NN to class j or more points.
That is, this function pools the cells 3 or larger together for k classes, so, Q_2, Q_3 etc. are pooled,
so, the column labels are Q_0, Q_1 and Q_2 with the last one is actually sum of Q_j for j \ge 2.
Rows the QCT are labeled with the corresponding class labels.
Q-symmetry is also equivalent to Pielou's second type of NN symmetry
or the symmetry in the shared NN structure for all classes.
The argument is.ipd is a logical argument (default=TRUE) to determine the structure of the argument x.
If TRUE, x is taken to be the inter-point distance (IPD) matrix, and if FALSE, x is taken to be the data set
with rows representing the data points.
See also (\insertCitepielou:1961,ceyhan:SWJ-spat-sym2014;textualnnspat) and the references therein.
Qsym.ct(x, lab, is.ipd = TRUE, ...)
x |
The IPD matrix (if |
lab |
The |
is.ipd |
A logical parameter (default= |
... |
are for further arguments, such as |
Returns the k \times 3 QCT where k is the number of classes in the data set.
Elvan Ceyhan
sharedNNmc, Qsym.test and scct
n<-20 #or try sample(1:20,1)
Y<-matrix(runif(n*3),ncol=3)
cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ipd<-ipd.mat(Y)
Qsym.ct(ipd,cls)
Qsym.ct(Y,cls,is.ipd = FALSE)
Qsym.ct(Y,cls,is.ipd = FALSE,method="max")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
Qsym.ct(ipd,fcls)
#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:4,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ipd<-ipd.mat(Y)
Qsym.ct(ipd,cls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.