funs.varNii {nnspat}R Documentation

Variances of the Self Entries in a Species Correspondence Contingency Table (SCCT)

Description

Two functions: varNii.ct and varNii.

Both functions return a vector of length k of variances of the self entries (i.e., first column) in a species correspondence contingency table (SCCT) or the variances of the diagonal entries N_{ii} in an NNCT, but have different arguments (see the parameter list below). These variances are valid under RL or conditional on Q and R under CSR.

The argument ct which is used in varNii.ct only, can be either the NNCT or SCCT.

See also (Ceyhan (2018)).

Usage

varNii.ct(ct, Q, R)

varNii(dat, lab, ...)

Arguments

ct

The NNCT or SCCT, used in varNii.ct only

Q

The number of shared NNs, used in varNii.ct only

R

The number of reflexive NNs (i.e., twice the number of reflexive NN pairs), used in varNii.ct only

dat

The data set in one or higher dimensions, each row corresponds to a data point, used in varNii only

lab

The vector of class labels (numerical or categorical), used in varNii only

...

are for further arguments, such as method and p, passed to the dist function, used in varNii only

Value

A vector of length k whose entries are the variances of the self entries (i.e., first column) in a species correspondence contingency table (SCCT) or of the diagonal entries in an NNCT.

Author(s)

Elvan Ceyhan

References

Ceyhan E (2018). “A contingency table approach based on nearest neighbor relations for testing self and mixed correspondence.” SORT-Statistics and Operations Research Transactions, 42(2), 125-158.

See Also

scct, var.nnct, var.tct, var.nnsym and covNii

Examples

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)

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)

varNii(Y,cls)
varNii.ct(ct,Qv,Rv)

varNii(Y,cls,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)

varNii(Y,fcls)
varNii.ct(ct,Qv,Rv)

#############
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)

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)

varNii(Y,cls)
varNii.ct(ct,Qv,Rv)


[Package nnspat version 0.1.2 Index]