R/gfac2.R

# gfac version first index fastest
gfac2<-function(covlevels){

      nrows<-1
      ncov<-length(covlevels)
      levmult <- cumprod(covlevels)
      totlev<-levmult[ncov]
      levmult<-c(1,levmult[-ncov])

      # generate covariates

      cov<-NULL
      for (j in 1:ncov) {
          scov<-gl(covlevels[j],levmult[j],totlev*nrows)
          cov<-cbind(cov,scov)
      }
      cov
}

Try the prefmod package in your browser

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

prefmod documentation built on May 2, 2019, 4:59 p.m.