0

laglaw only takes on 0 or 1. My categorical variables suffixed with TRUE were created using the syntax YX$jan <- seatbelt$month[t]==1 and if I call them with YX$jan they return a dataframe of TRUE or FALSE. Are these being treated differently than my laglaw categorical variable containing 0's and 1's?

If laglaw is not being treated as a categorical variable 1)what information does it provide in this form that's different from if it were categorical? 2)how can I make it categorical?

enter image description here

Info5ek
  • 1,227
  • 4
  • 17
  • 25
  • 1
    it is the same. use `factor(laglaw)` if you care, but in this case it does not matter – rawr Mar 21 '14 at 00:58
  • 1
    Is there a reason you posted as a comment and not an answer? – Info5ek Mar 21 '14 at 00:59
  • Even a small portion of the data set (i.e. a [minimal reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) would be helpful if you are looking for R help, otherwise the [cross validated](http://stats.stackexchange.com/) might be a better place for this. – hrbrmstr Mar 21 '14 at 00:59
  • 1
    Can you explain why you, and some others, post answers as comments instead of answers? thanks. – Info5ek Mar 21 '14 at 01:12

1 Answers1

1

Your categorical variables were NOT suffixed with TRUE. Only the labels for the coefficients were displayed with the variable name followed by the level values to which they applied. In the case of numeric variables there is no such labeling. The interpretation would be the same in this case but if laglaw had values 0,1,2 you would still not see the sort of level specfic estimates but rather estimates that were for a one unit increase in the variable value. To make numeric variables factor variables you use the function .... wait for it .... factor.

Furthermore YX$jan does NOT retrun a data.frame but rather a vector.

IRTFM
  • 258,963
  • 21
  • 364
  • 487