Re: [R] Help with factor levels and reference level

2014-06-07 Thread Jim Lemon
On Fri, 6 Jun 2014 11:16:11 AM Nwinters wrote: > I have a variable coded in Stata as follows: > ** > *gen sat_pm25cat_=. > replace sat_pm25cat_= 1 if (sat_pm25>=4 & sat_pm25<=7.1 & sat_pm25!=.) > replace sat_pm25cat_= 2 if (sat_pm25>=7.1 & sat_pm25<=10) > replace sat_pm25cat_= 3 if (sat_pm25>=10.1

Re: [R] Help with factor levels and reference level

2014-06-06 Thread Bert Gunter
... But I think the OP should consult his/her local statistician and not do this. 1. Categorizing a continuous variable generally loses information. While there may be times when this may be appropriate, generally continuous variables should be modeled as such. 2. You also lose the ordering with

Re: [R] Help with factor levels and reference level

2014-06-06 Thread David Winsemius
On Jun 6, 2014, at 11:16 AM, Nwinters wrote: > I have a variable coded in Stata as follows: > ** > *gen sat_pm25cat_=. > replace sat_pm25cat_= 1 if (sat_pm25>=4 & sat_pm25<=7.1 & sat_pm25!=.) > replace sat_pm25cat_= 2 if (sat_pm25>=7.1 & sat_pm25<=10) > replace sat_pm25cat_= 3 if (sat_pm25>=10.1

[R] Help with factor levels and reference level

2014-06-06 Thread Nwinters
I have a variable coded in Stata as follows: ** *gen sat_pm25cat_=. replace sat_pm25cat_= 1 if (sat_pm25>=4 & sat_pm25<=7.1 & sat_pm25!=.) replace sat_pm25cat_= 2 if (sat_pm25>=7.1 & sat_pm25<=10) replace sat_pm25cat_= 3 if (sat_pm25>=10.1 & sat_pm25<=11.3) replace sat_pm25cat_= 4 if (sat_pm25>=11.