R/corr.sim.R

Defines functions corr.sim

corr.sim <-
function(n.grp,        # Vector with number of subjects per group
                   rdist,        # rdist matrix
                   dist.param1,  # dist.param1
                   dist.param2,  # dist.param2
                   slope,  
                   test.specs,
                   ebp.def,
                   keep.res,     # names of result items to keep
                   nreps=10)
                   
{
   # Initialize result list
   res<-vector("list",6+length(keep.res))
   names(res)<-c("test.specs","ebp.def","slope","rdist","dist.param1","dist.param2",keep.res)
   res$test.specs<-test.specs
   res$ebp.def<-ebp.def
   res$rdist<-rdist
   res$dist.param1<-dist.param1
   res$dist.param2<-dist.param2
   res$slope<-slope
   ngenes<-max(dim(rdist)[1],dim(dist.param1)[1],dim(dist.param2)[1])
   for (i in 6+1:length(keep.res))  res[[i]]<-matrix(NA,ngenes,nreps)

   # Now perform simulation
   for (i in 1:nreps)  # Loop over sim reps
   {
      ex.set<-generate.corr.data(n.grp,rdist,dist.param1,dist.param2,slope)  # Generate a data set
      sim.res<-hybrid.test(ex.set,test.specs,ebp.def)                   # Apply the method
      for (j in 1:length(keep.res))  # Store results in result list object
      {
         res[[keep.res[j]]][,i]<-sim.res[,keep.res[j]]
      }  
   }
   return(res)  # Return results
}

Try the HybridMTest package in your browser

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

HybridMTest documentation built on Nov. 8, 2020, 8:29 p.m.