swh:1:snp:9492dda1ea1583c5fa5285d6ddcd2ab9f57129b4
Tip revision: e7c0fa6ef701ffd141f61617cc73be523b2c9046 authored by Patrick Mair on 03 October 2018, 07:24:35 UTC
version 0.16-2
version 0.16-2
Tip revision: e7c0fa6
build_W.R
build_W <- function(X,nitems,mpoints,grp_n,groupvec,itmgrps)
{
if(missing(grp_n)) grp_n<- table(groupvec)
if(!is.numeric(grp_n)) stop("Please specify the number of subjects per group.")
if(missing(nitems))stop("Please specify the number of items.")
if(any(grp_n==0)) stop("There are groups with zero sample size.")
if(missing(mpoints)) stop("Please specify the number of time points. If there are none, you might want to use PCM() or LPCM().")
pplgrps <- length(grp_n)
#builds the LLRA design matrix from scratch
categos <- get_item_cats(X,nitems,grp_n)
#trend effects design
tr.des <- build_trdes(nitems,mpoints,pplgrps,categos)
#tretment effects design
gr.des <- build_effdes(nitems,mpoints,pplgrps,categos,groupvec)
#category design
if(length(unique(unlist(categos)))==1&&sum(unique(unlist(categos)))==1) return(cbind(gr.des,tr.des))
ct.des <- build_catdes(nitems,mpoints,pplgrps,categos)
#all together now!
des <-cbind(gr.des,tr.des,ct.des)
des
}