Question: Please post R code differentiating each question by the proper number (Ex. 2.1, 2.2, 2.3, ETC.) 2.1 Without using packages, create a function of 2
Please post R code differentiating each question by the proper number (Ex. 2.1, 2.2, 2.3, ETC.)
2.1 Without using packages, create a function of 2 variables x and ad- justed that calculates the sample skewness of x using the formulas on L6 page 21. When adjusted = TRUE, it returns the adjusted skewness of x, and FALSE returns the unadjusted one.
2.2 Without using packages, create a function of 2 variables x and ad- justed that calculates the sample kurtosis of x using the formulas on L6 page 23. When adjusted = TRUE, it returns the adjusted kurtosis of x, and FALSE returns the unadjusted one.
2.3 Download historical price for ticker SPY for the whole 2012 and 2013 years, use its adjusted close price to calculate daily log return (adjusted close price is different from the adjusted for sample moments).
2.4 Calculate the adjusted and unadjusted skewness for the daily log return in 2.3 using the function you defined. (both numbers should be close to -0.15)
2.5 Calculate the adjusted and unadjusted kurtosis for the daily log return in 2.3 using the function you defined. (both numbers should be close to 4.1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
