Skip to content
Josh Errickson edited this page Nov 24, 2015 · 1 revision

mlm notes

  • Build the model frame as in lm, except use na.pass
  • Look for a column inheriting from class optmatch. (If there are none, or two or more, then bail.)
  • use model.response, model.offset (if applicable), model.weights (if applicable) to assemble corresponding vectors
  • Strip the optmatch variable from the provided formula and push reduced formula, model frame through fill.NAs (for now)
  • Remove from resulting model frame rows that have NAs on either the response or the optmatch or the offset.
  • Remove corresponding entries from the optmatch, the response and (if applicable) the offset and the weights
  • Coerce the optmatch to a matrix.csr
  • Build model matrix, then use matrix.csr version of the optmatch to linearly transform into matched differences model matrix, x
  • Also build vectors y of matched diffs on response, offset of matched diffs in offset
  • build vectors of n.tx, n.ctl. If weights provided, these are sums of weights.
  • Strip out rows/entries for which n.tx=0 or n.ctl=0
  • Look in x for a column of 1's, other than "(Intercept)". If found, remove "(Intercept)" column. If not found, relabel "(Intercept)" as "z"
  • fitweights = ms.weights(n.tx, n.ctl) If any of fitweights are NA, bail.
  • If fit.type="lm", then do and return wlm.fit(x, y, w=fitweights, offset=offset)
  • If/when we enable fit.type="robust", call rlm on x, y, w, offset The matched differences model matrix has a col for each covariate but w/ one row for each matched set. Entries in this row are per matched set differences of means between treatment and control groups, with the treatment group being identified by the contrast.group attribute of the optmatch object.
Clone this wiki locally