[R-sig-Geo] Co-kriging when the variable of interest and auxiliary variable(s) are not measured at the same locations

Manoranjan Muthusamy ranjanmano167 at gmail.com
Thu Apr 26 00:12:07 CEST 2018


This is the first time I'm using ko-kriging in gstat. My problem is that
I'm not sure how to prepare the data frame to supply to co-kriging when the
variable of interest and auxiliary variables are not measured at the same
locations.

Data frame with the variable of interest, z_ar, is voi_gs

> head(voi_gs)
             x        y     z_ar
8974  312216.6 530439.8 49.03470
8283  312084.6 530559.8 57.15355
5057  311772.6 530883.8 49.13453
1551  311976.6 531207.8 44.73679
10116 312168.6 530163.8 50.45549
6155  312528.6 530787.8 62.70750

Data frame with the auxiliary variable, z_ptsis aux_gs

> head(aux_gs)
            x        y    z_pts
9564 312198.6 530313.8 75.91368
6584 311766.6 530745.8 38.87462
2138 311562.6 531153.8 58.62555
9110 312534.6 530421.8 68.35654
9525 312366.6 530325.8 54.26653
7497 311442.6 530649.8 38.95024

I combined them into one data frame to supply to variogram() and
krige() functions.
Since non of the locations are same between voi_gs and aux_gs, I introduced
NA values and combined them in the following way

> aux_gs$z_ar=NA
> voi_gs$z_pts=NA
> comb_gs=rbind(aux_gs,voi_gs)
> head(comb_gs)
            x        y    z_pts z_ar
9564 312198.6 530313.8 75.91368   NA
6584 311766.6 530745.8 38.87462   NA
2138 311562.6 531153.8 58.62555   NA
9110 312534.6 530421.8 68.35654   NA
9525 312366.6 530325.8 54.26653   NA
7497 311442.6 530649.8 38.95024   NA
> tail(comb_gs)
            x        y z_pts     z_ar
180  312468.6 531363.8    NA 70.54528
8633 312264.6 530511.8    NA 44.34631
7694 312492.6 530631.8    NA 57.30173
1079 312108.6 531255.8    NA 46.96482
2230 311124.6 531135.8    NA 40.36449
2201 312312.6 531147.8    NA 44.85896

and then constructing cross-variogram

> coordinates(comb_gs) = ~x+y
> g = gstat(formula=z_pts~z_ar, data=comb_gs)
> vg = variogram(g)

but variogram function does not accept NA values and gives me an error. I
know I can't have NA values in the data, but I don't know how else I can
create the data frame to construct the cross-variogram. Any help is really
appreciated. Thanks.

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list