Tval: T value in NN structure

View source: R/NNCTFunctions.R

TvalR Documentation

T value in NN structure

Description

Returns the T value, which is the number of triplets (z_i, z_j, z_k) with "NN(z_i) = NN(z_j) = z_k and NN(z_k) = z_j" where NN(\cdot) is the nearest neighbor function. Note that in the NN digraph, T+R is the sum of the indegrees of the points in the reflexive pairs.

This quantity (together with Q and R) is used in computing the variances and covariances of the entries of the reflexivity contingency table. See (\insertCiteceyhan:NNreflexivity2017;textualnnspat) for further details.

Usage

Tval(W, R)

Arguments

W

The incidence matrix, W, for the NN digraph

R

The number of reflexive NNs (i.e., twice the number of reflexive NN pairs)

Value

Returns the T value. See the description above for the details of this quantity.

Author(s)

Elvan Ceyhan

See Also

Qval, Qvec, sharedNN, and Rval

Examples

#3D data points
n<-10
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
W<-Wmat(ipd)
R<-Rval(W)
Tval(W,R)

#1D data points
X<-as.matrix(runif(15)) # need to be entered as a matrix with one column
#(i.e., a column vector), hence X<-runif(5) would not work
ipd<-ipd.mat(X)
W<-Wmat(ipd)
R<-Rval(W)
Tval(W,R)

#with ties=TRUE in the data
Y<-matrix(round(runif(30)*10),ncol=3)
ipd<-ipd.mat(Y)
W<-Wmat(ipd,ties=TRUE)
R<-Rval(W)
Tval(W,R)


nnspat documentation built on May 29, 2024, 10:03 a.m.