slope: slope

View source: R/slope.R

slope_senR Documentation

slope

Description

  • slope : linear regression slope

  • slope_p : linear regression slope and p-value

  • slope_mk : mann kendall Sen's slope and p-value

  • slope_sen : same as slope_mk, but with no p-value

  • slope_boot: bootstrap slope and p-value

Usage

slope_sen(y, x = NULL)

slope(y, x, ...)

slope_p(y, x, fast = TRUE)

slope_sen_r(y, x = seq_along(y), ...)

slope_mk(y, x = NULL, ...)

slope_boot(y, x = NULL, slope_FUN = slope, times = 100, alpha = 0.1, seed, ...)

Arguments

y

vector of observations of length n, or a matrix with n rows.

x

vector of predictor of length n, or a matrix with n rows.

...

ignored.

fast

Boolean. If true, stats::.lm.fit() will be used, which is 10x faster than stats::lm().

slope_FUN

one of slope(), slope_p(), slope_mk()

times

The number of bootstrap replicates.

alpha

significant level, defalt 0.1

seed

a single value, interpreted as an integer, or NULL (see ‘Details’).

Value

  • slope : linear regression coefficient

  • pvalue : ⁠p-value <= 0.05`` means that corresponding ⁠slope' is significant.

  • sd : ⁠Std. Error⁠

For slope_boot, slope is estimated in many times. The lower, mean, upper and standard deviation (sd) are returned.

Examples

y <- c(4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69)
r <- slope(y)
r_p <- slope_p(y)
r_mk <- slope_mk(y)
r_boot <- slope_boot(y)

rtrend documentation built on June 22, 2024, 11:39 a.m.