I am calculating stock price series for 1 year and I used the following formula:
t<- file.choose ()
da<- read.csv(t,header=T)
pr<- da[,4]
r_pr<- diff(log(pr))
n_pr<- -r_pr
normalTest(n_pr, method= c("jb"))
adf.test (n_pr)
mean_pr <- mean(n_pr)
sd_pr <- sd(n_pr)
set.seed (1235689)
sim1 <- rnorm (100000, mean = mean_pr, sd = sd_pr)
vahs<- quantile(n_pr,0.99)
however now i need to calculate on a quarterly basis and it is quite difficult for me. Can someone help me break down the "pr" please?
And if I want to calculate in a data range from the first number to the 100th "pr" number, what should I do? thank