R/initial_full.R

Defines functions initial.full

initial.full<-function(cand.full, Nruns,
                       primary.terms, potential.terms)          # cand.full - extended model matrix with labels, returns initial primary and potential matrices
{
  eps<-10^(-6)
  det<-0
  while (det<eps)
  {
    index<-sample(1:nrow(cand.full), size=Nruns, replace=TRUE)
    X1<-cand.full[index, c("label", primary.terms), drop = F]
#    cat(index, "\n")
#    cat(potential.terms, "\n")
#    print(cand.full)
    X2<-cand.full[index, c("label", potential.terms), drop = F]
    det<-round(prod(eigen(t(X1[,-1])%*%X1[,-1], symmetric=TRUE, only.values=TRUE)$values), 6)  # det of the information matrix
  }
  list(X1=X1, X2=X2, det=det)  # X1, X2 -- matrices of primary and potential terms, both with labels
}

Try the MOODE package in your browser

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

MOODE documentation built on Aug. 19, 2025, 1:11 a.m.