Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please finish it in R language the dataframe should be called msft 1. Write a function called calculateret() to calculate the daily return. This function

Please finish it in R language

the dataframe should be called msft

1. Write a function called calculateret() to calculate the daily return. This function should have two arguments: msft(a data.frame object) and MSFT.Adjusted.

Daily return equals (closing price-opening price)/opening price

Call these returns retmsft

(This function should extract the prices for the variable indicated by MSFT.Adjusted and output the simple daily return from those prices. Please provide your function.)

2. To remove any NA's in retmsft, the code should be?

3. The mean of retmsft is? The sd of retmsft is?(solve in code)

MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
1 12 13 11 12 10000 13
2 12 15 11 14 12000 14
3 13 16 9 15 10000 12
4 14 17 10 12 20000 11
5 12 14 11 13 3000 15

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mathematical Analysis I

Authors: Claudio Canuto, Anita Tabacco

2nd Edition

3319127721, 9783319127729

More Books

Students also viewed these Mathematics questions

Question

Job type Retail sales, managerial, human resources, etc.

Answered: 1 week ago