R/sim.data.single.R

sim.data.single <-
function(Z,Theta,Sigma)
{
  n<-length(Z)
  
  s<-svd(Sigma)
  Sigma.root<-s$u%*%diag(sqrt(s$d))%*%t(s$v)
  
  E<-matrix(rnorm(2*n),nrow=n)%*%Sigma.root
  
  M<-Z*Theta[1,1]+E[,1]
  R<-Z*Theta[1,2]+M*Theta[2,2]+E[,2]
  
  re<-data.frame(Z=Z,M=M,R=R)
  return(re)
}

Try the macc package in your browser

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

macc documentation built on May 2, 2019, 12:23 p.m.