Text: Statistics Basics
Points Lost
[20 Points]
All Functions for this question should be placed in a new Module (Module 1).
Given the data table below, please create a user-defined function that executes the formula indicated in each question:
For ALL formulas below, you are not allowed to use any WorksheetFunctions to help with your codes.
ICY HOT COLD SILD RAIN SNOW $53.00 $31.00 $50.00 $57.00 $17.00 $25.00 $59.00 $30.00 $30.00 $50.00 $43.00 100.00 $20.00 $27.00 $55.00 $38.00 $38.00 $39.00 $27.00 $22.00 $28.00 $42.00 34.00 57.00 $40.00 $55.00 $49.00 $23.00 $10.00 $58.00 $33.00 $23.00 $54.00 $45.00 $20.00
Day Formula I: Create a function called MyAverage that calculates the sample average of each stock price on the right.
Day 2 13:rv 3 MyAverage = - ) Price = Price Day 4 13:ty 5 Formula II: Create a function called MyVariance that calculates the sample variance of each stock price on the right.
Day 6 Formula I MyAverage MyVariance = (Price, Price)2 Formula I MyVariances 1 Formula III MySTD You do not have to redo your code from Formula I. Just add the line "avgprice = MyAverage(Price)", for example, in your code. Replace price with whatever you called your argument for Price in the first line of your code.
Formula III: (rename function called MyS11) that calculates the sample standard deviation of each stock price on the right.
MySTD = (Price; Price) i=1
* I know at this point you might be tempted to simply square root the MyVariance function. I would advise against this since you will need the Standard deviation function in Formula IV below. You are free to code this however you find most comfortable though!
Formula IV: Now create a function called MyCorrel that returns the covariance of the two stocks provided. Recall: 11 = 1(A A)(B, B) COV(A,B) Stock Stock B MyCorrel = PA,B g-p rig ng 11.0% 0.5% 8.0% -6.0% * The majority of your MyCorrel function will use the codes from Formula I - III, call on 6.0%[ 5.0% them where necessary! 6.0% 3.0% -7.6%[ 2.0% 8.0% 7.0% 6.0% 8.3% 7.0% 6.5% 4.3% 9.7% -5.3% 3.2% -9.0% 2.0% 5.4% 3.4% 7.2% 6.8% 1.5%[ 6.7% 3.6% 5.1% 9.8% 3.2% 6.4% 4.6% 0.8% 9.0% Formula IV [MyCorrel