Hello,

using spTimer i have written the following code to predict in 2015
based on observed data from 2010, 2011, 2012 and 2014. The data file
is attached into this mail.

# Beginning of the code

library(sp)
library(spacetime)
library(gstat)
library(spTimer)
library(timeDate)
setwd("/home//tchakounte//Bureau//Bureau.6.5.2014//nao")
dataSet <- read.csv("DTPP.csv", sep=";")
str(dataSet)
# drop the last two empty rows
#dataSet <- dataSet[1:195,]
#str(dataSet)
dataSet
coords<-as.matrix(unique(cbind(dataSet[,2:3])))
coords
time.data<-spT.time(t.series=39,segment=1)
post.ar <- spT.Gibbs(formula=Population~1, data=dataSet,
coords=coords, model="GP", scale.transform="SQRT")
print(post.ar)
names(post.ar)

# Temporal prediction/forecast for the GP model
 # 1. In the unobserved locations

dataSet1 <- read.csv("DTP11.csv", sep=";")
str(dataSet1)
dataSet1
# define forecast coordinates
fore.coords<-as.matrix(unique(cbind(dataSet1[,2:3])))
 # Two-step ahead forecast, i.e., in day 61 and 62
 # in the unobserved locations using output from spT.Gibbs
   set.seed(11)
   fore.gp <- predict(post.ar, newdata=dataSet1,
newcoords=fore.coords, type="temporal", foreStep=1, tol.dist=0.2,
time.data=time.data)
   print(fore.gp)
   names(fore.gp)
 # Display of the results
   fore.gp$Mean

# End

I obtained in 2015 the following data. But they are far from data in
2014 (pop2014 column) and to the reality . What can be the reason? Is
it possible to improve these results? is the code not good?

9091.872
12556.05
8597.584
13149.06
13274.52
12901.98
5943.395
12714.68
12244.41
14581.41
10488.06
10456.81
10456.72
10618.93
10868.03
9995.434
10011.75
9852.718
10038.11
10813.48
10588.04
10531.63
10320.15
13652.01
9871.999
12379.98
12971.01
12034.11
11955.15
14497.78
10812.44
10714.2
10360.53
10632.32
10596.62
10256.28
10279.86
9967.04
10362.7

Thanks in advance.

