**From:** Patrik Waldmann (*Patrik.Waldmann@genfys.slu.se*)

**Date:** Thu 13 May 2004 - 02:34:19 EST

**Next message:**Gabor Grothendieck: "Re: [R] Design matrix not identity"**Previous message:**Gabor Grothendieck: "Re: [R] How to know the row number of raw matrix after resampling?"**Next in thread:**Gabor Grothendieck: "Re: [R] Design matrix not identity"**Reply:**Gabor Grothendieck: "Re: [R] Design matrix not identity"**Reply:**Peter Dalgaard: "Re: [R] Design matrix not identity"**Reply:**Sundar Dorai-Raj: "Re: [R] Design matrix not identity"**Maybe reply:**Liaw, Andy: "RE: [R] Design matrix not identity"**Reply:**Prof Brian Ripley: "Re: [R] Design matrix not identity"**Reply:**John Fox: "RE: [R] Design matrix not identity"

Message-id: <9BE977B02923D311AADA00105AF497830365BFED@tilia.slu.se>

Hello again,

I was too quick before. What I was looking for was a function that

constructs the design (or incidence) matrix (X in a linear model) from a

factor. Uwe Ligges suggested using model.matrix and this does almost what I

want, but it is first necessary to construct a data variable. It also asigns

ones to all rows of the first column (because this is set to be the

contrast, not really what I want - see below). Maybe time for a function

that just converts a factor into a design matrix?

I have a factor

factor<-as.factor(c(1,1,2,2,3,3,3))

and I want a matrix

1 0 0

1 0 0

0 1 0

0 1 0

0 0 1

0 0 1

0 0 1

Patrik Waldmann###########################################

This message has been scanned by F-Secure

Anti-Virus for Microsoft Exchange.

###########################################

______________________________________________

R-help@stat.math.ethz.ch mailing list

https://www.stat.math.ethz.ch/mailman/listinfo/r-help

PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

**Next message:**Gabor Grothendieck: "Re: [R] Design matrix not identity"**Previous message:**Gabor Grothendieck: "Re: [R] How to know the row number of raw matrix after resampling?"**Next in thread:**Gabor Grothendieck: "Re: [R] Design matrix not identity"**Reply:**Gabor Grothendieck: "Re: [R] Design matrix not identity"**Reply:**Peter Dalgaard: "Re: [R] Design matrix not identity"**Reply:**Sundar Dorai-Raj: "Re: [R] Design matrix not identity"**Maybe reply:**Liaw, Andy: "RE: [R] Design matrix not identity"**Reply:**Prof Brian Ripley: "Re: [R] Design matrix not identity"**Reply:**John Fox: "RE: [R] Design matrix not identity"

*
This archive was generated by hypermail 2.1.3
: Mon 31 May 2004 - 23:05:09 EST
*