Learn R Programming

fields (version 8.3-6)

Krig.replicates: Collapse repeated spatial locations into unique locations

Description

In case that several observations are available for a single spatial location find the group means and replicate variability

Usage

Krig.replicates(out, x, y, Z, weights=rep( 1, length(y)), verbose = FALSE)

Arguments

Value

A list with components:yMData at unique locations and where more than one observation is available this is the mean of the replicates.xMUnique spatial locations.weightsMWeights matching the unique lcoations proportional to reciprocal variances This is found as a combination of the original weights at each location.ZMValues of the covariates at the unique lcoations.uniquerowsIndex for unique rows of x.shat.rep, shat.pure.errorStandard deviation of pure error estimate based on replicate groups (and adjusting for possibly different weights.)rep.infoInteger tags indicating replicate groups.

Details

This function figures out which locations are the same and within the function fast.1way use tapply to find replicate group means and standard deviations. NOTE: it is assumed the Z covariates are unique at the locations. Currently these functions can not handle a model with common spatial locations but different values for the Z covariates.

Examples

Run this code
#create  some spatial replicates
 set.seed( 123)
 x0<- matrix( runif(10*2), 10,2)
 x<-  x0[ c(rep(1,3), 2:8, rep( 9,5),10) , ]
 y<-  rnorm( 16)
 
 out<- Krig.replicates( x=x, y=y)
# compare 
# out$yM[1] ;  mean( y[1:3])
# out$yM[9] ; mean( y[11:15])
# mean( y[ out$rep.info==9])

Run the code above in your browser using DataLab