Reputation: 3629
I'm estimating models in R using the frontier
package and I need to export the results into Latex. The output is quite similar to a lm
regression [see below] but frontier
objects are not supported by stargazer
to export them into Latex
code. Is there any way to work around this? Any idea?
*I am also looking into texreg
and apsrtable
, so far unsuccessfully.
Example of frontier
regression output:
Upvotes: 2
Views: 1605
Reputation: 17279
I don't know much about getting stargazer
to output unsupported models, but you can use atidy
method from the broom package to get the basic output into a format compatible with xtable
, knitr::kable
, or pixiedust
library(broom)
library(frontier)
# example included in FRONTIER 4.1 (cross-section data)
data( front41Data )
# Cobb-Douglas production frontier
cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ),
data = front41Data )
tidy(cobbDouglas, conf.int = TRUE)
broom:::tidy.lm(cobbDouglas)
term estimate std.error statistic p.value
1 (Intercept) 0.5616193 0.20261685 2.771829 5.574228e-03
2 log(capital) 0.2811022 0.04764337 5.900132 3.632107e-09
3 log(labour) 0.5364798 0.04525156 11.855499 2.015196e-32
4 sigmaSq 0.2170003 0.06390907 3.395454 6.851493e-04
5 gamma 0.7972069 0.13642438 5.843581 5.109042e-09
For the summary statistics, you would need to write your own glance
method, as the frontier
objects aren't compatible with broom:::glance.lm
.
But I think the end story is that, if you want to mimic the stargazer output, you'll have to do some preprocessing work.
And since I'm feeling ambitious today, here's a tidy
method for frontier objects.
tidy.frontier <- function(x, conf.int = FALSE, conf.level = .95,
exponentiate = FALSE, quick = FALSE, ...)
{
broom:::tidy.lm(x, conf.int = conf.int, conf.level = conf.level,
exponentiate = exponentiate, quick = quick, ...)
}
# example included in FRONTIER 4.1 (cross-section data)
data( front41Data )
# Cobb-Douglas production frontier
cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ),
data = front41Data )
tidy(cobbDouglas, conf.int = TRUE)
Upvotes: 2