Franklin Tchakounté
s.index;Longitude;Latitude;Year;Month;Day;Population
1;13.575568;7.29879;2010;1;1;5720
1;13.575568;7.29879;2011;1;1;6945
1;13.575568;7.29879;2012;1;1;7119
1;13.575568;7.29879;2013;1;1;7660
1;13.575568;7.29879;2014;1;1;7851
2;13.567078;7.300748;2010;1;1;3280
2;13.567078;7.300748;2011;1;1;3983
2;13.567078;7.300748;2012;1;1;4083
2;13.567078;7.300748;2013;1;1;4393
2;13.567078;7.300748;2014;1;1;4503
3;13.581069 ;7.272185;2010;1;1;1373
3;13.581069 ;7.272185;2011;1;1;1667
3;13.581069 ;7.272185;2012;1;1;1708
3;13.581069 ;7.272185;2013;1;1;1838
3;13.581069 ;7.272185;2014;1;1;1884
4;13.590846;7.297513;2010;1;1;421
4;13.590846;7.297513;2011;1;1;511
4;13.590846;7.297513;2012;1;1;524
4;13.590846;7.297513;2013;1;1;564
4;13.590846;7.297513;2014;1;1;578
5;13.573508;7.3079;2010;1;1;2024
5;13.573508;7.3079;2011;1;1;2458
5;13.573508;7.3079;2012;1;1;2519
5;13.573508;7.3079;2013;1;1;2710
5;13.573508;7.3079;2014;1;1;2778
6;13.571362;7.303132;2010;1;1;464
6;13.571362;7.303132;2011;1;1;564
6;13.571362;7.303132;2012;1;1;578
6;13.571362;7.303132;2013;1;1;622
6;13.571362;7.303132;2014;1;1;637
7;13.626552;7.170303;2010;1;1;932
7;13.626552;7.170303;2011;1;1;1132
7;13.626552;7.170303;2012;1;1;1160
7;13.626552;7.170303;2013;1;1;1248
7;13.626552;7.170303;2014;1;1;1279
8;13.575826;7.289;2010;1;1;2807
8;13.575826;7.289;2011;1;1;3409
8;13.575826;7.289;2012;1;1;3494
8;13.575826;7.289;2013;1;1;3759
8;13.575826;7.289;2014;1;1;3853
9;13.580203;7.274611;2010;1;1;326
9;13.580203;7.274611;2011;1;1;396
9;13.580203;7.274611;2012;1;1;406
9;13.580203;7.274611;2013;1;1;437
9;13.580203;7.274611;2014;1;1;448
10;13.593335;7.32416;2010;1;1;8147
10;13.593335;7.32416;2011;1;1;7620
10;13.593335;7.32416;2012;1;1;7811
10;13.593335;7.32416;2013;1;1;8405
10;13.593335;7.32416;2014;1;1;8615
11;13.587241;7.327735;2010;1;1;6143
11;13.587241;7.327735;2011;1;1;5746
11;13.587241;7.327735;2012;1;1;5890
11;13.587241;7.327735;2013;1;1;6338
11;13.587241;7.327735;2014;1;1;6496
12;13.582442;7.320201;2010;1;1;7440
12;13.582442;7.320201;2011;1;1;6959
12;13.582442;7.320201;2012;1;1;7133
12;13.582442;7.320201;2013;1;1;7675
12;13.582442;7.320201;2014;1;1;7867
13;13.588357;7.317945;2010;1;1;7025
13;13.588357;7.317945;2011;1;1;6571
13;13.588357;7.317945;2012;1;1;6736
13;13.588357;7.317945;2013;1;1;7248
13;13.588357;7.317945;2014;1;1;7429
14;13.582177;7.322713;2010;1;1;4986
14;13.582177;7.322713;2011;1;1;4664
14;13.582177;7.322713;2012;1;1;4780
14;13.582177;7.322713;2013;1;1;5143
14;13.582177;7.322713;2014;1;1;5271
15;13.589902;7.322202;2010;1;1;6914
15;13.589902;7.322202;2011;1;1;6467
15;13.589902;7.322202;2012;1;1;6629
15;13.589902;7.322202;2013;1;1;7132
15;13.589902;7.322202;2014;1;1;7310
16;13.586812;7.314455;2010;1;1;2297
16;13.586812;7.314455;2011;1;1;2148
16;13.586812;7.314455;2012;1;1;2202
16;13.586812;7.314455;2013;1;1;2369
16;13.586812;7.314455;2014;1;1;2428
17;13.571534;7.318797;2010;1;1;6193
17;13.571534;7.318797;2011;1;1;5793
17;13.571534;7.318797;2012;1;1;5937
17;13.571534;7.318797;2013;1;1;6388
17;13.571534;7.318797;2014;1;1;6548
18;13.573852;7.314966;2010;1;1;3310
18;13.573852;7.314966;2011;1;1;3096
18;13.573852;7.314966;2012;1;1;3174
18;13.573852;7.314966;2013;1;1;3415
18;13.573852;7.314966;2014;1;1;3500
19;13.60287;7.333652;2010;1;1;3640
19;13.60287;7.333652;2011;1;1;3405
19;13.60287;7.333652;2012;1;1;3490
19;13.60287;7.333652;2013;1;1;3755
19;13.60287;7.333652;2014;1;1;3849
20;13.593593;7.319393;2010;1;1;6191
20;13.593593;7.319393;2011;1;1;5792
20;13.593593;7.319393;2012;1;1;5936
20;13.593593;7.319393;2013;1;1;6387
20;13.593593;7.319393;2014;1;1;6547
21;13.584323;7.325522;2010;1;1;4977
21;13.584323;7.325522;2011;1;1;4656
21;13.584323;7.325522;2012;1;1;4772
21;13.584323;7.325522;2013;1;1;5135
21;13.584323;7.325522;2014;1;1;5263
22;13.597283;7.31752;2010;1;1;10504
22;13.597283;7.31752;2011;1;1;12232
22;13.597283;7.31752;2012;1;1;12538
22;13.597283;7.31752;2013;1;1;13491
22;13.597283;7.31752;2014;1;1;13828
23;13.595138;7.315051;2010;1;1;10959
23;13.595138;7.315051;2011;1;1;12762
23;13.595138;7.315051;2012;1;1;13081
23;13.595138;7.315051;2013;1;1;14075
23;13.595138;7.315051;2014;1;1;14427
24;13.599257;7.305005;2010;1;1;14119
24;13.599257;7.305005;2011;1;1;16442
24;13.599257;7.305005;2012;1;1;16853
24;13.599257;7.305005;2013;1;1;18134
24;13.599257;7.305005;2014;1;1;18587
25;13.59076;7.30841;2010;1;1;4943
25;13.59076;7.30841;2011;1;1;5756
25;13.59076;7.30841;2012;1;1;5900
25;13.59076;7.30841;2013;1;1;6348
25;13.59076;7.30841;2014;1;1;6507
26;13.625264;7.307644;2010;1;1;1537
26;13.625264;7.307644;2011;1;1;1790
26;13.625264;7.307644;2012;1;1;1835
26;13.625264;7.307644;2013;1;1;1974
26;13.625264;7.307644;2014;1;1;2023
27;13.611102;7.328927;2010;1;1;494
27;13.611102;7.328927;2011;1;1;575
27;13.611102;7.328927;2012;1;1;590
27;13.611102;7.328927;2013;1;1;635
27;13.611102;7.328927;2014;1;1;651
28;13.650756;7.310964;2010;1;1;1041
28;13.650756;7.310964;2011;1;1;1212
28;13.650756;7.310964;2012;1;1;1243
28;13.650756;7.310964;2013;1;1;1337
28;13.650756;7.310964;2014;1;1;1370
29;13.630242;7.291639;2010;1;1;609
29;13.630242;7.291639;2011;1;1;709
29;13.630242;7.291639;2012;1;1;727
29;13.630242;7.291639;2013;1;1;782
29;13.630242;7.291639;2014;1;1;801
30;13.589387;7.330034;2010;1;1;6318
30;13.589387;7.330034;2011;1;1;5909
30;13.589387;7.330034;2012;1;1;6056
30;13.589387;7.330034;2013;1;1;6516
30;13.589387;7.330034;2014;1;1;6679
31;13.591189;7.334546;2010;1;1;6428
31;13.591189;7.334546;2011;1;1;6012
31;13.591189;7.334546;2012;1;1;6162
31;13.591189;7.334546;2013;1;1;6630
31;13.591189;7.334546;2014;1;1;6796
32;13.594708;7.332077;2010;1;1;6373
32;13.594708;7.332077;2011;1;1;5960
32;13.594708;7.332077;2012;1;1;6109
32;13.594708;7.332077;2013;1;1;6262
32;13.594708;7.332077;2014;1;1;6418
33;13.584838;7.336929;2010;1;1;6352
33;13.584838;7.336929;2011;1;1;5941
33;13.584838;7.336929;2012;1;1;6089
33;13.584838;7.336929;2013;1;1;6573
33;13.584838;7.336929;2014;1;1;6737
34;13.582091;7.332247;2010;1;1;7631
34;13.582091;7.332247;2011;1;1;7137
34;13.582091;7.332247;2012;1;1;7315
34;13.582091;7.332247;2013;1;1;7871
34;13.582091;7.332247;2014;1;1;8067
35;13.580117;7.327225;2010;1;1;7566
35;13.580117;7.327225;2011;1;1;7076
35;13.580117;7.327225;2012;1;1;7253
35;13.580117;7.327225;2013;1;1;7804
35;13.580117;7.327225;2014;1;1;7999
36;13.575139;7.330119;2010;1;1;5788
36;13.575139;7.330119;2011;1;1;5413
36;13.575139;7.330119;2012;1;1;5548
36;13.575139;7.330119;2013;1;1;5970
36;13.575139;7.330119;2014;1;1;6119
37;13.570247;7.330715;2010;1;1;6558
37;13.570247;7.330715;2011;1;1;6133
37;13.570247;7.330715;2012;1;1;6286
37;13.570247;7.330715;2013;1;1;6764
37;13.570247;7.330715;2014;1;1;6933
38;13.561757;7.356338;2010;1;1;1239
38;13.561757;7.356338;2011;1;1;1159
38;13.561757;7.356338;2012;1;1;1188
38;13.561757;7.356338;2013;1;1;1278
38;13.561757;7.356338;2014;1;1;1310
39;13.581662;7.357274;2010;1;1;4705
39;13.581662;7.357274;2011;1;1;4400
39;13.581662;7.357274;2012;1;1;4510
39;13.581662;7.357274;2013;1;1;4853
39;13.581662;7.357274;2014;1;1;4974
s.index;Longitude;Latitude;Year;Month;Day;Population
1;13.575568;7.29879;2015;1;1;
2;13.567078;7.300748;2015;1;1;
3;13.581069;7.272185;2015;1;1;
4;13.590846;7.297513;2015;1;1;
5;13.573508;7.3079;2015;1;1;
6;13.571362;7.303132;2015;1;1;
7;13.626552;7.170303;2015;1;1;
8;13.575826;7.289;2015;1;1;
9;13.580203;7.274611;2015;1;1;
10;13.593335;7.32416;2015;1;1;
11;13.587241;7.327735;2015;1;1;
12;13.582442;7.320201;2015;1;1;
13;13.588357;7.317945;2015;1;1;
14;13.582177;7.322713;2015;1;1;
15;13.589902;7.322202;2015;1;1;
16;13.586812;7.314455;2015;1;1;
17;13.571534;7.318797;2015;1;1;
18;13.573852;7.314966;2015;1;1;
19;13.60287;7.333652;2015;1;1;
20;13.593593;7.319393;2015;1;1;
21;13.584323;7.325522;2015;1;1;
22;13.597283;7.31752;2015;1;1;
23;13.595138;7.315051;2015;1;1;
24;13.599257;7.305005;2015;1;1;
25;13.59076;7.30841;2015;1;1;
26;13.625264;7.307644;2015;1;1;
27;13.611102;7.328927;2015;1;1;
28;13.650756;7.310964;2015;1;1;
29;13.630242;7.291639;2015;1;1;
30;13.589387;7.330034;2015;1;1;
31;13.591189;7.334546;2015;1;1;
32;13.594708;7.332077;2015;1;1;
33;13.584838;7.336929;2015;1;1;
34;13.582091;7.332247;2015;1;1;
35;13.580117;7.327225;2015;1;1;
36;13.575139;7.330119;2015;1;1;
37;13.570247;7.330715;2015;1;1;
38;13.561757;7.356338;2015;1;1;
39;13.581662;7.357274;2015;1;1;
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to