[R] R Help

Boyce, Morgan morgan.boyce at bankofamerica.com
Tue Oct 21 21:21:13 CEST 2008


Hi, I have the following code and am using R 2.7.2:

JIBqq  <- (Jqrt.IB[2:length(Jqrt.IB)]/Jqrt.IB[1:(length(Jqrt.IB)-1)])-1
	JIBqq <- cbind(zoo(JIBqq, Jqrt.time[2:length(Jqrt.time)]))
         y.JIBqq   <- merge(JIBqq,lag(JIBqq,-1))                      

> y.JIBqq
                  JIBqq lag(JIBqq, -1)
2004-06-30  0.003318909             NA
2004-09-30 -0.028536136    0.003318909
2004-12-31  0.011529924   -0.028536136
2005-03-31  0.066068689    0.011529924
2005-06-30  0.023462638    0.066068689
2005-09-30 -0.006443928    0.023462638
2005-12-31 -0.030541853   -0.006443928
2006-03-31 -0.057128956   -0.030541853
2006-06-30 -0.014534821   -0.057128956
2006-09-30 -0.030611132   -0.014534821
2006-12-31  0.020189061   -0.030611132
2007-03-31  0.009045381    0.020189061
2007-06-30  0.025034436    0.009045381
2007-09-30  0.032251184    0.025034436
2007-12-31  0.051555978    0.032251184
2008-03-31  0.001866808    0.051555978
2008-06-30  0.043680370    0.001866808
2008-09-30  0.031271730    0.043680370	

	y.JIBqq[,1][y.JIBqq[,1]> y.JIBqq[,2]]<-'up move'
	y.JIBqq[,1][y.JIBqq[,1]< y.JIBqq[,2]]<-'down move'

> y.JIBqq
           JIBqq               lag(JIBqq, -1)     
2004-06-30 0.00331890938117052 <NA>               
2004-09-30 down move           0.00331890938117052
2004-12-31 up move             -0.0285361360020099
2005-03-31 up move             0.0115299239240534 
2005-06-30 down move           0.0660686892790183 
2005-09-30 down move           0.0234626376481404 
2005-12-31 -0.0305418525579293 -0.0064439280623304
2006-03-31 -0.0571289557443185 -0.0305418525579293
2006-06-30 up move             -0.0571289557443185
2006-09-30 -0.0306111317173215 -0.0145348212173988
2006-12-31 up move             -0.0306111317173215
2007-03-31 down move           0.0201890614449696 
2007-06-30 up move             0.00904538134004018
2007-09-30 up move             0.0250344360146053 
2007-12-31 up move             0.0322511838232158 
2008-03-31 down move           0.0515559780138033 
2008-06-30 up move             0.00186680815107398
2008-09-30 down move           0.0436803703122548
	 
My question is why 2005-12-31, 2006-03-31, and 2006-09-30 do not take the assigned character? I have done this same procedure with several other data and have not run into this problem. Any help is appreciated.

Thanks,


Morgan K. Boyce
GPS - Quant Finance Analyst
Phone: 980-386-4074



More information about the R-help mailing list