Stargazer for ARDL package's output: 'Error: Unrecognized object type'

守給你的承諾、 提交于 2021-01-28 11:25:35

问题


So ARDL package in R implements dynlm which is an accepted input in stargazer as per this question and answer.

However, I am unable to get stargazer table from ardl or auto_ardl. It throws the unrecognized object type error. Is there a way out of this?

Here's a reproducible example:

set.seed(10)
library(ARDL)
library(stargazer)
x=rnorm(100,mean = 5,sd=2)
y=rnorm(100,mean = 7,sd=3)
df=cbind(x,y)
model1=auto_ardl(y~x,data = df,max_order = 4)

class(model1)
[1] "list"
stargazer(model1)

% Error: Unrecognized object type.

class(model1$best_model)
[1] "dynlm" "lm"    "ardl" 
stargazer(model1$best_model)

% Error: Unrecognized object type.

回答1:


I'm sorry I don't know how to do this in stargazer, but this model type is supported out-of-the box by the latest version of the modelsummary package (disclaimer: I am the maintainer).

set.seed(10)

library(ARDL)
library(modelsummary)

x=rnorm(100,mean = 5,sd=2)
y=rnorm(100,mean = 7,sd=3)
df=cbind(x,y)
model1=auto_ardl(y~x,data = df,max_order = 4)

modelsummary(model1$best_model)
Model 1
(Intercept) 6.849
(1.705)
L(y, 1) 0.061
(0.106)
x -0.103
(0.166)
L(x, 1) -0.027
(0.167)
L(x, 2) -0.075
(0.166)
L(x, 3) 0.043
(0.167)
L(x, 4) 0.048
(0.169)
Num.Obs. 96
R2 0.013
R2 Adj. -0.054
AIC 492.8
BIC 513.3
Log.Lik. -238.398


来源:https://stackoverflow.com/questions/65677675/stargazer-for-ardl-packages-output-error-unrecognized-object-type

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!