vgram                 package:fields                 R Documentation

_F_i_n_d_s _a _t_r_a_d_i_t_i_o_n_a_l _o_r _r_o_b_u_s_t _v_a_r_i_o_g_r_a_m _f_o_r _s_p_a_t_i_a_l _d_a_t_a.

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

     Computes pairwise squared differences as a function of distance. 
     Returns either raw values or statistics from binning.

_U_s_a_g_e:

     vgram(loc, y, id=NULL, d=NULL, lon.lat=FALSE, dmax=NULL, N=NULL, breaks=NULL)

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

     loc: Matrix where each row is the coordinates of an observed point
          of the field 

       y: Value of the field at locations 

      id: A 2 column matrix that specifies which variogram differnces
          to find.  If omitted all possible pairing are found.  This
          can can used if the data has an additional covariate that
          determines proximity, for example a time window.  

       d: Distances among pairs indexed by id. If not included
          distances from from directly from loc.  

lon.lat : If true, locations are assumed to be longitudes and latitudes
          and  distances found are great circle distances ( in miles
          see rdist.earth). Default is false.  

    dmax: Maximum distance to compute variogram. 

       N: Number of bins to use. 

  breaks: Bin boundaries for binning variogram values. Need not be
          equally spaced but must be ordered.  

_V_a_l_u_e:

     name= vgram> variogram values  </s-return-component >

     name= vgram> variogram values  </s-return-component >

     name= d> pairwise distances  </s-return-component >

     name= call> calling string  </s-return-component >

     name= stats> Matrix of statistics for values in each bin.  Rows
     are the summaries returned by the stats function or describe.   If
     not either breaks or N arguments are not supplied then this
     component is not computed.  </s-return-component >

     name= centers> Bin centers </s-return-component >

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

     See any standard reference on spatial statistics. For example 
     Cressie, Spatial Statistics

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

     vgram.matrix bplot.xy, vgram.matrix

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

     #
     # compute variogram for the midwest ozone field  day 16
     # (BTW this looks a bit strange!)
     #
     data( ozone2)
     good<- !is.na(ozone2$y[16,])
     x<- ozone2$lon.lat[good,] 
     y<- ozone2$y[16,good]

     look<-vgram( x,y, N=15, lon.lat=TRUE) # locations are in lon/lat so use right
     #distance
     # take a look:
     #plot( look$d, look$vgram)
     #lines(look$centers, look$stats["mean",], col=4)

     brk<- seq( 0, 250,,25)
      
     ## or some boxplot bin summaries

     bplot.xy( look$d, sqrt(look$vgram), breaks=brk,ylab="sqrt(VG)")
     lines(look$centers, look$stats["mean",], col=4)

