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

polynom

Polynomial in One or Two Variables


Description

This function is used to represent a polynomial term in a model formula. It computes the homogeneous terms in the polynomial of degree n in one variable x or two variables x,y.

Usage

polynom(x, ...)

Arguments

x

A numerical vector.

...

Either a single integer n specifying the degree of the polynomial, or two arguments y,n giving another vector of data y and the degree of the polynomial.

Details

This function is typically used inside a model formula in order to specify the most general possible polynomial of order n involving one numerical variable x or two numerical variables x,y.

It is equivalent to poly(, raw=TRUE).

If only one numerical vector argument x is given, the function computes the vectors x^k for k = 1, 2, ..., n. These vectors are combined into a matrix with n columns.

If two numerical vector arguments x,y are given, the function computes the vectors x^k * y^m for k >= 0 and m >= 0 satisfying 0 < k + m <= n. These vectors are combined into a matrix with one column for each homogeneous term.

Value

A numeric matrix, with rows corresponding to the entries of x, and columns corresponding to the terms in the polynomial.

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

x <- 1:4
   y <- 10 * (0:3)
   polynom(x, 3)
   polynom(x, y, 3)

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.