Displaying 1 result from an estimated 1 matches for "price_returns".
2012 Jan 11
1
Constructing a data.frame from csv files
...-Dec-11","30-Dec-11","29-Dec-11","28-Dec-11"), price = c(11.9,10.5,13,14.5,14.4,14.8,10.1,12,14.3, 10.7,11.2,10.2,10.2,10.8,41.9,40.5,43,44.5,44.4,48.8,42.1,44,46.3,48.7,46.2,44.2,42.2,40.8))
attach(mydata)
opt_return_volatilty = function(price, instru_name)
{
price_returns = matrix(data = NA, nrow = (length(price)-1), ncol = 1)
for (i in(1:(length(price)-1)))
{
price_returns[i] = log(price[i]/price[i+1])
}
volatility = sd(price_returns)
entity_returns = unique(instru_name)
colnames(price_returns) = entity_returns
write.csv(price_returns, file = paste...