I have problems with setting up multivariate time series data in R. My data set looks good when I import it to R with command, and it includes date and some variables:
data = read.table("dataset.txt", header=TRUE)
When I try to get my variables out for VAR-estimations, I use following:
variable1 = ts(data$variable1, start = c(1999,2), frequency = 12)
variable2 = ts(data$variable2, start = c(1999,2), frequency = 12)
However, the object variable1
is different from data$variable1
. Could someone help me with this?
My intention is to bind variables like
y = window(cbind(variable1, variable2), start=c(1999,3))
and then move on with VAR estimations, but I don't get this far as variables are not what they are supposed to be.
Edit: For example: data$variable1
gives the right values for variable1
but after ts(data$variable1)
gives something that has nothing to do with my data
Sample of data:
indpro_us indpro_ea
1.2.1999 4,511755808 4,548599834
1.3.1999 4,513438595 4,561218298
1.4.1999 4,515985904 4,564348191
1.5.1999 4,523444813 4,564348191
1.6.1999 4,521834228 4,572646994
1.7.1999 4,52803965 4,578826211
1.8.1999 4,532080003 4,579852378
1.9.1999 4,528239464 4,584967479
1.10.1999 4,541301307 4,593097605
1.11.1999 4,54604313 4,597138014
1.12.1999 4,553642127 4,591071262
1.1.2000 4,553733723 4,59511985`
command:
indpro_us = ts(data$indpro_us, start = c(1999, 2), frequency = 12)
"indpro_us" doesn't give me that data.