slopebypoint {Thermimage} | R Documentation |
Returns the slope from linear regression with x values as equally spaced 1:length
Description
Returns the slope from linear regression with x values as equally spaced 1:length
Usage
slopebypoint(data)
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
Examples
## 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))
[Package Thermimage version 4.1.3 Index]