0% found this document useful (0 votes)
10 views

Practical 7

Uploaded by

Sharon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Practical 7

Uploaded by

Sharon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Practical 7 – CP2403

(Please ensure you show your work to your tutor once completed as each practical is 3
marks.)

Part 1 – Download the Jupyter notebook for Module 7 and run the notebook

Part 2
Download the Jupyter Notebook Template for Prac 7 from LearnJCU. Complete the template
& run the code. Refer to Module 7 Lecture Jupyter Notebook for help
Complete the questions in Part 3 as you work on the Prac 7 template

Part 3
Scenario 1
We want to find out the association between electricity use per person (relectricperperson (x))
and oil use per person (oilperperson (y))
Step 1: hypothesis
Null hypothesis (Ho):
There is more person who use electricity than oil
Or there is a negative correlation between electricity use per person and oil use per person.

Step 2: Data Selection


- 2010 oil Consumption per capital (tons per year and person)
- 2008 residential electricity consumption, per person (kWh)

Step 3: Assess the evidence


Scatter Plot
Pearson correlation (r):
0.5249373779159885, 1.0020621767836594e-05

As r is positive, there is a positive relationship. Also, r is close to 1, then there is a strong


positive relationship.

p: 1.00e-05 = -2.28

since p is less than 0.05, will indicate that the correlation will hold for larger population.

Step 4: Draw Conclusion


Accept (There is a strong positive correlation between electricity use per person and oil use
per person.)
Scenario 2
We want to find out the association between CO2 emission (co2emissions (x)) and oil use per
person (oilperperson (y))
Step 1: hypothesis
Null hypothesis (Ho):
There is more amount of oil use per person than CO2 emission.
Or there is a negative correlation between oil use per person and CO2 emission.

Step 2: Data Selection


- 2010 oil Consumption per capital (tons per year and person)
- 2006 cumulative CO2 emission (metric tons), Total amount of CO2 emission in
metric tons since 1751.

Step 3: Assess the evidence


Scatter Plot

Pearson correlation (r):


0.04444201231228792, 0.7294518840123033
As r is positive, there is a positive relationship. Also, r is close to 1, then there is a strong
positive relationship.

p: 0.729
As p is greater than 0.05, will indicate that the correlation will hold for smaller population.

Step 4: Draw Conclusion


Accept (There is a strong positive correlation between oil use per person and CO2
emmision.)
Scenario 3
We want to perform regression analysis between electricity use per person (relectricperperson
(x)) and oil use per person (oilperperson (y))
1: Scatter plot with regression line

2: Regression Analysis results


OLS regression model for the association between Electric Use Per Person and Oil Per Person
OLS Regression Results
==============================================================================
Dep. Variable: relectricperperson R-squared: 0.276
Model: OLS Adj. R-squared: 0.264
Method: Least Squares F-statistic: 23.20
Date: Mon, 17 Dec 2018 Prob (F-statistic): 1.00e-05
Time: 19:27:29 Log-Likelihood: -559.23
No. Observations: 63 AIC: 1122.
Df Residuals: 61 BIC: 1127.
Df Model: 1
Covariance Type: nonrobust
================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------
Intercept 860.2499 286.936 2.998 0.004 286.485 1434.015
oilperperson 590.3956 122.567 4.817 0.000 345.309 835.483
==============================================================================
Omnibus: 35.040 Durbin-Watson: 1.908
Prob(Omnibus): 0.000 Jarque-Bera (JB): 211.745
Skew: 1.246 Prob(JB): 1.05e-46
Kurtosis: 11.629 Cond. No. 3.27
==============================================================================

3: Regression line – if valid


oilperperson = b + m(relectricperperson)
oilperperson = 860.2499+590.3956*(relectricperperson)

4: Residual plot – if required

5: Conclusion from residual plot – if valid


- Assume relationship is linear
- Residuals are normally distributed
Scenario 4
We want to perform regression analysis between CO2 emission (co2emissions (x)) and oil
use per person (oilperperson (y))
1: Scatter plot with regression line

2: Regression Analysis results


OLS regression model for the association between CO2 emission and Oil Use Per Person
OLS Regression Results
==============================================================================
Dep. Variable: co2emissions R-squared: 0.002
Model: OLS Adj. R-squared: -0.014
Method: Least Squares F-statistic: 0.1207
Date: Mon, 17 Dec 2018 Prob (F-statistic): 0.729
Time: 19:27:30 Log-Likelihood: -1633.3
No. Observations: 63 AIC: 3271.
Df Residuals: 61 BIC: 3275.
Df Model: 1
Covariance Type: nonrobust
================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------
Intercept 1.368e+10 7.28e+09 1.880 0.065 -8.71e+08 2.82e+10
oilperperson 1.08e+09 3.11e+09 0.347 0.729 -5.14e+09 7.3e+09
==============================================================================
Omnibus: 119.379 Durbin-Watson: 1.743
Prob(Omnibus): 0.000 Jarque-Bera (JB): 4709.059
Skew: 6.136 Prob(JB): 0.00
Kurtosis: 43.538 Cond. No. 3.27
==============================================================================

Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
3: Regression line – if valid
oilperperson = b + m(co2emissions)
oilperperson = 1.368e+(1.08e=09) * co2emissions

