基本的程式筆記設定,安裝、載入一些基本的套件

rm(list=ls(all=T))
knitr::opts_chunk$set(comment = NA)
knitr::opts_knit$set(global.par = TRUE)
par(cex=0.8); options(scipen=20, digits=4, width=90)
if(!require(pacman)) install.packages("pacman")
pacman::p_load(dplyr)

以上這些程式碼請大家不要去改動


股票動態

股票市場是買賣雙方交易公司股票的地方,也是個人和公司投資的最受歡迎的方式之一。現在估計世界股票市場規模達到數兆。紐約證券交易所位於紐約市,是世界上最大的股票市場。 紐約證券交易所約有2,800家上市公司。在這個問題上,我們將看看其中五家公司的每月股價:IB、通用電氣(GE)、寶潔、可口可樂和波音。此問題中使用的數據來自Infochimps。

使用read.csv()下載並讀取以下文件:

分別存入資料框IBMGEProcterGambleCocaColaBoeing, 每個資料框都有兩個變量,描述如下:

在這個案例,我們將看看這些公司的股票動態如何隨著時間的推移而發生變化。



Section-1 Summary Statistics

§ 1.1 Our five datasets all have the same number of observations. How many observations are there in each data set?

#
#

§ 1.2 What is the earliest year in our datasets?

#
#

§ 1.3 What is the latest year in our datasets?

#
#

§ 1.4 What is the mean stock price of IBM over this time period?

#
#

§ 1.5 What is the minimum stock price of General Electric (GE) over this time period?

#
#

§ 1.6 What is the maximum stock price of Coca-Cola over this time period?

#
#

§ 1.7 What is the median stock price of Boeing over this time period?

#
#

§ 1.8 What is the standard deviation of the stock price of Procter & Gamble over this time period?

#
#


Section-2 Visualizing Stock Dynamics

§ 2.1 Around what year did Coca-Cola has its highest stock price in this time period? Around what year did Coca-Cola has its lowest stock price in this time period?

#
#

§ 2.2 In March of 2000, the technology bubble burst, and a stock market crash occurred. According to this plot, which company’s stock dropped more?

#
#

§ 2.3 (a) Around 1983, the stock for one of these companies (Coca-Cola or Procter and Gamble) was going up, while the other was going down. Which one was going up?

#
#
  1. In the time period shown in the plot, which stock generally has lower values?
#
#


Section-3 Visualizing Stock Dynamics 1995-2005

§ 3.1 Which stock fell the most right after the technology bubble burst in March 2000?

#
#

§ 3.2 Which stock reaches the highest value in the time period 1995-2005?

#
#

§ 3.3 In October of 1997, there was a global stock market crash that was caused by an economic crisis in Asia. Comparing September 1997 to November 1997, which companies saw a decreasing trend in their stock price? (Select all that apply.)

#
#

§ 3.4 In the last two years of this time period (2004 and 2005) which stock seems to be performing the best, in terms of increasing stock price?

#
#