added example to construct X matrix (is this what Dan really wants) and added necessary packages to associated scripts