R/satt.R

Defines functions satt

Documented in satt

satt = function(vars, dfs, ws=c(1, 1)) 
{
  if (length(vars) != length(dfs)) stop("Lengths of vars and dfs are different!")
  if (length(ws) != length(vars)) ws = rep(1, length(vars))
  vars = vars[ws != 0]
  dfs = dfs[ws != 0]
  ws = ws[ws != 0]
  ws = ws/sum(ws)
  Variance = sum(ws*vars)
  Df = ifelse(length(dfs) == 1, dfs, Variance^2/sum((ws*vars)^2/dfs))
  Result = list(Variance=Variance, Df=Df)
  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 Oct. 2, 2024, 9:06 a.m.