Last data update: 2014.03.03

R: Creates fixed part of spatial model.
LKrigDefaultFixedFunctionR Documentation

Creates fixed part of spatial model.

Description

Creates matrix of low order polynomial in the spatial coordinates and adds any other spatial covariates that are part of the linear model.

Usage

 LKrigDefaultFixedFunction(x, Z = NULL, m=2,distance.type="Euclidean") 
 LKrigPeriodicFixedFunction(x, Z = NULL, m = 2, distance.type = "Euclidean")
 
predictLKrigFixedFunction(object, xnew, Znew = NULL, drop.Z = FALSE)

Arguments

drop.Z

If TRUE only spatial drift is evaluated the contribution for covariates is omitted.

distance.type

The distance metric. See the entry in LKrig for details.

m

The order of the polynomial. Following the convention for splines the polynomial will have maximum order (m-1). Throughout LKrig m==2 is the default giving a linear polynomial.

object

A LKrig object.

x

A 2 column matrix of 2-d locations to evaluate the polynomial.

xnew

Locations for predictions.

Z

A matrix specifying additional spatial covariates.

Znew

Same as Z.

Details

LKrigDefaultFixedFunction This function creates the regression matrix for the fixed part of the spatial model. The default is a low order polynomial regression matrix of degree m-1. To this matrix are bound as columns any covariates passed as Z. Typically one would not need to modify this function. For more exotic fixed part models one can specify create and then specify a different function. See LKrig.setup and LKrig. NOTE: If the argument for this function is passed as NULL then the subsequent computations do not include a fixed part in the model.

LKrigDefaultFixedFunction This is same as LKrigDefaultFixedFunction except the first coordinate is ignored. i.e. it is assumed to be periodic so adding a polynomial does not make sense.

predictLKrigFixedFunction This function is simple, but is introduced to make the code modular and to handle the case for cylindrical geometry where only latitude should have a spatial term (to preserve periodicity in longitude).

Value

A matrix where rows index the locations and columns are the different spatial polynomial and covariates.

Author(s)

Doug Nychka

See Also

LKrig.basis, LKrig

Examples

x<- matrix( runif(100), nrow=50)
# linear polynomial 
T.matrix<- LKrigDefaultFixedFunction(x, m=2)
# quadratic polynomial 
T.matrix<- LKrigDefaultFixedFunction(x, m=3)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LatticeKrig)
Loading required package: spam
Loading required package: grid
Spam version 1.3-0 (2015-10-24) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

The following objects are masked from 'package:base':

    backsolve, forwardsolve

Loading required package: fields
Loading required package: maps

 # maps v3.1: updated 'world': all lakes moved to separate new #
 # 'lakes' database. Type '?world' or 'news(package="maps")'.  #


> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LatticeKrig/LKrigDefaultFixedFunction.Rd_%03d_medium.png", width=480, height=480)
> ### Name: LKrigDefaultFixedFunction
> ### Title: Creates fixed part of spatial model.
> ### Aliases: LKrigDefaultFixedFunction LKrigPeriodicFixedFunction
> ###   predictLKrigFixedFunction
> ### Keywords: spatial
> 
> ### ** Examples
> 
> x<- matrix( runif(100), nrow=50)
> # linear polynomial 
> T.matrix<- LKrigDefaultFixedFunction(x, m=2)
> # quadratic polynomial 
> T.matrix<- LKrigDefaultFixedFunction(x, m=3)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>