funsW345values | R Documentation |
Three functions: W3val
, W4val
and W5val
, each of which is needed to compute E[T^3]
(i.e., for the skewness of T)
where T=T(θ) which is defined in Equation (2) of \insertCitetango:2007;textualnnspat as follows:
Let (z_1,…,z_n ), n = n_0 + n_1, denote the locations of the points in the combined sample
when the indices have been randomly permuted so that the z_i contain no information about group membership.
T(θ)=∑_{i=1}^{n}∑_{j=1}^{n}δ_i δ_j a_{ij}(θ)= \boldsymbol δ^t \boldsymbol A(θ)) \boldsymbol δ
where δ_i=1 if z_i is a case, and 0 if z_i is a control, \boldsymbol A(θ) = (a_{ij} (θ)) could be any matrix of a measure of the closeness between two points i and j with a_{ii} = 0 for all i = 1,…,n, and \boldsymbol θ = (θ_1,…,θ_p)^t denotes the unknown parameter vector related to cluster size and \boldsymbol δ = (δ_1,…,δ_n)^t. Here the number of cases are denoted as n_1 and number of controls as n_0 to match the case-control class labeling, which is just the reverse of the labeling in \insertCitetango:2007;textualnnspat.
If θ=k in the nearest neighbors model with a_{ij}(k) = 1 if z_j is among the kNNs of z_i and 0
otherwise, then the test statistic T(θ) = T_k is the Cuzick and Edwards kNN test statistic, T_k
\insertCitecuzick:1990;textualnnspat, see also ceTk
.
W_k values are used for Tango's correction to Cuzick and Edwards kNN test statistic, T_k and W_k here corresponds to W_{k-1} in \insertCitetango:2007;textualnnspat (defined for consistency with p_k's and alpha_r having r distinct elements).
The argument of the function is the A_{ij} matrix, a
, which is the output of the function aij.mat
.
However, inside the function we symmetrize the matrix a
as b <- (a+a^t)/2
, to facilitate the formulation.
W3val(a) W4val(a) W5val(a)
a |
A_{ij} matrix which is the output of the function |
Each function Wkval
returns the W_k value for k=3,4,5.
Elvan Ceyhan
ceTk
, EV.Tk
, varTk
, Xsq.ceTk
n<-20 #or try sample(1:20,1) Y<-matrix(runif(3*n),ncol=3) k<-sample(1:5,1) # try also 3, 5, sample(1:5,1) k a<-aij.mat(Y,k) W3val(a) W4val(a) W5val(a) a<-aij.mat(Y,k,method="max") W3val(a) W4val(a) W5val(a)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.