gcv.Krig {fields} | R Documentation

## Finds profile likelihood and GCV estimates of smoothing parameters for splines and Kriging.

### Description

This is a secondary function that will use the computed Krig object and find various estimates of the smoothing parameter lambda. These are several different flavors of cross-validation, a moment matching strategy and the profile likelihood. This function can also be used independently with different data sets (the y's) if the covariates ( the x's) are the same and thus reduce the computation.

### Usage

    gcv.Krig(out, lambda.grid = NA, cost = 1, nstep.cv = 80, rmse = NA,
                      verbose = FALSE, tol = 1e-05, offset = 0,
                      y = NULL, give.warnings = TRUE, give.warnings.REML = FALSE)

    gcv.sreg (out, lambda.grid = NA, cost = 1, nstep.cv = 80, rmse =
         NA, offset = 0, trmin = NA, trmax = NA, verbose = FALSE, tol = 1e-05)

### Arguments

`out` | A Krig or sreg object.
`lambda.grid` | Grid of lambdas for coarse search. The default is equally spaced on effective degree of freedom scale.
`cost` | Cost used in GCV denominator
`nstep.cv` | Number of grid points in coarse search.
`rmse` | Target root mean squared error to match with the estimate of sigma**2
`verbose` | If true prints intermediate results.
`tol` | Tolerance in delcaring convergence of golden section search or bisection search.
`offset` | Additional degrees of freedom to be added into the GCV denominator.
`y` | A new data vector to be used in place of the one associated with the Krig object (obj)
`give.warnings` | If FALSE will suppress warnings about grid search being out of range for various estimates based on GCV.
`give.warnings.REML` | If FALSE will suppress warnings about grid search being out of range when finding REML estimate of lambda.
`trmin` | Minimum value of lambda for grid search specified in terms of effective degrees of freedom.
`trmax` | Maximum value for grid search.

### Details

This function finds several estimates of the smoothing parameter using first a coarse grid search followed by a refinement using a minimization ( in the case of GCV or maximum likelihood) or bisection in the case of mathcing the rmse. Details of the estimators can be found in the help file for the Krig function.

The Krig object passed to this function has some matrix decompostions that facilitate rapid computation of the GCV and ML functions and do not depend on the independent variable. This makes it possible to compute the Krig object once and to reuse the decompostions for multiple data sets. (But keep in mind if the x values change then the object must be recalculated.) The example below show show this can be used for a simulation study on the variability for estimating the smoothing parameter.

### Value

A list giving a summary of estimates and diagonostic details with the following components:

`gcv.grid` | A matrix describing results of the coarse search rows are values of lambda and the columns are lambda= value of smoothing parameter, trA=effective degrees of freedom, GCV=Usual GCV criterion, GCV.one=GCV criterion leave-one-out, GCV.model= GCV based on average response in the case of replicates, shat= Implied estimate of sigma , -Log Profile= negative log of profiel likelihood for the lambda.
`lambda.est` | Summary table of all estimates Rows index different types of estimates: GCV, GCV.model, GCV.one, RMSE, pure error, -Log Profile and the columns are the estimated values for lambda, trA, GCV, shat.

### Author(s)

Doug Nychka

### See Also

`Krig`, `Tps`, `predict.Krig`

### Examples

    #
    Tps( ozone$x, ozone$y)-> obj # default is to find lambda by GCV
    summary( obj)

    gcv.Krig( obj)-> out
    print( out$lambda.est) # results agree with Tps summary

    sreg( rat.diet$t, rat.diet$trt)-> out
    gcv.sreg( out, tol=1e-10) # higher tolerance search for minimum

    # a simulation example
    x<- seq( 0,1,,150)
    f<-  x**2*( 1-x)
    f<- f/sqrt( var( f))

    set.seed(123) # let's all use the same seed
    sigma<- .1
    y<- f + rnorm( 150)*sigma

    Tps( x,y)-> obj # create Krig object

    hold<- matrix( NA, ncol=4, nrow=100)

    for( k in 1:100){
    # look at GCV estimates of lambda
    # new data simulated
       y<- f + rnorm(150)*sigma
    # save GCV estimates
    hold[k,]<-  gcv.Krig(obj,  y=y, give.warnings=FALSE)$lambda.est[1,]
    }
    plot( hold[,2], hold[,4], xlab="estimated eff. df", ylab="sigma hat")
    yline( sigma, col=2)
    # note some occaisional flaky behaviour with GCV ( eff df > 20!)

[Package fields version 5.02 Index]