Anup Sakpal (s3801788), Vignesh Gopalakrishnan (s3795594), Kanishk Jain (s3810978)
Last updated: 22 October, 2019
rpubs link : http://rpubs.com/gvignu/541660
CO2_rev2[62,c(20,21,22)] <- sum_stats_country[62,'mean']
CO2_rev2[113,2:5] <- sum_stats_country[113,'median']
CO2_rev2[115,2] <- sum_stats_country[115,'mean']
CO2_rev2[151,2:12] <- sum_stats_country[151,'mean']
CO2_rev2[217,2:9] <- sum_stats_country[217,'median']
CO2_rev2[237,c(2:4,22)] <- sum_stats_country[237,'mean']
CO2_1994_2003 <- CO2_rev2[,2:11]
CO2_2004_2013 <- CO2_rev2[,12:21]
decade_1 <- rowSums(CO2_1994_2003)/10
decade_2 <- rowSums(CO2_2004_2013)/10
CO2_rev4 <- cbind(CO2_rev2[,1],decade_1,decade_2)
CO2_rev4 <- CO2_rev4 %>% mutate(d = decade_2 - decade_1)
CO2_rev4
Min | Q1 | Median | Q3 | Max | Mean | SD | n | Missing |
---|---|---|---|---|---|---|---|---|
0.0207126 | 0.6250148 | 2.349967 | 6.22987 | 61.69089 | 4.512485 | 6.324376 | 241 | 0 |
Min | Q1 | Median | Q3 | Max | Mean | SD | n | Missing |
---|---|---|---|---|---|---|---|---|
0.0253415 | 0.8056525 | 2.84751 | 6.57605 | 48.60564 | 4.799115 | 6.074046 | 241 | 0 |
ggdensity(CO2_rev4$d,
main = "Density plot of Difference in Global mean pollution per country for two decades",
xlab = "Difference")
## [1] 220 182
x <- seq(min(CO2_rev4$d),max(CO2_rev4$d))
mu <- mean(CO2_rev4$d)
sd <- sd(CO2_rev4$d)
CO2_rev4$d %>% hist(xlab="Difference",
main="Histogram of difference in mean global pollution per country for two decades", prob=TRUE, ylim = c(0, 0.25), col = "dodgerblue3")
curve(dnorm(x,mu,sd),xlim = c(mu-sd*4, mu+sd*4),col="red", add=TRUE, lwd= 2)
\[H_0: \mu \Delta = 0 \]
\[H_A: \mu \Delta \ne 0\]
##
## Paired t-test
##
## data: CO2_rev4$decade_2 and CO2_rev4$decade_1
## t = 2.5419, df = 240, p-value = 0.01166
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.06450068 0.50875958
## sample estimates:
## mean of the differences
## 0.2866301
boxplot(
CO2_rev4$decade_1,
CO2_rev4$decade_2,
main = "Box plot",
ylab = "CO2 emissions per country",
xlab = ""
)
axis(1, at = 1:2, labels = c("decade 1", "decade 2"))
granova.ds(
data.frame(CO2_rev4$decade_2, CO2_rev4$decade_1),
xlab = "decade 2",
ylab = "decade 1"
)
## Summary Stats
## n 241.000
## mean(x) 4.799
## mean(y) 4.512
## mean(D=x-y) 0.287
## SD(D) 1.751
## ES(D) 0.164
## r(x,y) 0.961
## r(x+y,d) -0.144
## LL 95%CI 0.065
## UL 95%CI 0.509
## t(D-bar) 2.542
## df.t 240.000
## pval.t 0.012
mean_global <- colMeans(CO2_rev2[,-1])
years <- c(1994:2014)
CO2_mean_global <- as.data.frame(cbind(years,mean_global))
plot(mean_global ~ years, data = CO2_mean_global, main="Scatter plot of CO2 emissions per year", xlab = "years", ylab = "CO2 emission")
-[1]William Doane, Assessment & Evaluation, Statistics Dependent Sample Assessment, Plots using GRANOVA AND R, 2010 JULY 2014, https://drdoane.com/dependent-sample-assessment-plots/
-[2] Testing the Null: Data on Trial, James Baglin, https://astral-theory-157510.appspot.com/secured/MATH1324_Module_07.html
-[3] Sampling: Randomly Representative, James Baglin, https://astral-theory-157510.appspot.com/secured/MATH1324_Module_07.html
-[4] Tidy and Manipulate: Tidy Data Principles and Manipulating Data, Dr. Anil Dolgun, http://rare-phoenix-161610.appspot.com/secured/Module_04.html
-[5] Scan: Missing Values, Dr. Anil Dolgun, http://rare-phoenix-161610.appspot.com/secured/Module_05.html
-[6] Scan: Outliers, Dr. Anil Dolgun, http://rare-phoenix-161610.appspot.com/secured/Module_06.html
-[7] Get: Importing, Scraping and Exporting Data with R, Dr Anil Dolgun http://rare-phoenix-161610.appspot.com/secured/Module_02.html