Dear Sirs, I was hoping you can help me, I am quite desperate in finding a solution for my problem! I have looked everywhere on the net and tried hundreds of codes, but I am still not anywhere close to the solution. I am quite new to R, so please excuse if this seems simple:
I am trying to use R to analyse some stocks, but I can't get the theoretical confidence interval (95%) for my sample: e.g. IBM: library('tseries') data<-get.hist.quote(instrument="IBM", start="2000-01-01", end="2010-10-04", quote=c("O","H","L","C","A","V"), compression='d',provider="yahoo", retclass="zoo") names(IBM) I have defined the parameters as follows: Pt=IBM$Adj.Close r=diff(log(Pt)) l=length(Pt) mu=mean(r) t=2:l Given the formula for confidence intervals E(logPt)=logP0+μ*t +1.96*sqrt(t)*s^2, I tried to define a formula in R: logP1=numeric() > logP1[1]=log(Pt[1]) > logP1[2:l]=logP1[1]+cumsum(logP1+mu*t+c(-1.96,1.96)*sqrt(t)*sd(Pt)) > P1=exp(logP1) However, although I don't receive an error message, I cannot show the result! Many thanks in advance for your assistance with this! Yours sincerely Christian [[alternative HTML version deleted]]
______________________________________________ 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.