funs.covNii: Covariance Matrix of the Self Entries in a Species...

Description Usage Arguments Value Author(s) References See Also Examples

Description

Two functions: covNii.ct and covNii.

Both functions return the covariance matrix of the self entries (i.e. first column entries) in a species correspondence contingency table (SCCT) but have different arguments (see the parameter list below). The covariance matrix is of dimension k \times k and its entries are cov(S_i,S_j) where S_i values are the entries in the first column of SCCT (recall that S_i equals diagonal entry N_{ii} in the NNCT). These covariances are valid under RL or conditional on Q and R under CSR.

The argument ct which is used in covNii.ct only, can be either the NNCT or SCCT. And the argument Vsq is the vector of variances of the diagonal entries N_{ii} in the NNCT or the self entries (i.e. the first column) in the SCCT.

See also (\insertCiteceyhan:NNCorrespond2018;textualnnspat).

Usage

1
2
3
covNii.ct(ct, Vsq, Q, R)

covNii(dat, lab, ...)

Arguments

ct

The NNCT or SCCT, used in covNii.ct only

Vsq

The vector of variances of the diagonal entries N_{ii} in the NNCT or the self entries (i.e. the first column) in the SCCT, used in covNii.ct only

Q

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

R

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

dat

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

lab

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

...

are for further arguments, such as method and p, passed to the dist function, used in covNii 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).

The k \times k covariance matrix of cell counts S_i in the self (i.e., first) column of the SCCT or of the diagonal cell counts N_{ii} for i=1,…,k in the NNCT.

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

scct, cov.nnct, cov.tct and cov.nnsym

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)

vsq<-varNii.ct(ct,Qv,Rv)
covNii(Y,cls)
covNii.ct(ct,vsq,Qv,Rv)

covNii(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)

covNii(Y,fcls)
covNii.ct(ct,vsq,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)

vsq<-varNii.ct(ct,Qv,Rv)
covNii(Y,cls)
covNii.ct(ct,vsq,Qv,Rv)

nnspat documentation built on May 10, 2021, 9:06 a.m.