Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the link in the Jupyter Notebook activity to access your Python script. Once you have made your calculations, complete the discussion. The script will

Use the link in the Jupyter Notebook activity to access your Python script. Once you have made your calculations, complete the discussion. The script will output answers to the questions given below. You must attach your Python script output as an HTML file and respond to the questions below.

apply the statistical concepts and techniques covered in this week's reading about one-way analysis of variance (ANOVA). An investment analyst is evaluating the 10-year mean return on investment for industry-specific exchange-traded funds (ETFs) for three sectors: financial, energy, and technology. The analyst obtains a random sample of 30 ETFs for each sector and calculates the 10-year return of each ETF. The analyst has provided you with this data set. Run Step 1 in the Python script to upload the data file.

Using the sample data, perform one-way analysis of variance (ANOVA). Evaluate whether the average return ofat least oneof the industry-specific ETFs is significantly different. Use a 5% level of significance.

In your initial post, address the following items:

  1. Define the null and alternative hypothesis in mathematical terms and in words.
  2. Report the level of significance.
  3. Include the test statistic and the P-value. See Step 2 in the Python script.
  4. Provide your conclusion and interpretation of the test. Should the null hypothesis be rejected? Why or why not?
  5. Does a side-by-side boxplot of the 10-year returns of ETFs from the three sectors confirm your conclusion of the hypothesis test? Why or why not? See Step 3 in the Python script.

