i want to create model logistic regression with both random effect and fix effect
- User
i want to create model logistic regression with both random effect and fix effect
- Assistant
- User
can you use python
- Assistant
- User
import statsmodels.api as sm import statsmodels.formula.api as smf
Assuming 'data' is your DataFrame with 'CompanyID' as the grouping variable
and 'SCAC-AAER-REFINITIV' as the binary dependent variable
Fixed Effects Model
fixed_effects_model = smf.mixedlm("SCAC_AAER_REFINITIV ~ FIN_Diff_HA_AVG_dummy + Control_Variables", data=data, groups=data['CompanyID']) fixed_effects_result = fixed_effects_model.fit() print(fixed_effects_result.summary())
Random Effects Model
random_effects_model = smf.mixedlm("SCAC_AAER_REFINITIV ~ FIN_Diff_HA_AVG_dummy + Control_Variables", data=data, groups=data['CompanyID']) random_effects_result = random_effects_model.fit() print(random_effects_result.summary())
- Assistant
- User
THIS IS PANEL DATA !
The Dependent Variable is: SCAC-AAER-REFINITIV
- This dependent variable is a binary variable (0 if there is no accounting fraud for company i at time t) ; but we have to note that there is excess zeros o So we need a regression to take that into account: should we use the logistic regression? Logit ? Probit ? Zero-inflated ordered logit regression (the command is ziologit in STATA – I don’t know what it is in python)
The Control Variables are:
- Industry Variables (they are binary): a. EXTRACTIVE b. PROCESSING c. EQT-MANUFACTURING d. ELECTRIAL-AND-ELECTRONICS e. TEXTILES-AND-APPAREL f. CONSUMABLES g. OTHER-MANUFACTRING h. TRADE
- Potential Slack: (continuous) a. Debt-to-Equity
- Temporal Effects: (binary) a. Year_2017 b. Year_2018 c. Year_2019 d. Year_2020 e. Year_2021
- CEO Variables: a. Duality (binary) b. CEO-Age (continuous) c. Tenure (continuous) d. CEO-Gender-Dummy (binary)
- Assistant