I am working with a panel database that contains information on publicly traded companies on the BOVESPA. Here is a piece of this database:
Mydependentvariableisbinary(ROIC.MEDIANA)soIstartedmyestimationvialogisticpanel.Sincemydataisnotnormal,IoptedforaLOGITestimation.
setwd("C:/Dados/BOVESPA")
getwd()
require("openxlsx")
dadosbov <- read.xlsx ("BOVESPA.xlsx") # Importando os dados.
dadosbov <- na.omit(dadosbov) # Omitindo NA's.
dadosbov <- as.data.frame(dadosbov)
attach(dadosbov)
View(dadosbov)
Next I decided to run the glm
function to estimate the data:
reg1 = glm(ROIC.MEDIANA ~ ECV + MARGEM.EBIT + GIRO.ATIVO +
ALAVANCAGEM.FINANCEIRA + CICLO.FINANCEIRO + CICLO.OPERACIONAL + HHIE + HHIS
+ CRISE, family=binomial(link="logit"), data=dadosbov)
What returned a warning:
Warning message: glm.fit: fitted probabilities numerically 0 or 1 occurred
The model is estimated, but the coefficients are wrong due to the statistical problem of separation in logistic regression. Searching about how to get around the problem I found the work of Firth (1993) that makes the same kind of estimation correcting the problem. In R, I found two packages that perform the corrected estimation: logistf
and brglm
:
require("logistf")
reg2 = logistf(ROIC.MEDIANA ~ ECV + MARGEM.EBIT + GIRO.ATIVO +
ALAVANCAGEM.FINANCEIRA + CICLO.FINANCEIRO + CICLO.OPERACIONAL + HHIE + HHIS
+ CRISE, data=dadosbov)
No error or warning is generated and I can see the results of the template.
require("brglm")
reg3 = brglm(ROIC.MEDIANA ~ ECV + MARGEM.EBIT + GIRO.ATIVO +
ALAVANCAGEM.FINANCEIRA + CICLO.FINANCEIRO + CICLO.OPERACIONAL + HHIE + HHIS
+ CRISE, family = binomial(logit), data=dadosbov, method = "brglm.fit")
Generate a warning , but I can see the results of the template:
Warning message: In fit.proc (x = X, y = Y, weights = weights, start = start, etastart = etastart ,: Iteration limit reached
My question is: What is the difference between the two packages? The generated estimates differ in relation to the generated coefficients. For what I researched I could not find differences between the two packages that justify the outputs produced by each of them.
Regarding the warning regarding brglm, no matter how much I change the parameters of the brglm.control
function, I still get the same warning and the same results from the estimation.