This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shreyes <- function(temp) ## Cute function that returns the number of iterations that were preformed. | |
{ c <- 0 | |
while(temp > 1) | |
{ if(temp%%2==0) temp <- temp/2 else temp <- 3*temp + 1 | |
c <- c+1 | |
} | |
return(c) | |
} | |
largest <- 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem 14: | |
The following iterative sequence is defined for the set of positive integers: | |
n n/2 (n is even) | |
n 3n + 1 (n is odd) | |
Using the rule above and starting with 13, we generate the following sequence: | |
13 40 20 10 5 16 8 4 2 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################### | |
## Access the relevant files ## | |
############################### | |
returns <- read.csv("Returns_CNX_500.csv") | |
returns1 <- returns | |
nifty <- read.csv("Nifty_returns.csv") | |
mibor <- read.csv("MIBOR.csv", na.strings="#N/A") | |
exchange <- read.csv("Exchange_rates.csv", na.strings="#N/A") | |
################################################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################### | |
## Access the relevant files ## | |
############################### | |
returns <- read.csv("Returns_CNX_500.csv") | |
returns1 <- returns | |
nifty <- read.csv("Nifty_returns.csv") | |
mibor <- read.csv("MIBOR.csv", na.strings="#N/A") | |
exchange <- read.csv("Exchange_rates.csv", na.strings="#N/A") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Similarly for APT the mathematical form is: | |
\begin{eqnarray*} | |
R_i &=& a_j + \beta_{j1} F_1 + \beta_{j2} F_2 + \dots + \beta_{jn} F_n + \epsilon_j \\ | |
a_j &:& \mbox {constant for asset `j'}\\ | |
F_k &:& \mbox{ are systemic factors}\\ | |
\beta_{jk} &:& \mbox{ is the sensitivity of $j^{th}$ asset to factor `k'}\\ | |
\epsilon_j &:& \mbox{risky asset's idiosyncratic random shock with mean zero} | |
\end{eqnarray*} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Set the working directory using setwd() ## | |
# Reading the relevant file. | |
infy <- read.csv("01-10-2010-TO-01-10-2011INFYEQN.csv") | |
# Plotting the past one years closing price of INFY | |
plot(as.Date(infy$Date, "%d-%b-%y"), infy$Close.Price, xlab= "Dates", ylab= "Adjusted closing price", type='l', col='red', main="Adjusted closing price of INFOSYS for past 1 year") |
NewerOlder