View source: R/NNCTFunctions.R
| Wmat | R Documentation |
W for the NN digraphReturns the W=(w_ij) matrix which is used to compute
Q, R and T values in the NN structure.
w_{ij}=I( point j is a NN of point i))
i.e., w_{ij}=1 if point j is a NN of
point i and 0 otherwise.
The argument ties is a logical argument (default=FALSE)
to take ties into account or not. If TRUE the function
takes ties into account by making w_{ij}=1/m
if point j is a NN of point i
and there are m tied NNs and 0 otherwise.
If FALSE, w_{ij}=1 if point j is
a NN of point i and 0 otherwise.
The matrix W is equivalent to
A=(a_{ij}) matrix with k=1,
i.e., Wmat(X)=aij.mat(X,k=1).
The argument is.ipd is a logical argument (default=TRUE)
to determine the structure of the argument x.
If TRUE, x is taken to be
the inter-point distance (IPD) matrix,
and if FALSE, x is taken to be the data set
with rows representing the data points.
Wmat(x, ties = FALSE, is.ipd = TRUE, ...)
x |
The IPD matrix (if |
ties |
A logical parameter (default= |
is.ipd |
A logical parameter (default= |
... |
are for further arguments, such as |
The incidence matrix W=(w_ij)
where w_{ij}=I( point j is a NN of point i)),
i.e., w_{ij}=1 if point j is a NN of
point i and 0 otherwise.
Elvan Ceyhan
aij.mat, aij.nonzero,
and aij.theta
n<-3
X<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(X)
Wmat(ipd)
Wmat(X,is.ipd = FALSE)
n<-5
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
Wmat(ipd)
Wmat(Y,is.ipd = FALSE)
Wmat(Y,is.ipd = FALSE,method="max")
Wmat(Y,is.ipd = FALSE)
aij.mat(Y,k=1)
#1D data points
X<-as.matrix(runif(5)) # 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)
Wmat(ipd)
Wmat(X,is.ipd = FALSE)
#with ties=TRUE in the data
Y<-matrix(round(runif(15)*10),ncol=3)
ipd<-ipd.mat(Y)
Wmat(ipd,ties=TRUE)
Wmat(Y,ties=TRUE,is.ipd = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.