Plot a plm model in R
Asked Answered
D

1

4

I have a large panel which I am estimating via plm with fixed effects.

For example

Test.fe <- plm( Y ~ x1+x2, data=test, model="within")

I used summary(Test.fe) to print the estimating results and to get the fixed effects, it is possible to use fixef.

But now my question: How can I plot the estimated Y values to compare with my real Y values?

Thanks.

Dossal answered 16/9, 2011 at 15:13 Comment(3)
Potential duplicate (asking about fitted values from plm).Milda
You could avoid having this be a duplicate by extracting a portion of your data and posting using dput() to create a working example. I will remove my vote to close if you do that.Tincture
A simple way to get the fitted values fitted.panelmodel <- plm(object, ...) object$model[[1]] - object$residuals There is currently no better method for that.Dossal
D
2

A simple way to get the fitted values

 fitted.panelmodel <- plm(object, ...)
 object$model[[1]] - object$residuals

There is currently no better method for that.

Dossal answered 17/9, 2011 at 18:58 Comment(2)
Add this to your question, not as an answer.Carolincarolina
I think this answer is too terse to be really useful: object will not contain 'object$residuals' unless they are assigned from 'fitted.panelmodel'Friulian

© 2022 - 2024 — McMap. All rights reserved.