R/cSS.R

Defines functions cSS

Documented in cSS

cSS = function(K, rx, mu = 0, eps=1e-8)
{
  b = rx$coefficients
  iiv = G2SWEEP(K %*% rx$g2 %*% t(K), Augmented=FALSE, eps=eps)
  Kb = K %*% b - mu
  Q = t(Kb) %*% iiv %*% Kb
  Df = attr(iiv, "rank")
  MS = ifelse(Df > 0, Q/Df, NA)
  if (rx$DFr > 0) {
    Fval = MS/(rx$SSE/rx$DFr)
    Pval = 1 - pf(Fval, Df, rx$DFr)
  } else {
    Fval = NA
    Pval = NA
  }
  Result = data.frame(Df, Q, MS, Fval, Pval)
  colnames(Result) = c("Df", "Sum Sq", "Mean Sq", "F value", "Pr(>F)")
  return(Result)
}

Try the sasLM package in your browser

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

sasLM documentation built on Nov. 19, 2023, 5:12 p.m.