1.
[6 points]
Suppose you invested into a mutual fund account on January 1st, 2020. You
earned 2% return in January and 5% return in February 2020. Then, the account
balance at the end of February 2020 is $21,420. How much did you invest in the
fund on January 1st, 2020?

Not sure if
correct?

>starting_saving <- 20000

>feb_mysaving <-
starting_saving*1.02*1.05

>feb_mysaving

[1] 21420

2.
[4 points] Your
portfolio contains 60% of stock A and 40% of stock B. Assume that stock A
earned a 5% return and stock B earned - 4% return this month. What is your
total portfolio return this month?

ret_A <- 5

ret_B <- 4

weight_A <- 0.6

weight_B <- 0.4

ret_portfolio <-
weight_A*ret_A+weight_B*ret_B

ret_portfolio

[1] 4.6

Not sure if
correct?

3. Consider the following formula
to calculate the monthly payment amount.

M= ??1− 1(1+?)?

a)
[4 points] In this equation, P represents the principle, i the (monthly)
interest rate, and n the number of payment terms for a mortgage with a
principle balance of 200,000, monthly interest rate of 0.3%, and the number of
payment terms of 360. Calculate the monthly payment amount M.

b) [6 points] Construct a
vector M of length 3 with the results of this calculation for a series of
principle balances: 150,000, 180,000, 220,000.

4. Use the “ : operator ”
and arithmetic operators in Chapter 1 to create the following vectors.
You have to use “ : operator ” on p. 7 in Chapter 1 course material for both
a) and b).

a) [8
points] [1] 5 10 15 20 25 30

b) [8 points] [1]
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 Hint: you
may use Modulo %%

5. [6 points] Use the following
R script to create a vector ‘x’.

set.seed(100)

x <- round(rnorm(18, mean = 2, sd =
0.1), 2)

Create a 3 x 6 matrix (matrix with 3 rows
and 6 columns) using x, and assign
the name ‘x.mat’ to the matrix.

6. [6 points] Use the following R script
to create a vector ‘x.vec’.

x.vec <- c(2, 5, 6, 8, 3)

Assign the names (“Apple”, “Samsung”,
“Amazon”, “CVS”, “Walmart”) to the vector.

7. [6 points] Use the following R script
to create a matrix ‘y.mat’.

y.mat <- matrix(1:12, nrow = 4, ncol = 3)

Assign the names (“New York”, “Boston”,
“Dallas”) to the three columns, and assign the names (“AAA”, “AA”, “A”, “BBB”)
to the four rows.

8. [6 points] Create the following data
frame with the name “myportfolio”. Then, select the stock price and volume of
Company ZZZ.

> myportfolio

Company Stock_Price
Volume

1 XXX 56 1500

2 YYY 86 4100

3 ZZZ 62
2800

Get Higher Grades Now

Tutors Online

Get Free Quote!

262 Experts Online