File: LLRA.R

package info (click to toggle)
r-cran-erm 1.0-6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,952 kB
  • sloc: f90: 401; ansic: 103; makefile: 8
file content (16 lines) | stat: -rwxr-xr-x 752 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LLRA <- function(X, W, mpoints, groups, baseline=NULL, itmgrps=NULL,...)
{
  if(missing(mpoints)) stop("Please specify the number of time points. If there are none, you might want to try PCM() or LPCM().")
  Xprep <- llra.datprep(X,mpoints,groups,baseline)
  itmgrps <- rep(1:Xprep$nitems) 
  groupvec <- Xprep$assign.vec
  pplgrps <- length(Xprep$grp_n)
  if(missing(W)) W <- build_W(Xprep$X,length(unique(itmgrps)),mpoints,Xprep$grp_n,groupvec,itmgrps)
  fit <- LPCM(Xprep$X,W,mpoints=mpoints,groupvec=groupvec,sum0=FALSE)
  refg <- unique(names(which(groupvec==max(groupvec))))
  out <- c(fit,"itms"=Xprep$nitems,"refGroup"=refg)
  out$call <- match.call()
  class(out) <- c("llra","Rm","eRm")
  cat("Reference group: ",refg,"\n\n")
  return(out)
}