MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Efficient creation of regression design matrix


Hello,

  the following simple one-liner does what you want (I believe)

Outer[S, n, m] /. S[a_, b_] /; a == b -> 1 /. S[__]->0

where "m" is your  vector of properties and "n" your data vector, e.g.

m = {r, b, g, y}

n = {r, b, b, y, y, g, g}

For S you can take anything you like.  If this code is particularly efficient I don't know...

Michael



  • Prev by Date: Re: Is this normal for Limit?
  • Next by Date: Re: Releasing several Holds simultaneously
  • Previous by thread: Re: Efficient creation of regression design matrix
  • Next by thread: Re: Efficient creation of regression design matrix