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

trend.line

trend.line


Description

Calculated specified trend line of x,y

Usage

trend.line(x, y, type = "linear", plot = TRUE, ...)

Arguments

x

Vector of x

y

Vector of y

type

Trend line types are: 'linear', 'exponential', 'logarithmic', 'polynomial'

plot

plot results (TRUE/FALSE)

...

Additional arguments passed to plot

Value

A list class object with the following components:

  • for type = 'linear' x is slope and y is intercept

  • for type = 'exponential', 'logarithmic', or 'polynomial' x is original x variable and y is vector of fit regression line

Author(s)

Jeffrey S. Evans jeffrey_evans@tnc.org

Examples

x <- 1:10
y <- jitter(x^2)

opar <- par(no.readonly=TRUE)
  par(mfcol=c(2,2))
    trend.line(x,y,type='linear',plot=TRUE,pch=20,main='Linear')
    trend.line(x,y,type='exponential',plot=TRUE,pch=20,main='Exponential')
    trend.line(x,y,type='logarithmic',plot=TRUE,pch=20,main='Logarithmic')
    trend.line(x,y,type='polynomial',plot=TRUE,pch=20,main='Polynomial')
 par(opar)

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

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