4: Residual plot – if required

5: Conclusion from residual plot – if valid


- Residuals are normally distributed
Scenario 5
We want to perform regression analysis between electricity use per person (relectricperperson
(x)) and oil use per person (oilperperson (y)) for LOW CO2 emission countries
1: Scatter plot with regression line

2: Regression Analysis results


OLS regression model for the association between Electricty Use Per Person and Oil Use Per Person for
LOW CO2 Emission countries
OLS Regression Results
==============================================================================
Dep. Variable: relectricperperson R-squared: 0.244
Model: OLS Adj. R-squared: 0.194
Method: Least Squares F-statistic: 4.840
Date: Mon, 17 Dec 2018 Prob (F-statistic): 0.0439
Time: 19:27:43 Log-Likelihood: -151.33
No. Observations: 17 AIC: 306.7
Df Residuals: 15 BIC: 308.3
Df Model: 1
Covariance Type: nonrobust
================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------
Intercept 917.9271 557.225 1.647 0.120 -269.770 2105.625
oilperperson 337.1159 153.240 2.200 0.044 10.492 663.739
==============================================================================
Omnibus: 11.718 Durbin-Watson: 2.325
Prob(Omnibus): 0.003 Jarque-Bera (JB): 9.464
Skew: 1.203 Prob(JB): 0.00881
Kurtosis: 5.751 Cond. No. 4.53
==============================================================================
3: Regression line
oilperperson = b + m(co2emission)
oilperperson=917.9271 + 337.1159 (relectricperperson)

4: Residual plot – if required

5: Conclusion from residual plot – if valid

Residuals are normally distributed


Scenario 6
We want to perform regression analysis between electricity use per person (relectricperperson
(x)) and oil use per person (oilperperson (y)) for MEDIUM CO2 emission countries
1: Scatter plot with regression line

2: Regression Analysis results


OLS regression model for the association between Electricty Use Per Person and Oil Use Per Person for
MEDIUM CO2 Emission countries
OLS Regression Results
==============================================================================
Dep. Variable: relectricperperson R-squared: 0.619
Model: OLS Adj. R-squared: 0.597
Method: Least Squares F-statistic: 27.61
Date: Mon, 17 Dec 2018 Prob (F-statistic): 6.45e-05
Time: 19:27:52 Log-Likelihood: -153.72
No. Observations: 19 AIC: 311.4
Df Residuals: 17 BIC: 313.3
Df Model: 1
Covariance Type: nonrobust
================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------
Intercept -55.0934 371.418 -0.148 0.884 -838.716 728.529
oilperperson 1209.1409 230.096 5.255 0.000 723.680 1694.602
==============================================================================
Omnibus: 4.056 Durbin-Watson: 1.590
Prob(Omnibus): 0.132 Jarque-Bera (JB): 1.998
Skew: -0.690 Prob(JB): 0.368
Kurtosis: 3.785 Cond. No. 4.09
3: Regression line
oilperperson = b + m(co2emissions)
oilperperson = -55.0934+1209.1409(co2emissions)

4: Residual plot – if required

5: Conclusion from residual plot – if valid


Residuals are normally distributed
Scenario 7
We want to perform regression analysis between electricity use per person (relectricperperson
(x)) and oil use per person (oilperperson (y)) for HIGH CO2 emission countries
1: Scatter plot with regression line

2: Regression Analysis results


OLS regression model for the association between Electricty Use Per Person and Oil Use Per Person for
HIGH CO2 Emission countries
OLS Regression Results
==============================================================================
Dep. Variable: relectricperperson R-squared: 0.619
Model: OLS Adj. R-squared: 0.597
Method: Least Squares F-statistic: 27.61
Date: Mon, 17 Dec 2018 Prob (F-statistic): 6.45e-05
Time: 19:30:38 Log-Likelihood: -153.72
No. Observations: 19 AIC: 311.4
Df Residuals: 17 BIC: 313.3
Df Model: 1
Covariance Type: nonrobust
================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------
Intercept -55.0934 371.418 -0.148 0.884 -838.716 728.529
oilperperson 1209.1409 230.096 5.255 0.000 723.680 1694.602
==============================================================================
Omnibus: 4.056 Durbin-Watson: 1.590
Prob(Omnibus): 0.132 Jarque-Bera (JB): 1.998
Skew: -0.690 Prob(JB): 0.368
Kurtosis: 3.785 Cond. No. 4.09

3: Regression line
oilperperson = b + m(co2emissions)
oilperperson = -55.0934+1209.1409(co2emissions)

4: Residual plot – if required

5: Conclusion from residual plot – if valid

Residuals are normally distributed

You might also like