David Granada Donato
David Granada Donato

Reputation: 23

How do I export results from Marginal effects on Latex using Bife

I'm estimating a fixed-effects logit model using the bife package in R. I need to estimate the marginal effects of the estimation and export them to latex. However, the package that supports bife estimation, texreg, doesn't allow to export objects of class "bifeAPEs". Is there any solution to this?

Here's a reproducible example:

#Require packages
packages<-c("bife", "texreg")
lapply(packages, require, character.only = TRUE)

#Dataset
data("iris")
iris$big <- ifelse(iris$Sepal.Length > median(iris$Sepal.Length),1,0)

#Model
output <- bife(big ~ Sepal.Width + Petal.Length | Species, data=iris, "logit")

#Output
apes_stat <- get_APEs(output)
class(apes_stat)
extract(output)
extract(apes_stat)

Upvotes: 1

Views: 274

Answers (1)

Shawn Brar
Shawn Brar

Reputation: 1420

Maybe what you can do is create a data.frame of the average partial effects and then convert that data.frame into a latex table using xtable, like below:-

ape_data <- data.frame(APES = attr(apes_stat$delta, "names"),
                       delta = unname(apes_stat$delta))
xtab_ape <- xtable::xtable(ape_data)
xtab_ape

If you don't want rownames to be printed in latex, then you can add the following command:-

print(xtab_ape, include.rownames = FALSE)

Upvotes: 0

Related Questions