1
I am working with a dashboard database that contains information about publicly traded companies from BOVESPA. Below follows a piece of this database:
My dependent variable is binary (ROIC.MEDIANA) so I started my estimation via logistic panel. As my data is not normal, I opted for a LOGIT estimation.
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 rotate the function glm
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. Researching how to get around the problem I discovered the work of Firth (1993) who makes the same kind of estimation fixing the problem. In R I discovered 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 mistake or Warning is generated and I can see the results of the model.
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")
Generates a Warning, but I can see the results of the model:
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. From what I researched I could not find differences between the two packages that justify the outputs produced by each of them.
As to the Warning relative to brglm, no matter how much I change the function parameters brglm.control
, I keep getting the same Warning and the same estimation results.
Include the tag
R
in your question.RStudio
is just an interface– Rafael Cunha