PORTFOLIO ANALYSIS R语言投资组合MODEL (CAPM) & CONSTRUCT STOCK PORTFOLIOS

本文介绍了使用R语言实现资本资产定价模型(CAPM)和构建股票投资组合的方法。通过分析标准普尔500指数中IT和金融板块的公司,利用均值-方差模型建立有效前沿,并构建了两个等权重投资组合。此外,还探讨了基于移动平均线的简单交易系统,以谷歌股票为例,展示了不同交易策略的收益和风险情况。
摘要由CSDN通过智能技术生成

这是我的写的一篇关于用R语言实现MODEL (CAPM) & CONSTRUCT STOCK PORTFOLIOS的文章!希望能让大家看看!
Portfolio analysis

Abstract

The construction of investment portfolio is a perennial question in the analysis of financial investment. For years, the academic field and the industrial field have proposed many ways to optimize the portfolio. The theory of Markowitz mean-variance model (M-V model) takes the primary place. In the first part, this report introduces a method of constructing an effective stock portfolio with M-V model to establish effective frontier by using R. In the second part, we have built a simple simulation trading system for one stock by using R.

1 Construct portfolio
1.1 Introduction
The Standard & Poor’s 500 (abbreviated as S&P500), is an American stock market index based on the market capitalizations of 500 large companies having common stock listed on NYSE or NASDAQ. The S&P500 index has experienced a circle of bull market and bear market since 2013. So our sample encompasses a over 5-year period from January 2013 to April 2018.

image.png

1.2 portfolio construction
Companies like GOOGLE, IBM, MICROSOFT, APPLE and FACEBOOK are labeled as IT constitutes of S&P500 components. Companies like AFFIL MANAGERS, GOLDMAN SACHS, Citi Group, NASDAQ and MOODYS are labeled as financial constitutes of S&P500 components.

By R command getSymbols(), we get the historical market data of the ten stocks mentioned above and S&P500 index from yahoo finance website.

Supposing that one company can continue operating for more than 10 years, so we take 10-year US treasury interest rate as risk-free rate.

For simple, we construct two equal weighted portfolios:

image.png

The correlation matrix of IT stocks and S&P500 is listed as below.

GOOG/ MSFT/AAPL/FB are highly correlated with each other, IBM is negative correlated with other 4 stocks.

GOOG

IBM

MSFT

AAPL

FB

SPY

GOOG

   1.00

 -0.23

   0.98

   0.89

   0.97

   0.95

IBM

 -0.23

   1.00

 -0.19

 -0.29

 -0.31

 -0.21

MSFT

   0.98

 -0.19

   1.00

   0.92

   0.96

   0.97

AAPL

   0.89

 -0.29

   0.92

   1.00

   0.93

   0.97

FB

   0.97

 -0.31

   0.96

   0.93

   1.00

   0.97

SPY

   0.95

 -0.21

   0.97

   0.97

   0.97

   1.00

1.3 evaluation
The capital asset pricing model(CAPM), derived by Sharpe, Lintner and Mossin, is one of the most celebrated models in all of finance. The model describes the relationship we should expect to see between risk and return for individual assets. Specifically, the CAPM provides a way to calculate an asset’s expected return (or “required” return) based on its level of systematic (or market-related) risk, as measured by the asset’s beta.

For a portfolio, the equation for CAPM is

image.png

Which is the risky free rate, stands for the return of market, represents the sensitivity of the portfolio’s return to the market return.

Through linear regression, R command without intercept image.png, we can get the beta of two portfolios:

image.png

Beta is considered as the systematic risk, in a diversified portfolio, an investor should only be compensated for systematic risk (or beta) exposure. Beta reflects the relationship between the portfolio and the whole market. If beta is larger than 1, the portfolio earns more when the market goes up. If beta is smaller than 1, the portfolio loses less when the market goes down.

Form the linear regression results, we can see portfolio 1 and portfolio 2 both have beta greater than 1. When the marke

投资组合分析(portfolio analysis)是指对投资组合中的各项资产进行综合性评估和分析的一种方法。投资组合分析的目的是帮助投资者优化资产配置,降低风险,提高收益。 投资组合分析的基本原理是通过投资组合中不同资产之间的相关性和风险特征,来评估投资组合的整体表现。常用的投资组合分析方法有两个主要的方面:资产的选择和资产的组合。 在资产的选择方面,投资者通常需要评估和选择多种不同类型的资产,如股票、债券、房地产等。投资者可以通过对这些不同类型资产的历史数据、基本面和市场前景等进行研究分析,来选择具有潜力的资产。 在资产的组合方面,投资者需要考虑不同资产之间的相关性和风险特征。相关性可以帮助投资者理解各资产之间的关联程度,进而选择能够实现多样化投资的资产组合。同时,评估组合的风险特征也是投资组合分析的重要一环。通过对投资组合的风险进行度量和分析,投资者能够更好地控制风险,使投资组合的整体表现更加稳定。 投资组合分析的最终目标是找到一个风险与收益之间最佳的平衡点。通过对投资组合的分析,投资者可以确定出适合自身投资目标和风险承受能力的资产配置策略,以实现预期的投资回报。 总而言之,投资组合分析是一种综合性的评估方法,通过对不同类型资产的选择和资产组合的构建,帮助投资者优化资产配置,降低风险,提高收益。这是投资者进行有效投资决策的重要工具。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值