Re: [R] reference category for factor in regression

2009-01-19 Thread Berwin A Turlach
G'day Jos, On Mon, 19 Jan 2009 20:22:10 + Jos Elkink wrote: > Here is a little bit more R code to show the problem: Thanks for that, all becomes clear now. :) > > str(AGE) > Factor w/ 5 levels "65+","18-24",..: 5 5 1 4 5 5 2 4 1 3 ... > > table(LABOUR) > LABOUR >01 > 692 1409 >

Re: [R] reference category for factor in regression

2009-01-19 Thread Stephan Kolassa
Hi Jos, does explicitly recoding AGE help? AGE <- factor(c("65+","18-24","18-24","25-34")) str(AGE) AGE <- factor(c("65+","18-24","18-24","25-34"),levels=c("65+","18-24","25-34")) str(AGE) Best, Stephan Jos Elkink schrieb: Hi all, Thanks for the advice. See ?relevel for information on h

Re: [R] reference category for factor in regression

2009-01-19 Thread Jos Elkink
Hi all, Thanks for the advice. > See ?relevel for information on how to reorder the levels of a factor, > while being able to specify the reference level. > Basically, the first level of the factor is taken as the reference. Yes, that is how I always used it. But the problem is, in this particul

Re: [R] reference category for factor in regression

2009-01-19 Thread Marc Schwartz
Jos, See ?relevel for information on how to reorder the levels of a factor, while being able to specify the reference level. Basically, the first level of the factor is taken as the reference. If you want to utilize a different ordering, as an alternative to the above, simply use: AGE <- facto

Re: [R] reference category for factor in regression

2009-01-19 Thread Stephan Kolassa
Hi Jos, you can force R to set contrasts for factors the way you like them with contrasts(). You seem to be thinking of treatment contrasts, which are most easily interpreted, but there are also others. However: are you sure you want to bin an age variable into categories? You will lose powe

Re: [R] reference category for factor in regression

2009-01-19 Thread Berwin A Turlach
G'day Jos, On Mon, 19 Jan 2009 15:52:00 + Jos Elkink wrote: > Thanks for your quick answer. The problem is not so much the LABOUR > variable, however, but the AGE variable, which consists of about 5 > categories for which I do indeed not create separate dummy variables. > But R does not beha

Re: [R] reference category for factor in regression

2009-01-19 Thread Jos Elkink
Hi Thierry, Thanks for your quick answer. The problem is not so much the LABOUR variable, however, but the AGE variable, which consists of about 5 categories for which I do indeed not create separate dummy variables. But R does not behave as expected when deciding on which dummy to use as referenc

Re: [R] reference category for factor in regression

2009-01-19 Thread ONKELINX, Thierry
Dear Jos, In R you don't need to create you own dummy variables. Just create a factor variable LABOUR (with two levels) and rerun your model. Then you should be able to calculate all coefficients. HTH, Thierry ir. Thi