R/generate_C.R

Defines functions generate_C

generate_C <- function(R,n){ #calculate the distance between different thetas...minimize to make piecewise representation
  D <- matrix(0,nrow=n*R,ncol=n*R)

  for(i in 1:(n*R-1)){
    D[i,i] <- -1
    D[i,i+1] <- 1
  }

  for(i in 1:n){
    D[i*R,] <- NA
  }
  C <- na.omit(D) #omit the lines that are the 1st of every T replicates

  return(C)
}

Try the latentgraph package in your browser

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

latentgraph documentation built on Dec. 15, 2020, 5:23 p.m.