简体   繁体   中英

Regression Model in R

I want to run a regression model on a dichotomous variable in R. For example, in my data I have a variable that illustrates state failure, "1"= state failure "2" = no state failure. My dependent variable is the number of newly formed terrorist groups per country year coded from 0-11. How would I go about running a regression with the state failure variable? Would I have to create dummy variables if my data is already coded numerically, if so what would be the code to do this? Anything will help, thank you.

You don't need to create dummy variables. Your outcome variable is ordinal, but with 12 possible values, this is often simply treated as numeric, so I would start with lm(outcome ~ var) and inspect the residuals to assess whether this is a reasonable treatment. An alternative would be ordinal regression, such as MASS::polr()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM