Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

harmonic

Basis for Harmonic Functions


Description

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

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 ppm) to specify a linear predictor which is a harmonic function.

A function f(x,y) is harmonic if

(d/dx)^2 f + (d/dy)^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.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

# inhomogeneous point pattern
   X <- unmark(longleaf)
   

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

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

   # Likelihood ratio test
   lrts <- 2 * (logLik(fit.3) - logLik(fit.h))
   df <- with(coords(X),
              ncol(polynom(x,y,3)) - ncol(harmonic(x,y,3)))
   pval <- 1 - pchisq(lrts, df=df)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.