The attached photos have the data

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
ter Notebook (Discussion X & Codio - Module Eight Discussion X Course Hero x + dule-eight-discussion/preview/%2F%2Fclub-general-3000.codio.io%2Fnotebooks%2FBACKUP_Module%20Eight%20Discussion.ipynb esource... Sp STEM | science | IT... DG Object Oriented Pr... IG My orders Metal Gear Solid 1... Apporto | App and--. Oop assignment | 1. Calorie Calculator -... 2019 For View Tools Education Help Configure.. Project Index (static) Configure. BACKUP_Mo.. /club-general-3000. codio. iootebooks/BACKUP_Module Eight Discussion. ipynb Jupyter BACKUP_Module Eight Discussion Last Checkpoint 12/27/2019 (unsaved changes) File Edit View Insert Cell Kernel Widgets Help Not Trust a + 25 | Run C Markdown etf_returns_financial_df = etf_returns_financial_df. rename ( columns-{"financial": "return"}) etf_returns_financial_df [ ETF ] = financial etf_returns_energy_of = etf_returns_of[ [ energy ] ] etf_returns_energy_of = etf_returns_energy_df. rename (columns-("energy" : "return"}) etf_returns_energy_of ['ETF ' ] = energy" etf_returns_technology_of = etf_returns_of[[ technology "] etf_returns_technology_of = etf_returns_technology of. rename (columns-{ "technology": "return"}) etf_returns_technology_of[ 'ETF ' ] technology' # concatenate dataframes for the three ETFS. all_etfs_df = pd . concat((etf_returns_financial_df, etf returns_energy_of, etf_returns_technology_of) ) # set a title for the plot, x-axis, and y-axis. pit . title('Boxplot for comparison , fontsize-20 # prepare the boxplot. sns . boxplot (x-"ETF", y="return", data-all_etfs_of) # show the plot. pit . show( ) Boxplot for comparison return Co nancial energy technology End of initial post O X ART SERscussion X Codio - Module Eight Discussion X * Course Hero X cussion/preview/%2F%2Fclub-general-3000.codio.io%2Fnotebooks%2FBACKUP_Module%20Eight%20Discussion.ipynb STEM | science | IT... DG Object Oriented Pr... G My orders Metal Gear Solid 1... Apporto | App and... Oop assignment | I. Calorie Calculator -.. 2019 Form 8962 Education Help Configure.. Project Index (static) Configure. L-3000. codio. iootebooks/BACKUP_Module Eight Discussion. ipynb Jupyter BACKUP_Module Eight Discussion Last Checkpoint 12/27/2019 (unsaved changes) File Edit View Insert Cell Kernel Widgets Help Not Trusted | Pyth a + + 6 Run C H Markdown 411 [ ] . AmpuI t paluas a> pu # read data from etf_returns. csv. etf_returns_of = pd. read_csv(jetf_returns.csv) # print etf returns data set. print (etf_returns_df) 5. 1 5.7 7.6 1.6 8.2 13 5 .6 5 .5 11 . 5 14 5.3 5.9 6. 9.2 15 5 .6 6.1 9.5 16 4.7 4.4 6.2 17 5.4 6.6 7.4 18 6.7 6.4 6.9 20 4 . 3 4.8 4.1 5.0 7 4 21 5.1 5 .3 1.1 5 .7 6. 2 8.9 23 24 4 .7 5.2 8.1 7.1 25 5 .3 6.4 5 . 0 6.6 7.4 5 .8 6.0 4.9 5.6 4 .1 5 .5 7.4 7.4 29 5.0 1 . 8 4.9 10.3 Step 2: Performing one-way ANOVA The scipy.stats submodule can be used to perform one-way analysis of variance (ANOVA). The method f_oneway is used to perform this test. The inputs are individual dataframes of all groups (in this discussion, groups are sectors). Click the block of code below and hit the Run button above In [2]: import scipy . stats as st # save return data for individual sectors for input to f_oneway method- etf_returns_financial = etf_returns_of[ 'financial' ] etf_returns_energy = etf_returns_df[ 'energy' ] etf_returns_technology = etf_returns_of[ ' technology' ] O e 9 X F12 PRT SER CROW F1I LOCK F9 SYS RO BREDiscussio X Codio - Module Eight Discussion X Course Hero x + iscussion/preview/%2F%2Fclub-general-3000.codio.io%2Fnotebooks%2FBACKUP_Module%20Eight%20Discussion.ipynb STEM | science | IT... DG Object Oriented Pr... I My orders Metal Gear Solid 1... Apporto | App and... Oop assignment | 1... Calorie Calculator -... 2019 Form 8962 ools Education Help Configure. Project Index (static) Configure. lo... al-3000. codio. iootebooks/BACKUP_Module Eight Discussion. ipynb Jupyter BACKUP_Module Eight Discussion Last Checkpoint: 12/27/2019 (unsaved changes) File Edit View Insert Cell Kernel Widgets Help Not Trusted | Py a+ + |Run C | Markdown nd co conlod , Indur . IT1 IT # read data from etf_returns. csv. etf_returns_df = pd. read_csv('etf_returns.csv') # print etf returns data set. print(etf_returns_df) Financial energy technology DO YOUAWNHO 5.5 5.2 7 . 7. 1 8.2 6.9 7.1 5 . 1 7.6 4. 6 8.2 5.3 11 .5 5.9 inaNo 1 6.4 9.2 5.6 -6.1 9 .5 5.5 5. 2 7.3 7.1 7 .4 8 .2 10 6.9 6.6 7.1 5 .1 5 . 7 7.6 12 4.6 5 .6 8 .2 13 5 .3 5.5 11.5 14 6.4 9 .2 15 6 .1 9 .5 16 4.4 6 .2 17 6.6 7.4 Step 2: Performing one-way ANOVA The scipy stats submodule can be used to perform one-way analysis of variance (ANOVA). The method f_oneway is used to perform this test. The inputs are ndividual dataframes of all groups (in this discussion, groups are sectors). Click the block of code below and hit the Run button above. In [2]: import scipy . stats as st # save return data for individual sectors for input to f_oneway method. etf_returns_financial = etf_returns_df[ ' financial' ] etf_returns_energy = etf_returns_df[ 'energy' ] etf_returns_technology = etf_returns_of [ ' technology' ] O e 9 CROLI F12 PRT SCR LOCK BYS RODiscussio X C Codio - Module Eight Discussion X Course Hero X + discussion/preview/%2F%2Fclub-general-3000.codio.io%2Fnotebooks%2FBACKUP_Module%20Eight%20Discussion.ipynb D STEM | science | IT... DG Object Oriented Pr... 1 My orders Metal Gear Solid 1... Apporto | App and... Oop assignment | |... Calorie Calculator -... 2019 Form ools Education Help Configure. Project Index (static) Configure. Mo... ral-3000 . codio. iootebooks/BACKUP_Module Eight Discussion. ipynb Jupyter BACKUP_Module Eight Discussion Last Checkpoint: 12/27/2019 (unsaved changes) File Edit View Insert Cell Kernel Widgets Help Not Truste N Run C > Markdown The scipy stats submodule can be used to perform one-way analysis of variance (ANOVA). The method f_oneway is used to perform this test. Th individual dataframes of all groups (in this discussion, groups are sectors). Click the block of code below and hit the Run button above In [2]: import scipy . stats as st # save return data for individual sectors for input to f_oneway method. etf_returns_financial = etf_returns_of[ financial' etf_returns_energy = etf_returns_df[ 'energy' ] etf_returns_technology - etf_returns_of [ 'technology' ] # print the outputs: the test statistic and the P-value. test_statistic, p_value = st. f_oneway(etf_returns_financial, etf_returns_energy, etf_returns_technology) print("test statistic =", round(test_statistic, 2) ) print("P-value =", round(p_value,4) ) test statistic = 55.07 P-value = 0.0 Step 3: Visualizing differences There are post-hoc tests available that can be used to identify groups that are significantly different than others. Alternatively, a quick approach to ide differences is to create a visual plot for data distributions using side-by-side boxplots. The block of code below uses the seaborn module and matplotli submodule to create side-by-side boxplots for the ten-year retums of ETFs in financial, energy, and technology sectors. Click the block of code below and hit the Run button above. NOTE: If the graph is not created, click the code section and hit the Run button again. In [4]: import matplotlib. pyplot as plt import seaborn as sns import numpy as np import random # side-by-side boxplots require the three dataframes to be concatenated and a require variable identifying the type of ETF etf_returns_financial_of = etf_returns_of [[ financial' ]] etf_returns_financial_of = etf_returns_financial_df . rename (columns-{"financial": "return"}) etf_returns_financial_of[ 'ETF '] = 'financial. e 9

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

Step: 3

blur-text-image

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

Statistical Reasoning For Everyday Life

Authors: Jeff Bennett, William Briggs, Mario Triola

5th Edition

9780134494043

More Books

Students also viewed these Mathematics questions