var.nnct: Variances of Cell Counts in an NNCT

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

View source: R/NNCTFunctions.r

Description

Returns the variances of cell counts N_{ij} for i,j=1,…,k in the NNCT, ct in matrix form which is of the same dimension as ct. These variances are valid under RL or conditional on Q and R under CSR.

See also (\insertCitedixon:1994,dixon:NNCTEco2002,ceyhan:eest-2010,ceyhan:jkss-posthoc-2017;textualnnspat).

Usage

1
var.nnct(ct, Q, R)

Arguments

ct

A nearest neighbor contingency table

Q

The number of shared NNs

R

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

Value

A matrix of same dimension as, ct, whose entries are the variances of the cell counts in the NNCT with class sizes given as the row sums of ct. The row and column names are inherited from ct.

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

var.tct, var.nnsym and cov.nnct

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

W<-Wmat(ipd)
Qv<-Qvec(W)$q
Rv<-Rval(W)
var.nnct(ct,Qv,Rv)

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ct<-nnct(ipd,fcls)
var.nnct(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)
var.nnct(ct,Qv,Rv)

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