In: Statistics and Probability
8. Rollflex and Morgan Trust are two stocks traded on the New York Stock Exchange. For the past ten weeks, you recorded the Friday closing price (dollars per share): Rollflex: 21 20 20 23 24 20 25 23 28 21 Morgan Trust: 53 51 50 50 50 55 54 52 50 57 a) Compute the mean, median, mode, standard deviation, and variance for each stock. b) Create a boxplot for each stock. c) Which do you consider a better investment and why?
SolutionA:
create a vector Rollflex and use mean,median ,var,sd function s in R to get the mean,median,var,sd.
Rollflex <- c( 21 ,20, 20, 23, 24, 20, 25, 23 ,28, 21)
mean(Rollflex)
median(Rollflex)
table(Rollflex)
var(Rollflex)
sd(Rollflex)
Output:
mean(Rollflex)
[1] 22.5
> median(Rollflex)
[1] 22
> table(Rollflex)
Rollflex
20 21 23 24 25 28
3 2 2 1 1 1
> var(Rollflex)
[1] 6.944444
> sd(Rollflex)
[1] 2.635231
MEAN=22.5
MEDIAN=22
MODE=20
VARIANCE=6.944444
STANDARD DEVIATION=2.635231
For Morgan Trust stock
Morgan_Trust <- c( 53, 51, 50, 50, 50, 55, 54, 52, 50 ,57)
mean(Morgan_Trust)
median(Morgan_Trust)
table(Morgan_Trust)
var(Morgan_Trust)
sd(Morgan_Trust)
OUTPUT:
mean(Morgan_Trust)
[1] 52.2
> median(Morgan_Trust)
[1] 51.5
> table(Morgan_Trust)
Morgan_Trust
50 51 52 53 54 55 57
4 1 1 1 1 1 1
> var(Morgan_Trust)
[1] 6.177778
> sd(Morgan_Trust)
[1] 2.485514
MEAN=52.2
MEDIAN=51.5
MODE=50
VARIANCE=6.177778
STANDARD DEVIATION=2.485514
b) Create a boxplot for each stock.
Solutionc:
Which do you consider a better investment and why?
mean of Morgan_Trust is more than mean of Rollflex and standard deviation is also less for morgan trust compared to rollflex.
morgan trust is better investment as retruns are high and variance is less