3

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.

After fitting a model of the form

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

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

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]

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

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

jlp
  • 165
  • 1
  • 3
  • 12

1 Answers1

2

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

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".

  • That works, but how can I include the additional model statistics (i.e. Rho Rho.t.statistic and Iterations) into the stargazer table? – jlp Mar 05 '18 at 16:40
  • This solution doesn't work anymore with the new version `prais_winsten()`. – jlp Nov 29 '20 at 09:53