Displaying 1 result from an estimated 1 matches for "return_sd".
Did you mean:
return_md
2012 Sep 26
1
Change in order of names after applying "plyr" package
...ction(security_id, ason_date, security_rate)
{
security_rate_returns <- NULL
for (i
in(1:length(ason_date)-1))
{
security_rate_returns[i] = log(security_rate[i]/security_rate[i+1])
}
return_mean = mean(security_rate_returns)
return_sd = sd(security_rate_returns)
simulation = rnorm(n, return_mean, return_sd)
qq = sort(simulation, decreasing = TRUE)
VaR_mc = -qq[alpha * n]*sqrt(t)
return(VaR_mc)
}
result_method_other <- dlply(.data = equity_data, .variables = "security_id", .f...