[R] YourCast Data Format
Thomas Jensen
thomas.jensen at eup.gess.ethz.ch
Sat Jan 8 15:39:02 CET 2011
Dear R-List,
I have data that is collected in panels like this (output from the
dput() function, the first 20 observations in the data set):
structure(list(Country = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label =
c("Belgium",
"Denmark", "Czech.Republic", "Germany", "Estonia", "Greece",
"Spain", "France", "Ireland", "Italy", "Cyprus", "Latvia", "Lithuania",
"Luxembourg", "Hungary", "Malta", "Netherlands", "Austria", "Poland",
"Portugal", "Slovenia", "Slovakia", "Bulgaria", "Romania", "Finland",
"Sweden", "UK"), class = "factor"), Year = c(2003, 2003, 2003,
2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004,
2004, 2004, 2004, 2004, 2004, 2004), Month = c(1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8), Yes = c(21L,
18L, 20L, 19L, 31L, 39L, 28L, 2L, 28L, 21L, 26L, 50L, 14L, 28L,
50L, 83L, 10L, 25L, 22L, 6L), No = c(0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L, 0L, 0L, 0L, 0L), Abstention =
c(0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 3L, 0L,
0L, 0L, 0L), No.Neg = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Abstention.Neg = c(0L,
0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L,
0L, 0L, 0L), Yes.Neg = c(1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L,
0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L), Yes.Pos = c(0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), Missing = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Enlargement = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)), .Names =
c("Country",
"Year", "Month", "Yes", "No", "Abstention", "No.Neg", "Abstention.Neg",
"Yes.Neg", "Yes.Pos", "Missing", "Enlargement"), row.names = c(NA,
20L), class = "data.frame")
The data set has in total 27 countries for the years 1999 to 2008, but
with unbalanced panels.
I want to be able to estimate a model and do forecasting for each
country in the data set. I have been looking into the YourCast package
from King et al. but since I have all my data in a single file, I am
at a loss as to how to create a data object that the yourcast()
function will accept. Does anyone know how to do this without going
through the tedious procedure of manually splitting the data file up
into the different cross sections?
Best, Thomas
More information about the R-help
mailing list