When I use firthlogit command for binary variables, I get a message- string variable not allowed. How do I use Firth/penalized regression in STATA for categorical variables?
-
Login or Register
- Log in with
help encode
firthlogit response i.predictor
* Example generated by -dataex-. To install: ssc install dataex clear input long(response predictor1 predictor2 predictor3 predictor4 predictor5 predictor6 predictor7 predictor8 predictor9 predictor10 predictor11) 2 1 1 2 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 2 1 2 2 2 2 2 1 1 2 2 2 2 2 2 2 1 2 2 1 2 1 1 1 2 1 2 1 1 2 2 1 2 2 2 2 2 2 2 2 1 2 2 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 2 2 1 2 1 1 2 2 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1 2 2 2 2 1 1 1 2 1 2 2 1 2 2 1 2 2 1 2 2 1 1 2 2 2 2 2 2 1 1 1 2 1 2 2 1 2 2 2 2 1 1 1 2 1 2 2 2 2 2 1 2 1 1 1 2 1 2 2 1 2 1 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 2 2 2 1 2 2 1 2 1 1 1 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 2 2 2 2 2 1 2 1 2 1 2 2 1 2 2 2 2 1 1 1 2 1 1 2 1 1 2 2 2 1 1 1 2 2 1 2 2 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 2 1 2 1 2 1 2 2 2 2 2 1 2 1 1 1 2 1 1 2 1 2 2 2 2 1 1 1 2 1 1 2 1 1 2 2 2 1 1 1 2 1 2 2 2 2 2 1 2 1 1 1 2 1 1 2 2 2 2 2 2 1 1 2 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 2 2 1 2 2 2 1 1 1 2 1 2 2 2 2 2 1 2 1 2 2 2 1 2 2 2 2 2 2 2 1 1 1 2 1 2 2 1 1 2 1 2 2 1 2 1 1 1 2 1 1 2 2 2 2 2 2 1 1 2 2 1 2 2 2 2 2 1 1 1 1 2 2 2 2 2 1 2 1 1 2 1 1 2 2 1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 1 2 2 2 2 2 1 2 1 1 2 2 1 1 2 1 2 2 2 2 1 2 2 1 1 2 1 1 2 2 1 2 1 2 2 1 1 2 1 1 2 2 1 2 1 1 2 1 1 1 2 2 2 2 2 2 1 2 2 1 1 2 1 1 2 2 1 2 1 2 2 1 1 2 1 1 2 2 1 2 1 1 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2 1 2 2 2 2 2 2 1 1 2 2 1 2 1 1 2 1 1 2 1 1 2 2 1 2 2 1 2 1 2 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2 2 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 2 1 1 2 1 1 2 2 1 2 1 1 2 1 1 2 1 2 2 2 1 2 2 2 2 2 2 1 2 1 2 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 2 2 2 2 2 1 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 2 end label values response response label def response 1 "1", modify label def response 2 "2", modify label values predictor1 predictor1 label def predictor1 1 "0", modify label def predictor1 2 "1", modify label values predictor2 predictor2 label def predictor2 1 "1", modify label def predictor2 2 "2", modify label values predictor3 predictor3 label def predictor3 1 "1", modify label def predictor3 2 "2", modify label values predictor4 predictor4 label def predictor4 1 "1", modify label def predictor4 2 "2", modify label values predictor5 predictor5 label def predictor5 1 "1", modify label def predictor5 2 "2", modify label values predictor6 predictor6 label def predictor6 1 "1", modify label def predictor6 2 "2", modify label values predictor7 predictor7 label def predictor7 1 "1", modify label def predictor7 2 "2", modify label values predictor8 predictor8 label def predictor8 1 "1", modify label def predictor8 2 "2", modify label values predictor9 predictor9 label def predictor9 1 "1", modify label def predictor9 2 "2", modify label values predictor10 predictor10 label def predictor10 1 "1", modify label def predictor10 2 "2", modify label values predictor11 predictor11 label def predictor11 1 "1", modify label def predictor11 2 "2", modify
help factor variables
generate byte response2 = response == 2 firthlogit response2 i.(predictor*), nolog
Comment