我想使用 gstat 包执行普通克里金法。我只有 17 个位置,这还不够,所以我还使用每个节点的时间数据作为辅助数据来构建变异函数。但是,我想出了这个错误,请在这件事上指导我。此外,gstat 不能处理近距离坐标,如果您知道 r 中另一个强大的包,请告诉我。
我正在使用的代码:
mat <- transform(mat, E = as.numeric(mat$E), N = as.numeric(mat$N))
coordinates(mat) <- ~E+N
E.range <- as.integer(range(mat@coords[,1]))
N.range <- as.integer(range(mat@coords[,2]))
mat.new <- expand.grid(x=seq(from=E.range[1], to=E.range[2], by=35), y=seq(from=N.range[1], to=N.range[2], by=35) )
mat.new <- SpatialPoints(mat.new)
gridded(mat.new) <- FALSE
mat.mv=vgm(psill=1, model="Exp", nugget=.2, range=550)
mat.ok <- krige(X0~1, locations=mat.new ,model=mat.mv , newdata=mat.new , data=mat)
错误:
Error in gstat(formula = formula, data = locations, model = model, beta = beta, :
formal argument "data" matched by multiple actual arguments
数据:
coordinates X0
1 (2579410, 1079720) -0.586000
2 (2579330, 1079730) -2.184000
3 (2579260, 1079770) -2.532000
4 (2579930, 1080030) -0.714000
5 (2579700, 1079770) -2.452000
6 (2579540, 1079640) -1.134000
7 (2579860, 1079880) -1.204000
8 (2579540, 1079830) -2.068000
9 (2579870, 1079940) -0.506000
10 (2579560, 1079780) -1.390000
11 (2579990, 1080140) -0.530000
12 (2580010, 1080250) -0.234000
13 (2577970, 1079920) -1.860000
14 (2577850, 1079810) -1.794000
15 (2577790, 1079850) -1.136000
16 (2577930, 1079860) -1.428000
17 (2578060, 1079840) -1.610000
18 (2579410, 1079720) -0.724000
19 (2579330, 1079730) -2.322000
20 (2579260, 1079770) -2.542000
21 (2579930, 1080030) -0.826000
22 (2579700, 1079770) -2.334000
23 (2579540, 1079640) -1.122000
24 (2579860, 1079880) -1.272000
25 (2579540, 1079830) -2.210000
26 (2579870, 1079940) -0.624000
27 (2579560, 1079780) -1.216000
28 (2579990, 1080140) -0.644000
29 (2580010, 1080250) -0.156000
30 (2577970, 1079920) -1.736000
31 (2577850, 1079810) -1.676000
32 (2577790, 1079850) -0.536000
33 (2577930, 1079860) -1.534000
34 (2578060, 1079840) -1.794000
35 (2579410, 1079720) -0.444000
36 (2579330, 1079730) -1.832000
37 (2579260, 1079770) -2.108000
38 (2579930, 1080030) -0.030000
39 (2579700, 1079770) -1.556000
40 (2579540, 1079640) -0.832000
41 (2579860, 1079880) -1.028000
42 (2579540, 1079830) -1.880000
43 (2579870, 1079940) -0.032000
44 (2579560, 1079780) -0.748000
45 (2579990, 1080140) 0.012000
46 (2580010, 1080250) 0.138000
47 (2577970, 1079920) -1.882000
48 (2577850, 1079810) -1.496000
49 (2577790, 1079850) -0.376000
50 (2577930, 1079860) -1.758000
51 (2578060, 1079840) -1.518000
52 (2579410, 1079720) -0.854000
53 (2579330, 1079730) -1.924000
54 (2579260, 1079770) -1.986000
55 (2579930, 1080030) -0.768000
56 (2579700, 1079770) -2.324000
57 (2579540, 1079640) -1.564000
58 (2579860, 1079880) -1.732000
59 (2579540, 1079830) -2.212000
60 (2579870, 1079940) -0.852000
61 (2579560, 1079780) -1.774000
62 (2579990, 1080140) -0.802000
63 (2580010, 1080250) -0.656000
64 (2577970, 1079920) -1.830000
65 (2577850, 1079810) -1.322000
66 (2577790, 1079850) -0.276000
67 (2577930, 1079860) -1.470000
68 (2578060, 1079840) -1.602000
69 (2579410, 1079720) -0.828000
70 (2579330, 1079730) -2.156000
71 (2579260, 1079770) -2.246000
72 (2579930, 1080030) -0.488000
73 (2579700, 1079770) -1.890000
74 (2579540, 1079640) -1.366000
75 (2579860, 1079880) -1.366000
76 (2579540, 1079830) -2.108000
77 (2579870, 1079940) -0.514000
78 (2579560, 1079780) -1.460000
79 (2579990, 1080140) -0.412000
80 (2580010, 1080250) -0.088000
81 (2577970, 1079920) -2.096000
82 (2577850, 1079810) -1.870000
83 (2577790, 1079850) -0.898000
84 (2577930, 1079860) -1.796000
85 (2578060, 1079840) -2.084000
86 (2579410, 1079720) -0.728000
87 (2579330, 1079730) -2.024000
88 (2579260, 1079770) -2.538000
89 (2579930, 1080030) -0.292000
90 (2579700, 1079770) -1.958000
91 (2579540, 1079640) -1.378000
92 (2579860, 1079880) -1.392000
93 (2579540, 1079830) -1.846000
94 (2579870, 1079940) -0.314000
95 (2579560, 1079780) -1.306000
96 (2579990, 1080140) -0.328000
97 (2580010, 1080250) 0.058000
98 (2577970, 1079920) -1.546667
99 (2577850, 1079810) -1.776000
100 (2577790, 1079850) -0.324000
101 (2577930, 1079860) -1.620000
102 (2578060, 1079840) -1.764000
103 (2579410, 1079720) -0.314000
104 (2579330, 1079730) -1.774000
105 (2579260, 1079770) -2.074000
106 (2579930, 1080030) 0.150000
107 (2579700, 1079770) -1.484000
108 (2579540, 1079640) -1.108000
109 (2579860, 1079880) -0.930000
110 (2579540, 1079830) -1.614000
111 (2579870, 1079940) 0.006000
112 (2579560, 1079780) -0.840000
113 (2579990, 1080140) 0.034000
114 (2580010, 1080250) 0.300000
115 (2577970, 1079920) -1.954000
116 (2577850, 1079810) -1.940000
117 (2577790, 1079850) -0.744000
118 (2577930, 1079860) -1.892000
119 (2578060, 1079840) -1.852000
120 (2579410, 1079720) -1.014000
121 (2579330, 1079730) -2.214000
122 (2579260, 1079770) -2.536000
123 (2579930, 1080030) -0.462000
124 (2579700, 1079770) -2.086000
125 (2579540, 1079640) -1.512000
126 (2579860, 1079880) -1.446000
127 (2579540, 1079830) -1.908000
128 (2579870, 1079940) -0.488000
129 (2579560, 1079780) -1.636000
130 (2579990, 1080140) -0.406000
131 (2580010, 1080250) 0.030000
132 (2577970, 1079920) -1.738000
133 (2577850, 1079810) -1.868000
134 (2577790, 1079850) -0.336000
135 (2577930, 1079860) -1.702000
136 (2578060, 1079840) -1.756000
137 (2579410, 1079720) -1.284000
138 (2579330, 1079730) -2.452000
139 (2579260, 1079770) -2.948000
140 (2579930, 1080030) -1.366000
141 (2579700, 1079770) -2.460000
142 (2579540, 1079640) -2.008000
143 (2579860, 1079880) -1.860000
144 (2579540, 1079830) -2.460000
145 (2579870, 1079940) -1.370000
146 (2579560, 1079780) -2.208000
147 (2579990, 1080140) -1.072000
148 (2580010, 1080250) -0.594000
149 (2577970, 1079920) -1.548000
150 (2577850, 1079810) -1.742000
151 (2577790, 1079850) -0.926000
152 (2577930, 1079860) -1.630000
153 (2578060, 1079840) -1.576000
154 (2579410, 1079720) -0.618000
155 (2579330, 1079730) -1.836000
156 (2579260, 1079770) -2.042000
157 (2579930, 1080030) -0.992000
158 (2579700, 1079770) -2.284000
159 (2579540, 1079640) -1.678000
160 (2579860, 1079880) -1.710000
161 (2579540, 1079830) -1.132000
162 (2579870, 1079940) -1.066000
163 (2579560, 1079780) -1.746000
164 (2579990, 1080140) -0.758000
165 (2580010, 1080250) -0.574000
166 (2577970, 1079920) -0.006000
167 (2577850, 1079810) 1.142000
168 (2577790, 1079850) 0.058000
169 (2577930, 1079860) 1.146000
170 (2578060, 1079840) 0.006000
171 (2579410, 1079720) 1.052000
172 (2579330, 1079730) -0.040000
173 (2579260, 1079770) 0.570000
174 (2579930, 1080030) -0.096000
175 (2579700, 1079770) -1.402000
176 (2579540, 1079640) -0.762000
177 (2579860, 1079880) -0.940000
178 (2579540, 1079830) 0.064000
179 (2579870, 1079940) 0.040000
180 (2579560, 1079780) -0.342000
181 (2579990, 1080140) -0.020000
182 (2580010, 1080250) 0.562000
183 (2577970, 1079920) 1.444000
184 (2577850, 1079810) 2.306000
185 (2577790, 1079850) 1.188000
186 (2577930, 1079860) 1.892000
187 (2578060, 1079840) 1.552000
188 (2579410, 1079720) 2.224000
189 (2579330, 1079730) 2.192000
190 (2579260, 1079770) 3.400000
191 (2579930, 1080030) 2.344000
192 (2579700, 1079770) -0.156000
193 (2579540, 1079640) 0.576000
194 (2579860, 1079880) 1.194000
195 (2579540, 1079830) 1.510000
196 (2579870, 1079940) 2.648000
197 (2579560, 1079780) 1.368000
198 (2579990, 1080140) 2.622000
199 (2580010, 1080250) 2.184000
200 (2577970, 1079920) 2.188000
201 (2577850, 1079810) 3.000000
202 (2577790, 1079850) 2.892000
203 (2577930, 1079860) 2.444000
204 (2578060, 1079840) 1.968000
205 (2579410, 1079720) 3.434000
206 (2579330, 1079730) 0.686000
207 (2579260, 1079770) 3.340000
208 (2579930, 1080030) 3.836000
209 (2579700, 1079770) 0.770000
210 (2579540, 1079640) 0.906000
211 (2579860, 1079880) 2.502000
212 (2579540, 1079830) 2.684000
213 (2579870, 1079940) 4.874000
214 (2579560, 1079780) 2.416000
215 (2579990, 1080140) 3.652000
216 (2580010, 1080250) 3.398000
217 (2577970, 1079920) 3.100000
218 (2577850, 1079810) 3.644000
219 (2577790, 1079850) 3.248000
220 (2577930, 1079860) 3.296000
221 (2578060, 1079840) 2.512000
222 (2579410, 1079720) 3.494000
223 (2579330, 1079730) 0.602000
224 (2579260, 1079770) 2.402000
225 (2579930, 1080030) 4.352000
226 (2579700, 1079770) 1.900000
227 (2579540, 1079640) 3.068000
228 (2579860, 1079880) 3.018000
229 (2579540, 1079830) -0.108000
230 (2579870, 1079940) 4.640000
231 (2579560, 1079780) 3.822000
232 (2579990, 1080140) 4.570000
233 (2580010, 1080250) 4.358000
234 (2577970, 1079920) 4.344000
235 (2577850, 1079810) 4.710000
236 (2577790, 1079850) 4.124000
237 (2577930, 1079860) 4.776000
238 (2578060, 1079840) 3.046000
239 (2579410, 1079720) 5.066000
240 (2579330, 1079730) 2.668000
241 (2579260, 1079770) 3.698000
242 (2579930, 1080030) 4.970000
243 (2579700, 1079770) 2.382000
244 (2579540, 1079640) 3.944000
245 (2579860, 1079880) 3.648000
246 (2579540, 1079830) 2.690000
247 (2579870, 1079940) 5.350000
248 (2579560, 1079780) 4.888000
249 (2579990, 1080140) 5.308000
250 (2580010, 1080250) 4.984000
251 (2577970, 1079920) 4.778000
252 (2577850, 1079810) 5.586000
253 (2577790, 1079850) 4.888000
254 (2577930, 1079860) 5.300000
255 (2578060, 1079840) 3.866000
256 (2579410, 1079720) 5.190000
257 (2579330, 1079730) 3.942000
258 (2579260, 1079770) 3.786000
259 (2579930, 1080030) 5.044000
260 (2579700, 1079770) 3.156000
261 (2579540, 1079640) 4.932000
262 (2579860, 1079880) 3.630000
263 (2579540, 1079830) 4.162000
264 (2579870, 1079940) 4.502000
265 (2579560, 1079780) 4.346000
266 (2579990, 1080140) 5.698000
267 (2580010, 1080250) 5.420000
268 (2577970, 1079920) 5.616000
269 (2577850, 1079810) 5.926000
270 (2577790, 1079850) 5.176000
271 (2577930, 1079860) 5.502000
272 (2578060, 1079840) 3.988000
273 (2579410, 1079720) 5.914000
274 (2579330, 1079730) 4.170000
275 (2579260, 1079770) 4.478000
276 (2579930, 1080030) 6.106000
277 (2579700, 1079770) 3.982000
278 (2579540, 1079640) 4.780000
279 (2579860, 1079880) 5.194000
280 (2579540, 1079830) 4.416000
281 (2579870, 1079940) 6.336000
282 (2579560, 1079780) 4.724000
283 (2579990, 1080140) 6.208000
284 (2580010, 1080250) 6.172000
285 (2577970, 1079920) 5.700000
286 (2577850, 1079810) 5.960000
287 (2577790, 1079850) 5.854000
288 (2577930, 1079860) 5.964000
289 (2578060, 1079840) 4.582000
290 (2579410, 1079720) 4.920000
291 (2579330, 1079730) 4.134000
292 (2579260, 1079770) 4.904000
293 (2579930, 1080030) 6.898000
294 (2579700, 1079770) 4.878000
295 (2579540, 1079640) 4.210000
296 (2579860, 1079880) 5.350000
297 (2579540, 1079830) 4.342000
298 (2579870, 1079940) 6.860000
299 (2579560, 1079780) 4.164000
300 (2579990, 1080140) 5.180000
301 (2580010, 1080250) 5.204000
302 (2577970, 1079920) 5.820000
303 (2577850, 1079810) 4.416000
304 (2577790, 1079850) 4.134000
305 (2577930, 1079860) 5.088000
306 (2578060, 1079840) 4.476000
307 (2579410, 1079720) 4.338000
308 (2579330, 1079730) 2.876000
309 (2579260, 1079770) 2.654000
310 (2579930, 1080030) 4.522000
311 (2579700, 1079770) 3.366000
312 (2579540, 1079640) 3.666000
313 (2579860, 1079880) 3.522000
314 (2579540, 1079830) 3.206000
315 (2579870, 1079940) 4.620000
316 (2579560, 1079780) 3.710000
317 (2579990, 1080140) 4.698000
318 (2580010, 1080250) 4.556000
319 (2577970, 1079920) 2.656000
320 (2577850, 1079810) 2.638000
321 (2577790, 1079850) 2.964000
322 (2577930, 1079860) 2.668000
323 (2578060, 1079840) 1.936000
324 (2579410, 1079720) 2.190000
325 (2579330, 1079730) 0.666000
326 (2579260, 1079770) 0.712000
327 (2579930, 1080030) 2.426000
328 (2579700, 1079770) 1.016000
329 (2579540, 1079640) 1.140000
330 (2579860, 1079880) 1.944000
331 (2579540, 1079830) 1.468000
332 (2579870, 1079940) 2.366000
333 (2579560, 1079780) 0.786000
334 (2579990, 1080140) 2.540000
335 (2580010, 1080250) 2.744000
336 (2577970, 1079920) 1.680000
337 (2577850, 1079810) 1.348000
338 (2577790, 1079850) 1.880000
339 (2577930, 1079860) 1.820000
340 (2578060, 1079840) 1.202000
341 (2579410, 1079720) 1.704000
342 (2579330, 1079730) 0.606000
343 (2579260, 1079770) 0.370000
344 (2579930, 1080030) 1.990000
345 (2579700, 1079770) 0.894000
346 (2579540, 1079640) 1.204000
347 (2579860, 1079880) 1.214000
348 (2579540, 1079830) 1.194000
349 (2579870, 1079940) 1.800000
350 (2579560, 1079780) 1.228000
351 (2579990, 1080140) 2.156000
352 (2580010, 1080250) 2.438000
353 (2577970, 1079920) 0.862000
354 (2577850, 1079810) 0.880000
355 (2577790, 1079850) 1.290000
356 (2577930, 1079860) 0.812000
357 (2578060, 1079840) 0.444000
358 (2579410, 1079720) 1.218000
359 (2579330, 1079730) 0.118000
360 (2579260, 1079770) -0.384000
361 (2579930, 1080030) 1.456000
362 (2579700, 1079770) 0.620000
363 (2579540, 1079640) 0.798000
364 (2579860, 1079880) 0.914000
365 (2579540, 1079830) 0.682000
366 (2579870, 1079940) 1.274000
367 (2579560, 1079780) 0.734000
368 (2579990, 1080140) 1.480000
369 (2580010, 1080250) 1.770000
370 (2577970, 1079920) 0.380000
371 (2577850, 1079810) 0.194000
372 (2577790, 1079850) 1.010000
373 (2577930, 1079860) 0.374000
374 (2578060, 1079840) 0.312000
375 (2579410, 1079720) 1.004000
376 (2579330, 1079730) -0.094000
377 (2579260, 1079770) -0.392000
378 (2579930, 1080030) 1.462000
379 (2579700, 1079770) 0.260000
380 (2579540, 1079640) 0.636000
381 (2579860, 1079880) 0.682000
382 (2579540, 1079830) 0.886000
383 (2579870, 1079940) 1.196000
384 (2579560, 1079780) 0.654000
385 (2579990, 1080140) 1.516000
386 (2580010, 1080250) 1.822000
387 (2577970, 1079920) 0.112000
388 (2577850, 1079810) 0.072000
389 (2577790, 1079850) 0.718000
390 (2577930, 1079860) 0.168000
391 (2578060, 1079840) 0.384000
392 (2579410, 1079720) 0.904000
393 (2579330, 1079730) -0.240000
394 (2579260, 1079770) -0.376000
395 (2579930, 1080030) 1.360000
396 (2579700, 1079770) 0.072000
397 (2579540, 1079640) 0.534000
398 (2579860, 1079880) 0.442000
399 (2579540, 1079830) 0.322000
400 (2579870, 1079940) 1.174000
401 (2579560, 1079780) 0.482000
402 (2579990, 1080140) 1.680000
403 (2580010, 1080250) 2.398000
404 (2577970, 1079920) 0.280000
405 (2577850, 1079810) 0.296000
406 (2577790, 1079850) 0.808000
407 (2577930, 1079860) 0.420000
408 (2578060, 1079840) 0.478000
在将代码修改为此之后:
mat.mv=vgm(psill=1, model="Exp", nugget=.2, range=550)
mat.ok <- krige(X0~1, mat, mat.new, mat.mv)
我想出了这个错误:
[使用普通克里金法]
"chfactor.c", line 131: singular matrix in function LDLfactor()
Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim, :
LDLfactor