R/varsample.R

Defines functions varsample

Documented in varsample

##==============================================================================
## varsample  : Samples variable equations
##==============================================================================

varsample <- function(X,  EqA, EqB=NULL)  {

  if (! is.matrix(EqA) & ! is.null(EqA))
    EqA <- t(as.matrix(EqA))
  if (! is.matrix(X) & ! is.null(X))
    X <- t(as.matrix(X))

  if (is.null(EqB))
    EqB <- rep(0,nrow(EqA))
  Var <- NULL
  if (ncol(X) != ncol(EqA))
    stop("matrix X and EqA not compatible")
  for (i in 1:nrow(X))
    Var <- rbind(Var,t(EqA%*%X[i,]-EqB))
  return(Var)
}

Try the limSolve package in your browser

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

limSolve documentation built on Nov. 12, 2019, 3 p.m.