[R] problem with the plm package (2)
Spencer Graves
spencer.graves at pdf.com
Thu Nov 30 05:53:23 CET 2006
I haven't seen any replies to this, so I will offer some
suggestions even though I'm not familiar with 'plm'.
1. The standard formula syntax in S-Plus and R is that "y ~ x" is
a request to estimate b0 and b1 in y = b0+b1*x+error. Since this
already includes "1", it is essentially equivalent to "y~1+x". To
estimate a noconstant model, use something like "y~x-1".
2. Have you tried an email directly to the official "plm"
maintainer? An email address for this can be found using
help(package="plm").
3. Panel data is a special case of mixed effects data. The best
software I know for that the 'nlme' package, which is part of the
standard R distribution. The best book on the subject that I know is
Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus
(Springer). The "~R\library\nlme\scripts" subdirectory of your R
installation directory contains files with names like "ch01.R",
"ch02.R", etc. These provide R scripts for producing the analyses in
the book. You can make local copies of these scripts and work through
them line by line, trying different things, etc. The R syntax is
slightly different from that in the book, e.g., x^2 in a formula must be
specified as I(x^2). These differences are overall very minor and easy
to learn. However, using exactly what appears in the book without
modification will in a few cases be misinterpreted, leading to very
different results. I had a difficult time understanding what was
happening until I found this.
Hope this helps.
Spencer Graves
Giangiacomo Bravo wrote:
> Thanks a lot for the quick answerd I received and that helped me to
> solve my first (simple) problem with the plm package.
>
> Unfortunatley, here's another one:
> I do not know why, but I'm unable to estimate a simple model in the
> form y ~ 1 + x
>
> When I try
> > zz <- plm(y ~ 1 + x , data=mydata)
> I obtain
> Errore in X.m[, coef.within, drop = F] : numero di dimensioni errato
> which means that the number of dimensions is wrong in X.m[,
> coef.within, drop = F].
>
> However, I have no problem to estimate a more complex model, e.g.
> > zz <- plm(y ~ 1 + x + I(x^2), data=mydata)
> in this case everything is ok.
>
> What's wrong?
>
> Thank you,
> Giangiacomo
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list