Preview

Bootstrap codes

Satisfactory Essays
Open Document
Open Document
338 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Bootstrap codes
data<-read.csv(file="Data.csv",header=TRUE,na.strings=c("")) head(data);tail(data) asindex<-data[,1:10] asret<- data[,c(1, 11:18)] k200rt<-data[,c(1,19)] unhedgert<-data[,c(1,20)] head(unhedgert) #Hedge portfolio ---QUESTION: THE HEDGE SHOULD BE DONE WITH THE PARAMETERS OF THE RETURNS OF EACH ASSETS OR FROM THE HEDGE PORT------
Expr<- sapply(asret,mean) #Calculating the expected return (Just the mean of the each of the assets) sdh<- sapply(asret,sd) #Calculating the Standard deviation. varh<-sapply(asret,var) covmat<-cov(asret) cormat<-cor(asret) ncol(asret) library(PerformanceAnalytics) library(tseries) library(quadprog) #Portfolio analysis. library("devtools") install_github("dengyishuo/fPortfolio") library(fPortfolio) #Hedge portfolio# wa<-rep(1,ncol(asret))/ncol(asret) Return.portfolio(as.timeSeries(asret),weights=wa) #hedge returns.
FrontierH <- portfolioFrontier(as.timeSeries(asret)) #Frontier #Kospi200 portfolio# k200pert<-mean(k200rt[,2]) #Kospi200 portfolio return k200pert FrontierK2<- portfolioFrontier(as.timeSeries(k200pert)) #CHECK THIS

#Unhedge portfolio#

unhert<- mean(unhedgert[,2]) #unhedge Expected return unhert FrontierUn<-portfolioFrontier(as.timeSeries(unhedgert[2,])) #CHECK THIS class(unhedgert) plot(Frontier)

#analysis per year class(asret$date) xd <- as.Date(asret$date, format="%d-%b-%Y") class(xd) head(dperyear)

dperyear<- subset(asret) dperyear<- split(asret,xd, f="year")

class(dperyear$date)

bb<- subset(dperyear,dperyear$date) split(dperyear, cut(strptime(paste(asret$date), format="%m%d%y"),"byyear")) head(asret) #BOOTSTRAPPING library(boot) data00<- unhedgert[1:53,] head(data00);tail(data00) n<-dim(data00)[1] colnames(data00) wa<-rep(1,(ncol(data00) -1))/(ncol(data00)-1) n<-length(data00[,1]) sampleboot<- 10000 #Number of simulations stmu<- rep(0,sampleboot) #creating an estimated mean for (i in 1:sampleboot) { boot.data= sample(data00,n, replace=TRUE) stmu[i]= mean(boot.data)
}

You May Also Find These Documents Helpful

  • Good Essays

    Hrm/531 Week 9

    • 1413 Words
    • 6 Pages

    13 A(n) ______ portfolio maximizes return for a given level of risk, or minimizes risk for a given level of return…

    • 1413 Words
    • 6 Pages
    Good Essays
  • Powerful Essays

    Return on Assets = (Net Profit + Interest + Income Tax) / Average Total Assets…

    • 2616 Words
    • 11 Pages
    Powerful Essays
  • Satisfactory Essays

    a. What is the expected return on a portfolio that is equally invested in the two assets? 6.50% (See calculations below).…

    • 713 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Expected return = [($3,450/$32,250) 0.128] + [($14,800/$32,250) 0.036] + [($8,400/$32,250) 0.098] + [($5,600/$32,250) 0.245] = 9.83 percent…

    • 497 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Acc/291 Week 3

    • 575 Words
    • 3 Pages

    a) Calculate the expected return and standard deviation of return for Small, Big and the market portfolio…

    • 575 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Investments Homeword

    • 436 Words
    • 2 Pages

    2. Based on your examination of the historical record, you calculate that the expected return on the S&P500 over the next year is 6% over T-bills with a standard deviation of 15%. Currently a T-bill with one year to maturity and face value of $10,000 is selling for $9,615. You have $1 million to invest and you will put all of your money in some combination of the S&P500 and one-year T-bills. Calculate the expected return and standard deviation of that return for 3 different portfolios. (a) Portfolio #1 is invested 100% in the S&P500.…

    • 436 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    2. Describe, using complete sentences, the portfolio you have designed. Is it an aggressive, conservative, or moderately risky portfolio?…

    • 613 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    David hedges his portfolio to provide sub-market returns and helps ensure that he can meet future repayment obligations to his clients. Portfolio…

    • 834 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Acct 5210 Problem Set 1

    • 518 Words
    • 3 Pages

    After we determine the optimal risky portfolio, the right mix between the risk-free asset and the optimal risky portfolio will be determined by investors. In this step, utility plays a role and investors can achieve…

    • 518 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Muggle Company Essay

    • 650 Words
    • 3 Pages

    The Muggle Co. has just paid a dividend of $1 per share. The dividends are expected to grow at 20% per year for the next three years and at the rate of 5% per year thereafter. If the required rate of return on the stock is 15%(APR), what is the current value of the stock?…

    • 650 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    The story of Cinderella describes my great-great grandmas’ odd and occasionally unbelievable life. Similar to Cinderella, Amparo Amieiro lived with her step-family who did not enjoy her company, to say it nicely. She was treated like a slave because of her illegitimacy and when given the chance, she left the house and got married at seventeen in 1931. A year later, she gave birth to a son and another year later, her husband died. Fast forward to 1952, four more kids were born and she was still alone with five children, living in poor Mayagüez, Puerto Rico.…

    • 1087 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    The given data used for the forecast is the Carlson sales data for 48 months. We used the trend and seasonal method. Bellow the techniques are given to estimate the seasonal method.…

    • 476 Words
    • 51 Pages
    Satisfactory Essays
  • Good Essays

    Mean Mode and Median

    • 943 Words
    • 16 Pages

     ‘Mean’ is the total of all the values in the set of data divided by the…

    • 943 Words
    • 16 Pages
    Good Essays
  • Good Essays

    annual rate of return

    • 472 Words
    • 2 Pages

    Average accounting profit is the arithmetic mean of accounting income expected to be earned during each year of the project's life time. Average investment may be calculated as the sum of the beginning and ending book value of the project divided by 2. Another variation of ARR formula uses initial investment instead of average investment.…

    • 472 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Mean Mode and Median

    • 943 Words
    • 16 Pages

     ‘Mean’ is the total of all the values in the set of data divided by the…

    • 943 Words
    • 16 Pages
    Good Essays