Commit f7be610e authored by Staritsky, Igor's avatar Staritsky, Igor
Browse files

Scripts and data used for article

parent 39c93b86
#clean-up memory:
rm(list = ls())
#load packages:
library(reshape2)
library(matrixStats)
library(ggplot2)
#set work dictionary:
setwd("I:/Students/Biqing/$Thesis_Scripts_Final")
# set options (print warnings as they occur)
options(warn = 2)
install.package(matrixStats)
install.packages(matrixStats)
install.packages(reshape)
install.packages(reshape2)
library(reshape2)
library(matrixStats)
install.packages("matrixStats")
library(matrixStats)
library(ggplot2)
#set work dictionary:
setwd("I:/Students/Biqing/$Thesis_Scripts_Final")
# set options (print warnings as they occur)
options(warn = 2)
FAO_CA <- read.csv("stat_FAO_NatCropArea.csv",header = T)
order_FAO_CA <- FAO_CA[order(-FAO_CA$mean),]
# plot the highest five rows
Soybean_CA <- order_FAO_CA[order_FAO_CA$CROPCODE == 236,,drop = F]
Soybean_CA <- Soybean_CA[1:5,c(1,3:15),drop=F]
temp <- melt(Barley_CA,id="COUNTRYCODE")
colnames(temp) <- c("Country","year", "CropArea")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))
FAO_CA <- read.csv("stat_FAO_NatCropArea.csv",header = T)
setwd("I:/Students/Biqing/$Thesis_Scripts_Final/UQ_in_FAO")
FAO_CA <- read.csv("stat_FAO_NatCropArea.csv",header = T)
order_FAO_CA <- FAO_CA[order(-FAO_CA$mean),]
# plot the highest five rows
Soybean_CA <- order_FAO_CA[order_FAO_CA$CROPCODE == 236,,drop = F]
Soybean_CA <- Soybean_CA[1:5,c(1,3:15),drop=F]
temp <- melt(Barley_CA,id="COUNTRYCODE")
colnames(temp) <- c("Country","year", "CropArea")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))
temp <- melt(Soybean_CA,id="COUNTRYCODE")
colnames(temp) <- c("Country","year", "CropArea")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))
FAO_CA <- read.csv("stat_FAO_NatCropArea.csv",header = T)
order_FAO_CA <- FAO_CA[order(-FAO_CA$mean),]
# plot the highest five rows
Soybean_CA <- order_FAO_CA[order_FAO_CA$CROPCODE == 236,,drop = F]
Soybean_CA <- Soybean_CA[1:5,c(1,3:15),drop=F]
temp <- melt(Soybean_CA,id="COUNTRYCODE")
colnames(temp) <- c("Country","year", "CropArea")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))+ labs(fill="Country Code")
labs(fill="Country Code")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))+ scale_fill_discrete(name="Condition")
View(temp)
View(Soybean_CA)
FAO_CA <- read.csv("stat_FAO_NatCropArea.csv",header = T)
order_FAO_CA <- FAO_CA[order(-FAO_CA$mean),]
# plot the highest five rows
Soybean_CA <- order_FAO_CA[order_FAO_CA$CROPCODE == 236,,drop = F]
Soybean_CA <- Soybean_CA[1:5,c(1,3:15),drop=F]
colnames(Soybean_CA)[3:15] <- c(2000:2012)
View(Soybean_CA)
colnames(Soybean_CA)[2:14] <- c(2000:2012)
View(Soybean_CA)
temp <- melt(Soybean_CA,id="COUNTRYCODE")
colnames(temp) <- c("Country","year", "CropArea")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))+ scale_fill_discrete(name="Condition")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))+ scale_fill_discrete(shape="Condition")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))+ labs(shape="Condition")
ggplot(temp, aes(x=year, y=CropArea,shape=as.character(Country)))+ geom_point(size=4) +
scale_shape_manual(values=c(18,16,5,4,17))+ labs(shape="Country Code")
install.packages("msbvar")
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
COUNTRYCODE,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010
3,,,,,,,,,,,
4,,,,,,,0.25,,,,
7,,,,,,,,,,,
9,,,,,,,,,,,
1,,,,0.2,0.41,0.44,0.45,0.48,0.43,0.4,0.55
10,,,,,,,,,,,
11,2.42,2.15,2.11,2.32,2.27,2.34,2.35,2.43,2.95,2.46,2.58
12,107.82,83.45,85.27,73,65.73,78.09,68.36,,,,
13,1.54,1.73,0.19,1.43,2.55,2.77,2.64,3.64,2.38,2.98,
16,0.36,1.52,1.32,1.58,2.03,2.29,2.68,3.33,3.94,1.59,1.54
14,,,,,,,,,,,
255,10.83,9.82,10.76,10.28,10.64,11.29,,,,,
15,,,,,,,,,,,
23,13.09,17.36,,,,,7.56,6.62,9.65,7.5,
18,0.06,,0.05,0.13,0.15,0.04,0.1,0.13,0.18,0.06,0.1
19,,,,3.53,4.59,4.85,5.55,5.91,6.32,7.1,8.1
20,,,,,,,,,,,
21,0.96,1.15,,,,,,,,,
27,,,,,,,,,,,
233,,,,0.02,0.01,0.09,0.12,0.36,0.15,0.18,0.08
29,0.08,0.05,0.07,0.2,0.37,0.23,,,,,
35,0.15,0.1,,,,,,,,,
32,0.08,0.1,0.85,1.03,0.98,0.87,1.07,1.09,1,0.88,1.24
33,,,,,,,0.72,,1.09,,
37,,,,,,,,,,,
39,,,,,,,,,,,
40,,,7.64,9.42,5.08,11.49,11.73,12,13.96,12.49,11.63
351,9.75,9.78,10.15,6.05,6.18,8.84,10.65,14.48,15.59,16.87,17.81
44,16.69,20.68,22.49,23.68,28.46,32.63,29.18,23.09,14.02,15.34,14.5
46,,,,,,,,,,,
47,0.33,,0.4,0.6,1,1,1.33,1.33,1.33,1.33,
48,52.79,21.84,,,,,,,,,24.56
107,,,,,,,,,,,
98,,,,,,,,,,,
50,8.94,11.12,11.63,9.69,10.34,8.15,6.81,7.32,8.25,8.7,
167,1.37,1.4,1.51,1.39,1.61,1.64,1.74,1.89,,,
54,1.39,1.44,1.26,1.3,1.27,1.39,1.37,1.43,1.71,1.15,1.6
56,3.85,5.46,,0.67,2.92,2.77,3.24,4.48,4.33,4.78,5.06
58,6.02,2.62,0.5,12.32,11.81,7.33,3.25,5.86,6.16,3.79,12.27
59,,,,,,,,,,,
60,,,,,,3.04,2.58,2.24,6.51,3.61,13.33
178,,0.05,,,,,,,,,
63,0.37,0.47,0.52,0.58,0.66,0.64,0.8,0.76,0.91,0.67,0.79
238,0.06,0.06,,,,,,,,,
66,,,,,,,,,,,
67,0.52,0.65,0.73,0.75,0.67,0.64,0.73,0.65,0.72,0.75,0.78
68,5,5.09,4.21,3.81,3.89,3.98,3.65,3.96,4.05,3.28,
70,,,1.64,,1.88,2.2,1.8,1.92,2.12,1.84,1.14
75,0.96,0.73,0.88,1.1,1.75,2.43,6.92,1.91,,,
79,2.93,2.78,2.87,2.95,2.89,3.01,3.19,3.37,3.58,3.24,3.39
81,0.01,0.01,0.48,,0.64,0.68,3.42,0.65,1.77,1.97,
84,2.76,2.78,,,,,,,,,
89,,,,4.19,5.2,6.03,6.77,9.1,7.98,5.43,6.09
90,,,,,,,,,,0.13,
175,,0.15,,,,,,,,,
93,0.02,,,,,,,,,,
95,3.07,0.8,,,,,2.95,3.31,3.63,3.03,3.92
97,0.86,1.14,1.72,1.82,2.07,2.01,2.4,2.33,2.53,2.33,2.25
99,0.03,0.05,0.03,0.03,0.05,0.04,0.04,0.04,0.04,,
100,,,,0.24,0.21,0.21,0.22,0.21,0.09,0.17,0.24
101,,,,,,,,,,,
102,1.56,1.41,1.46,1.52,1.47,1.17,1.21,0.84,0.42,0.37,
103,0.12,0.19,0.18,,0.18,0.16,0.17,0.21,,,
104,1.8,1.96,2.22,2.3,2.47,2.21,2.39,2.9,2.53,2.08,2.5
105,,,,,,,,,,,
106,7.04,6.82,8.65,8.17,7.96,8.19,7.49,8.29,7.95,5.66,7.35
109,,,,,,,,,,,
110,16.53,16.43,14.75,14.33,13.72,13.6,13.97,13.15,12.69,13.23,12.1
112,1.99,4.64,9.47,8.94,5.33,10.78,7.71,10.66,5.61,3.6,4.74
108,0.16,0.47,0.45,0.41,0.73,0.51,0.73,0.6,,,
114,0.37,0.28,,,,,,,,,
118,,,,,,,,,,,
113,0.48,0.43,0.52,0.92,0.94,0.8,0.59,0.76,0.49,0.2,0.26
120,0,,,,,,0,,,0.02,
119,0.31,0.39,0.35,0.5,0.58,0.66,0.61,0.94,,,
121,,,,,,,,,,,
126,0.24,0.43,0.47,0.54,0.62,0.54,0.63,1.46,1.44,1.32,0.84
129,0.04,0.02,0.07,0.04,0.02,0.03,0.03,0.03,0.03,0.04,0.06
130,0.22,,,,,,,0.07,0.15,0.14,
131,,,,,,,5.2,6.18,7.23,,
133,,,,,,0.01,0.01,0.01,0.01,0,0
134,20.22,11,,,,,,13.01,,,
137,17.37,19.79,21.06,24.15,22.77,24.06,27.44,23.12,26.77,27.67,31.02
138,2.27,2,1.04,1.48,1.67,4.84,4.92,5.23,5.07,4.55,
273,,,,,,,,,,,0.35
143,,,,,1.67,1.55,1.53,,,,
144,,,0,0.06,0.12,0.16,0.18,0.11,0.18,0.17,0.22
28,,0.07,0.09,0.08,0.1,0.13,0.34,0.29,0.36,0.26,0.75
147,,,,,,,,,,,
149,,,,,0.06,0.06,0.05,,,,
150,12.06,10.05,10.18,10.14,9.15,9.32,9.49,11.04,9.78,9.04,8.75
153,,,,,,,,,0.15,3.17,2.58
156,2.34,2.14,,,,,,9.88,,,
157,2.02,1.67,2.56,2.46,2.09,4.11,3.13,4.51,4.78,4.41,5.75
158,0,0,,,,0,0,0,0,0,0
162,0.39,0.58,0.9,0.76,0.95,0.6,0.81,0.84,0.94,0.64,0.84
299,,,14.8,14.67,14.71,14.99,15.92,16.01,17.36,,
221,1.34,,,,,,,,,,4.53
165,1.27,0.54,,,,,,,,,
166,2.83,8.06,6.66,7.67,7.95,8.56,8.24,6.43,,,
168,,,,,,,,,,,
169,1.13,3.31,,,,,,,,,
170,1.21,1.98,1.95,1.89,2.09,2.35,2.74,2.04,2.84,2.6,3.49
173,0.62,0.64,0.78,0.56,0.67,1.28,1.34,1.45,1.59,1.43,1.72
174,6.45,6.55,7.34,7.39,7.33,7.97,7.73,8,8,6.5,6.44
179,4.25,,,,,,,,,,
117,13.39,14.94,13.87,13.33,13.79,13.44,13.38,13.62,14.42,13.12,
146,1.33,1.34,1.22,1.27,1.36,1.12,1.16,1.2,1.38,1.09,1.17
183,0.95,0.8,0.8,0.7,0.73,0.8,0.72,0.69,0.78,0.71,0.75
185,,,,,,,,,,,
184,0.13,0.06,,0.1,0.12,0.16,0.21,0.29,0.22,0.81,0.65
188,1.47,1.51,1.69,1.83,1.86,3.25,3.24,3.18,3.9,3.81,
189,,,,,,,,,,,
244,0.16,,,,,,,,,,
194,,,,,,,,1.18,,,
195,0.16,0.09,,,,,,,,,
186,0.85,0.91,0.81,0.72,0.74,,,,,,
196,,,,,,,,,,,
199,0.92,1.04,1.13,1.04,1.1,1.08,1.12,1.13,1.06,1.17,1.31
198,7.2,6.83,5.88,6.74,7.6,6.78,6.22,5.75,5.91,5.79,5.75
202,1.89,,,,,,,,,,
277,,,,,,,,,,,
203,1.89,1.98,,,,,,,,,
38,,,,,,,0.88,0.74,0.53,0.57,0.67
276,,,,,,,,,,,
206,0.02,,,,,,,,,,
207,2.63,,11.44,12.93,11.95,14.16,12.49,15.81,16.79,15.22,12.75
210,0.64,0.66,0.82,0.96,0.51,0.79,0.83,0.81,0.89,0.73,0.75
211,3.61,3.58,3.53,3.44,3.23,3.22,3.16,4.88,4.68,5.05,4.81
212,0.61,0.63,,,,,,,,,
208,,,,,,,,,,,
216,1.07,,,3.51,6.32,3.03,2.82,3.52,3.4,4.11,
154,0.49,0.29,0.44,0.41,0.51,0.31,0.69,0.25,0.18,0.22,
176,,,,0.01,0,0,,0.01,0,0.01,
217,,,,0.17,0.24,0.09,0.12,0.11,0.09,0.07,0.09
220,,,,,,,,,,,
222,,,,,,,,,,0.43,
223,1.27,0.97,1.05,1.27,1.08,1.52,1.31,1.96,1.63,1.53,1.59
213,,,,,,,,,,,
226,,,,,,,,,,,
230,,,,0.38,0.46,0.67,0.84,1.05,1.58,1.06,1.83
229,3.53,3.66,3.46,3.49,3.59,3.68,3.17,3.64,3.57,3.5,2.79
215,,,,,,,,,,,
231,2.41,2.31,2.37,2.4,2.5,2.39,2.41,2.42,,,
234,2.58,3.14,3.82,5.54,6.7,6.84,6.87,10.21,7.84,7.03,8.6
228,,,,,,,,,,,
155,,,,,,,,,,,
236,,,,,,,,,,,
237,2.03,2.17,,,,,,,,,
249,0.77,,1.13,0.5,0.39,0.52,0.46,0.12,0.05,0.06,0.08
248,,,,,,,,,,,
251,,,,,,,,,,,
181,,,,,,,,,,,
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#####################fao data overview#####################
[FAO_NatCropArea]
average weight cv without corrected by trend 0.0773572
average weight cv corrected by trend with RMSE method 0.03922327
[FAO_NatCropProd]
average weight cv without corrected by trend 0.1312972
average weight cv corrected by trend with RMSE method 0.05388498
[FAO_NatAnimals]
average weight cv without corrected by trend 0.09859559
average weight cv corrected by trend with RMSE method 0.04621655
[FAO_LandAreas]
average weight cv without corrected by trend 0.007667116
average weight cv corrected by trend with RMSE method 0.002907561
[FAO_AnimalProd]
average weight cv without corrected by trend 0.09880323
average weight cv corrected by trend with RMSE method 0.02066976
[FAO_ProducingAnimals]
average weight cv without corrected by trend 0.09385744
average weight cv corrected by trend with RMSE method 0.02860298
[FAO_NatFertilizer]
average weight cv without corrected by trend 0.150237
average weight cv corrected by trend with RMSE method 0.08153634
[FertilizerType]
average weight cv without corrected by trend 0.8075704
average weight cv corrected by trend with RMSE method 0.5713635
[feedset_Crops]
average weight cv without corrected by trend 0.1258421
average weight cv corrected by trend with RMSE method 0.07533321
[feedset_Animals]
average weight cv without corrected by trend 0.1423005
average weight cv corrected by trend with RMSE method 0.06844885
[PesticideUse]
average weight cv without corrected by trend 0.2616934
average weight cv corrected by trend with RMSE method 0.15824
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment