# harmonic

0th

Percentile

##### Basis for Harmonic Functions

Evaluates a basis for the harmonic polynomials in $x$ and $y$ of degree less than or equal to $n$.

Keywords
spatial
##### Usage
harmonic(x, y, n)
##### Arguments
x
Vector of $x$ coordinates
y
Vector of $y$ coordinates
n
Maximum degree of polynomial
##### Details

This function computes a basis for the harmonic polynomials in two variables $x$ and $y$ up to a given degree $n$ and evaluates them at given $x,y$ locations. It can be used in model formulas (for example in the model-fitting functions lm,glm,gam and mpl) to specify a linear predictor which is a harmonic function.

A function $f(x,y)$ is harmonic if $$\frac{\partial^2}{\partial x^2} f + \frac{\partial^2}{\partial y^2}f = 0.$$ The harmonic polynomials of degree less than or equal to $n$ have a basis consisting of $2 n$ functions.

This function was implemented on a suggestion of P. McCullagh for fitting nonstationary spatial trend to point process models.

##### Value

• A data frame with 2 * n columns giving the values of the basis functions at the coordinates. Each column is labelled by an algebraic expression for the corresponding basis function.

mpl

• harmonic
##### Examples
library(spatstat)

data(longleaf)
X <- unmark(longleaf)
# inhomogeneous point pattern

# fit Poisson point process with log-cubic intensity
fit.3 <- mpl(X, ~ polynom(x,y,3), Poisson())

# fit Poisson process with log-cubic-harmonic intensity
fit.h <- mpl(X, ~ harmonic(x,y,3), Poisson())

# Likelihood ratio test
lrts <- 2 * (fit.3$maxlogpl - fit.h$maxlogpl)
x <- X$x y <- X$y
df <- ncol(polynom(x,y,3)) - ncol(harmonic(x,y,3))
pval <- 1 - pchisq(lrts, df=df)
Documentation reproduced from package spatstat, version 1.4-5, License: GPL version 2 or newer

### Community examples

Looks like there are no examples yet.