View source: R/NNCTFunctions.r
| sharedNNmc | R Documentation |
Returns a matrix with k rows where each row is the vector of number of points with shared NNs,
Q_i=(Q_{i0},Q_{i1},…) where Q_{ij} is the number of class i points that are NN to class j points.
The function also returns the indices of columns with nonzero sums as a vector.
The output matrix of shared NNs is used in testing symmetry in shared NN structure (i.e. Q-symmetry
or Pielou's second type of symmetry),
e.g., in functions Qsym.ct and Qsym.test.
See also (\insertCitepielou:1961,ceyhan:SWJ-spat-sym2014;textualnnspat) and the references therein.
sharedNNmc(x, lab, is.ipd = TRUE, ...)
x |
The IPD matrix (if |
lab |
The |
is.ipd |
A logical parameter (default= |
... |
are for further arguments, such as |
Qval returns the Q value
Qvec returns a list with two elements
q |
the Q value, the number of shared NNs |
qvec |
the |
sharedNN returns a matrix with 2 rows, where first row is the j values and second row is
the corresponding vector of Q_j values
Rvalthe R value, the number of reflexive NNs
Returns a list with two elements
Nv |
A k-row matrix of shared NNs by class where each row of the matrix is the vector of number of points with shared NNs Q_i=(Q_{i0},Q_{i1},…) where Q_{ij} is the number of class i points that are NN to j points. |
col.ind |
The |
Elvan Ceyhan
Qval, Qvec and sharedNN
n<-20 #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10))
ipd<-ipd.mat(Y)
sharedNNmc(ipd,cls)
sharedNNmc(Y,cls,is.ipd = FALSE)
sharedNNmc(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))
sharedNNmc(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)
sharedNNmc(ipd,cls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.