Efficient creation of regression design matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg82235] Efficient creation of regression design matrix
- From: "Coleman, Mark" <Mark.Coleman at LibertyMutual.com>
- Date: Tue, 16 Oct 2007 03:20:21 -0400 (EDT)
Hi, I'm searching for an efficient bit of code to create a design matrix of 1's and 0's computed from categorical (non-numeric) variables, suitable for use in regression problems. More precisely, imagine one has an n x 1 vector of k different non-numeric values. For argument sakes, let k={Red,Blue,Green,Yellow}. I would like to create an n x k matrix consisting of 1's and 0's, where a '1' appears in the row and column location corresponding to the presence of an element of k. For example, say the original data is Red Blue Blue Yellow Red Green
- Follow-Ups:
- Re: Efficient creation of regression design matrix
- From: Darren Glosemeyer <darreng@wolfram.com>
- Re: Efficient creation of regression design matrix
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Efficient creation of regression design matrix