Evaluates a basis for the harmonic polynomials in
harmonic(x, y, n)
Vector of
Vector of
Maximum degree of polynomial
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.
This function computes a basis for the harmonic polynomials
in two variables lm,glm,gam
and ppm
) to specify a
linear predictor which is a harmonic function.
A function
This function was implemented on a suggestion of P. McCullagh for fitting nonstationary spatial trend to point process models.
# NOT RUN {
# inhomogeneous point pattern
X <- unmark(longleaf)
# }
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab