Performs a linear model for
linear_model(x, y = NULL, conf_level = 0.95)a tidy data frame with the model results
x <- runif(100) * 1:100
linear_model(x)
#> # A tibble: 1 × 11
#> p_value slope conf_low conf_high conf_level intercept r_squared sigma method
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 2.09e-14 0.550 0.430 0.670 0.95 -0.242 0.451 17.7 Linear…
#> # ℹ 2 more variables: n <int>, note <chr>
# If measurements were for example taken daily
linear_model(x, y = Sys.Date() + (1:100))
#> # A tibble: 1 × 11
#> p_value slope conf_low conf_high conf_level intercept r_squared sigma method
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 2.09e-14 0.550 0.430 0.670 0.95 -11379. 0.451 17.7 Linear…
#> # ℹ 2 more variables: n <int>, note <chr>