prais.winsten的工作方式会导致观星者和扫帚(r) [英] how to work with prais.winsten results in stargazer and broom (r)

查看:107
本文介绍了prais.winsten的工作方式会导致观星者和扫帚(r)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

软件包"prais" 包含函数 prais.winsten ,用于使用Prais Winsten估计器运行回归模型.但是, stargazer broom 软件包似乎都不能与 prais.winsten 函数的结果一起使用.

The package "prais" contains the function prais.winsten to run a regression models with Prais Winsten estimator. However, neither stargazer nor broom packages seem to work with the results from the prais.winsten function.

拟合表格的模型后

pw<- prais.winsten(speed ~ dist, cars)

当我尝试使用stargazer报告结果时,出现以下错误:

When I try to report the results with stargazer I get the following error:

stargazer(pw, out = "pw.html") 
Error: $ operator is invalid for atomic vectors

并同样使用我得到的 broom 包整理模型

and likewise tidying the model with the broom package I get

tidy(pw)
Error in names(object) <- nm : 
  'names' attribute [1] must be the same length as the vector [0]

是否可以使用 prais.wisten 结果在 stargazer broom 中使用结果?

Is there any way to work with prais.wisten results in stargazer and broom?

或者,是否可以在 glm 中运行Prais Winsten估算器?

Or alternatively, is there any way to run a Prais Winsten estimator in glm?

推荐答案

最简单的方法是编辑Prais.Winsten函数以返回lm对象.

The easiest way to do this is to edit the Prais.Winsten function to return an lm object.

getAnywhere(prais.winsten())将返回该函数.然后,您可以将代码复制到脚本中,只需将return函数从"results"更改为"lm".

getAnywhere(prais.winsten())will return the function. You can then copy the code into your script and just change return function from "results" to "lm".

这篇关于prais.winsten的工作方式会导致观星者和扫帚(r)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