slopebypoint: Returns the slope from linear regression with x values as...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/slopebypoint.R

Description

Returns the slope from linear regression with x values as equally spaced 1:length

Usage

1

Arguments

data

Returns the slope from linear regression with x values as equally spaced 1:length

Details

Returns the slope (i.e. localised tangent) from linear regression with x values as equally spaced 1:length. The usefulness of this function is to reduce a time series type of data collected at equal time intervals.

N=number of data points over which to calculate the slope.

Value

An object of type numeric.

Author(s)

Glenn J. Tattersall

See Also

lm

Examples

1
2
3
4
5
6
7
8
9
## Define a vector of 50 random numbers from 1 to 100
y<-ceiling(runif(50, 0, 100))
# Calculate the slope with respect to the index values (i.e. 1 to 50)
# instead of an x axis, this will provide a slope value of y vs. index
s<-slopebypoint(y)
s

# same as if typing: 
lm(y~seq(0,length(y)-1,1))

gtatters/Thermimage documentation built on Sept. 28, 2021, 2:02 p.m.