

krige {sgeostat}                             R Documentation

_K_r_i_g_i_n_g

_D_e_s_c_r_i_p_t_i_o_n_:

     Carry out spatial prediction (or kriging).

_U_s_a_g_e_:

     krige(prdpnt, point.obj, v1, var.mod.object,maxdist=NULLi,extrap=F)

_A_r_g_u_m_e_n_t_s_:

  prdpnt: a point object, generated by `point()', at which
          prediction is carried out

point.obj: a point object, generated by `point()', contain-
          ing the sample points and data

      v1: the variable, contained in `point.obj', for which
          prediction will be carried out

 maxdist: an optional maximum distance. If entered, then
          only sample points (i.e, in point.obj) within
          maxdist of each prediction point will be used to
          do the prediction at that point. If not entered,
          then all n sample points will be used to make the
          prediction at each point.

  extrap: logical, indicates if prediction outside the con-
          vex hull of data points should be done, default
          `FALSE'

_V_a_l_u_e_:

     A point object which is a copy of the prdpnt object
     with two new variables, `zhat' and `sigma2hat', which
     are, repspectively, the predicted value and the kriging
     variance.

_R_e_f_e_r_e_n_c_e_s_:

     http://www.gis.iastate.edu/SGeoStat/homepage.html

_S_e_e _A_l_s_o_:

     `est.variogram',`fit.variogram'

_E_x_a_m_p_l_e_s_:

     # a single point:
     prdpnt <- point(data.frame(list(x=180000,y=331000)))
     prdpnt <- krige(prdpnt, maas.point, 'zinc', maas.vmod)
     prdpnt

     # kriging on a grid (slow!)
     grid <- list(x=seq(min(maas$x),max(maas$x),by=100),
                  y=seq(min(maas$y),max(maas$y),by=100))
     grid$xr <- range(grid$x)
     grid$xs <- grid$xr[2] - grid$xr[1]
     grid$yr <- range(grid$y)
     grid$ys <- grid$yr[2] - grid$yr[1]
     grid$max <- max(grid$xs, grid$ys)
     grid$xy <- data.frame(cbind(c(matrix(grid$x, length(grid$x), length(grid$y))),
                  c(matrix(grid$y, length(grid$x), length(grid$y), byrow=T))))
     colnames(grid$xy) <- c("x", "y")
     grid$point <- point(grid$xy)
     grid$krige <- krige(grid$point,maas.point,'zinc',maas.vmod,
                         maxdist=1000,extrap=F)
     op <- par(no.readonly = TRUE)
     par(pty="s")
     plot(grid$xy, type="n", xlim=c(grid$xr[1], grid$xr[1]+grid$max),
                         ylim=c(grid$yr[1], grid$yr[1]+grid$max))
     image(grid$x,grid$y,
           matrix(grid$krige$zhat,length(grid$x),length(grid$y)),
           add=T)
     contour(grid$x,grid$y,
             matrix(grid$krige$zhat,length(grid$x),length(grid$y)),
             add=T)
     data(maas.bank)
     lines(maas.bank$x,maas.bank$y,col="blue")
     par(op)

