harmonic              package:spatstat              R Documentation

_B_a_s_i_s _f_o_r _H_a_r_m_o_n_i_c _F_u_n_c_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

        harmonic(x, y, n)

_A_r_g_u_m_e_n_t_s:

       x: Vector of x coordinates 

       y: Vector of y coordinates 

       n: Maximum degree of polynomial 

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     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.

_A_u_t_h_o_r(_s):

     Adrian Baddeley adrian@maths.uwa.edu.au <URL:
     http://www.maths.uwa.edu.au/~adrian/> and Rolf Turner
     rolf@math.unb.ca <URL: http://www.math.unb.ca/~rolf>

_S_e_e _A_l_s_o:

     'ppm'

_E_x_a_m_p_l_e_s:

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

        # 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 * (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)

