0

バリオグラム モデルと最終的なクリギング モデルを構築したい一連のサンプルがあります。まず、以下に示すように、データのトレンドを除去する必要があります。

samples
     x    y         z
1   180 1180  2.763441
2   180  240 -2.000000
3   380 1840  1.720087
4   720   80  4.056754
5   860  800  4.361503
6  620 1360  4.737717
7   980 1920  4.352956
8  1680  260  4.568255
9  1520  800  5.025272
10 1100 1220  4.693432
11  800 1460  2.470927
12  360 1900  1.455169
13  700 1760  2.894159
14  720 1540  2.115742
15  660 1480  1.749017
16  540 1680  3.291592
17  260 1280  2.962401
18  440 1640  2.422442
19  280 1260  2.966076
20  580 1580  3.178913
21  600 1220  3.752786
22  240 1700  1.748011
23  480 1440  3.106302
24  740 1880  4.827699
25  760 1320  3.603621
26 1560 1640  5.410076
27 1960 1980  6.145778
28 1520 1620  5.499064
29 1900 1820  5.316121
30 1780 1580  5.318344
31  100  740  2.019103
32  180  760  2.353693
33  140  200  1.714856
34  380  720  3.526107
35  240  580  3.075283
36  260  600  3.329397
37  340  360  3.188613
38  280  680  2.626241
39  420  700  3.211163
40  500  240  2.960805
41  460  280  3.171664
42  480  300  2.828883
43  400  640  3.227938
44  440  480  2.420358
45  300  560  4.021187
46 1380  220  5.364264
47 1500  740  5.344526
48 1240  380  4.632060
49 1420  360  4.012537
50 1280  800  4.122139
51 1400  600  5.033020
52 1300  640  4.215308
53 1460  200  5.116025
54 1220  440  4.550290
55 1200  520  3.788613
56 1540  340  5.772432
57 1520  660  5.656598
58 1480  260  5.423685
59 1360  780  4.728220
60 1260  240  3.683696


print(mean(samples$z))

h <- gstat(formula=z~1, locations=~x+y, data=samples)
samples.vgm <- variogram(h) 
plot(samples.vgm,main='Variogram of Samples NOT detrended') 


z = samples$z
x = samples$x
y = samples$y 
trend <- lm(z~x+y)

c = trend$coefficients[[1]]
a = trend$coefficients[[2]]
b = trend$coefficients[[3]]



Xs <- c()  
Ys <- c()  
Zs <- c()  

print('started the loop')
for (i in 1:nrow(samples)){
  i = samples[i,]
  x=i$x
  y=i$y
  z=i$z
  z_prime = z - (a*x+b*y+c)
  Xs <- c(Xs,x)
  Ys <- c(Ys,y)
  Zs <- c(Zs,z_prime) 
}
sampled <- data.frame(Xs,Ys,Zs)
print(sampled)
print('the length of sampled is')
print(length(sampled[[1]]))
print(levelplot(Zs~Xs+Ys,sampled))

x <- seq(0,2000,by=20)
y <- seq(0,2000,by=20)

pred.grid <- data.frame(x=rep(x,times=length(y)),y=rep(y,each=length(x)))

g <- gstat(formula=Zs~1, locations=~Xs+Ys, data=sampled)
sampled.vgm <- variogram(g) 
plot(sampled.vgm,main='Variogram of Samples hopefully detrended') 

問題は、トレンド除去されたバリオグラム (つまり、上記のバリオグラム) のプロットが、やはり上記のトレンド除去されていないgバリオグラムとまったく同じに見えることです。これが起こる理由は何ですか?? h

データは明らかに異なります。予測どおり、トレンド除去バージョンの値の平均は です。0しかし、トレンド除去されていないバージョンの平均値は3.556、やはり期待どおりです。

ここでキャッチしていないものはありますか?

4

1 に答える 1

0

問題は概念的なものであり、コードとは関係ないと思うので、この質問がここに属しているかどうかはわかりません。私は新しいので、先に進んで簡単なフィードバックを提供します。

バリオグラムは、特定の空間ラグ内のデータの分散 (技術的には半分散) をプロットします。データに線形変換を適用すると、分散が変更されるとは思えないため、バリオグラム モデルから異なるパラメーターが表示されることはありません。代わりに、クリギングされたサーフェスは異なる平均値をとります。

ps コードを誰でもコピー アンド ペーストできるようにすると便利です。たとえば、コード化されたテスト データを含めます。

于 2015-04-03T03:08:08.883 に答える