11.07.2015 Views

statisticalrethinkin..

statisticalrethinkin..

statisticalrethinkin..

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.4. CATEGORICAL VARIABLES 161$ weight: num 47.8 36.5 31.9 53 41.3 ...$ age : num 63 63 65 41 51 35 32 27 19 54 ...$ male : int 1 0 0 1 0 1 0 1 0 1 ...e male variable is our new predictor, an example of a DUMMY VARIABLE. Dummy variablesare devices for encoding categories into quantitative models. e purpose of the malevariable is to indicate when a person in the sample is male. So it takes the value 1 wheneverthe person is male, but it takes the value 0 when the person is female. It doesn’t matter whichcategory—“male” or “female”—is indicated by the 1. e model won’t care. But correctly interpretingthe model will demand that you remember, so it’s a good idea to name the variableaer the category assigned the 1 value.e effect of a dummy variable is to turn a parameter on for those cases in the category.Simultaneously, the variable turns the same parameter off for those cases in another category.is will make more sense, once you see it in the mathematical definition of the model. emodel to fit is:h i ∼ Normal(µ i , σ)µ i = α + β m m iα ∼ Normal(150, 100)β m ∼ Normal(0, 10)σ ∼ Uniform(0, 50)where h is height and m is the dummy variable indicating a male individual. e parameterβ m influences prediction only for those cases where m i = 1. When m i = 0, it has no effecton prediction, because it is multiplied by zero inside the linear model, α + β m m i , cancelingit out, whatever its value.To fit this model, use the usual format inside map:m5.13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!