On Tue, 19 May 2009, Stephen J. Barr wrote:

Ah, thank you for the help, and for the explanation of what is going
on. I suppose I will have to reload my data with plm.data set such
that RATE is not a factor.

plmWithDensity$RATE <- as.numeric(as.character(plmWithDensity$RATE))

should suffice.

For my time index, will
2000,2000.25,2000.5, etc. work? Meaning 2000 quarter 1, 2000 quarter
2, etc? Or is there some special way that I need to format the time?

That's ok. Internally, plm.data always stores it as a factor anyway.

Best,
Z

Thanks,
-stephen
==========================================
Stephen J. Barr
University of Washington
WEB: www.econsteve.com
==========================================



On Tue, May 19, 2009 at 4:39 PM, Achim Zeileis
<achim.zeil...@wu-wien.ac.at> wrote:
On Tue, 19 May 2009, Stephen J. Barr wrote:

Hello,

I am working on a data set (already as a plm.data object) located
here: http://econsteve.com/arch/plmWithDensity.Robj

With the following R session:
library(plm)
...
load("plmWithDensity.Robj")
model <- plm(RATE ~ density08, data=plmWithDensity)
Error: subscript out of bounds

I am not understanding the "subscript out of bounds" error, as this is

I agree that the error is not very meaningful but the problem is due to your
data: density08 does not vary within your id variable (COURT), hence the
default within model cannot be estimated. And it is also the reason why
density08 gets no coefficient in a larger model.

Also note that your RATE variable is a factor...I'm pretty certain you want
a numeric variable here!

Yves & Giovanni: What happens in the code is that the model.matrix() method
silently omits the column from the regressor matrix. Hence, this goes
unnoticed in the larger model and results in a regressor matrix without any
columns in the case above. Thus, the subscript error.

hth,
Z





______________________________________________
R-help@r-project.org 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.

Reply via email to