# Perform Polynomial Evaluation of Linearity

Evaluates whether the relationship between two vectors is linear or nonlinear. Performs a test to determine how well a linear model fits the data compared to higher order polynomial models. Jhang et al. (2004) .

R package for polynomial evaluation of linearity.

lin.eval is a R package for performing polynomial evaluation of linearity.

## Installation

lin.eval can be installed via Github:

## How it works

Polynomial evaluation of linearity is a technique of assessing if the best way to describe the relationship between two vectors.

1. Fit three models - linear, second-order polynomial and third-order polynomial

2. Find out best-fitting model among the three by comparing their p-values. Model with the lowest p-value out of the three is the best-fitting one.

3. If the best-fitting model is linear, linearity is established and no further steps need to be carried out. This is called Linear 1 type.

4. Else, best-fitting model is either second or third order polynomoal model. In this case, calculate average deviation from linearity (adl). This is given by:

$adl&space;=&space;\frac{1}{n}&space;*&space;(\sum_{1}^{n}\left&space;|&space;\frac{l_{i}&space;-&space;p_{i}}{l_{i}}&space;\right&space;|&space;*&space;100)$

where, l is the vector of predictions from linear model and p is the vector of predictions from best-fitting polynomial model.

5. If adl is greater than or equal to the threshold value for deviation from linearity, conclude that the relationship is non-linear.

6. Else if adl is less than the threshold value for deviation from linearity, conclude that although the best-fitting model is not linear, deviation from linearity is not significant and hence, it is still a linear relationship. This is called a Linear 2 type.

## Usage

Call the poly_eval() function with the following parameters:
y: vector of response values
x: vector of predictor values
threshold: threshold value for average deviation from linearity as percentage. Defaults to 5.

You can check the values stored in the result variable:

## More examples

Usage without passing in optional argument for adl:

# Reference manual

install.packages("lin.eval")

0.1.2 by Vishesh Shrivastav, 2 years ago

Browse source code at https://github.com/cran/lin.eval

Authors: Vishesh Shrivastav

Documentation:   PDF Manual