Question
Question ( R scripts/ studio) A) Two different stock returns: 3% for Apple and 1% for Microsoft. want to run the following commends. If mystock
Question ( R scripts/ studio)
A) Two different stock returns: 3% for Apple and 1% for Microsoft. want to run the following commends.
If mystock is Apple, print "My return is 3%."
If mystock is Microsoft, print "My return is 1%."
If mystock is neither Apple nor Microsoft, print "This is not in your portfolio."
I entered the following code in the first line
mystock <- "Microsoft"
and have to complete the following lines.
if ( ) { print (
} else {
[Multiple lines here]
)
}
The if...else statement above should include all three possibilities.
B)n <- 10
how to i can Print odd numbers from 10 to 24 using repeat loop?
C)n <- 6
how can Print even numbers from 6 to 19 using while loop
D)n <- seq (from = 13, to = 28)
- Print even numbers from 13 to 28 using for loop
E)how to download daily stock price of Amazon, Inc. from 2019-10-01 to 2019-12-31 from Yahoo! Finance.
install.packages("quantmod")
library(quantmod)
getSymbols("AMZN", src = "yahoo", from='2020-03-01', to='2020-04-30')
Using AMZNAdj, calculate daily log returns and assign the name log_AMZNAdj.
E) how to download daily stock price of Apple, Inc. from 2016-01-01 to 2018-07-31 from Yahoo! Finance.
library(quantmod)
getSymbols("AAPL", src = "yahoo", from='2019-01-01', to='2019-12-31') AAPLAdj <- AAPL$AAPL.Adj
- Show whether the series AAPLAdj evolves with time. If it does, show how to remove the evolution with time and comment on the result.
- The following code will convert AAPLAdj to monthly log return. monthly.AAPL <- monthlyReturn(AAPLAdj, subset=NULL, type='log', leading=TRUE)
Find sample autocorrelation and partial autocorrelation estimates for monthly.AAPL up to lag 10.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started