SHARE
TWEET

Untitled

a guest Jul 17th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stockreturns22=data.frame(ret22=(data22)[,4],
  2.                           timestamps=(data22)[,2],format="%Y/%m/%d")
  3. stockreturns22.ts= xts(stockreturns22$ret22,
  4. order.by=as.Date(stockreturns22$timestamps))
  5. rt22=ts(stockreturns22$ret22)
  6. tt22=length(rt22)
  7. lm22=lm(rt22[-1]~rt22[-tt22]+rt22[-tt22]:I(rt22[-tt22]<0))
  8. summary(lm22)
  9.  
  10. tauseq=c(0.02,0.1,0.2,0.5,0.8,0.9,0.98)
  11. qslope22=NULL; qr22=list()
  12. qqslope22=NULL;
  13. for(i in 1:length(tauseq)){
  14.  
  15. qr22[[i]]=rq(rt22[-1]~rt22[-tt22]+rt22[-tt22]:I(rt22[-tt22]
  16. <0),tau=tauseq[i])
  17. forecast(qr22)
  18. qslope22[i]=qr22[[i]]$coef[2]
  19. qqslope22[i]=qr22[[i]]$coef[3]
  20. }
  21.    
  22. Coefficients: (1 not defined because of singularities)
  23.                                      Estimate Std. Error t value Pr(>|t|)    
  24.  
  25. (Intercept)                         504.65017   14.84839   33.99   <2e-16
  26. ***
  27. rt22[-tt22]                           0.34867    0.01603   21.75   <2e-16
  28. ***    
  29. rt22[-tt22]:I(rt22[-tt22] <= 0)TRUE        NA         NA      NA       NA    
  30.  
  31. ---
  32. Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  33.    
  34. Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
RAW Paste Data
Top