R/weight_matrix.R

Defines functions weight_matrix

Documented in weight_matrix

weight_matrix <-
function(A,
                          W,
                          B){
  if(dim(A)[1]!=dim(B)[1])#prevent different dimension
    stop("the dimensions are different")
  else
    samplesize <- dim(A)[1]
  
  W_matrix <- diag(as.vector(W))
  weight_matrix <- t(A)%*%W_matrix%*%B
  
  return(weight_matrix)
}

Try the EMSNM package in your browser

Any scripts or data that you put into this service are public.

EMSNM documentation built on May 2, 2019, 1:41 p.m.