View source: R/reverse_predict.R
reverse_predict | R Documentation |
Predict x values from y values. As with calibration curves, determine the concentration (x) from the peak area (y).
reverse_predict(model, new_y, level = 0.95)
model |
regression model of class |
new_y |
the new y value or multiplicate of y as a vector |
level |
confidence interval, default = 0.95 |
A list with :
x |
the predict x value |
confidence_interval |
the confidence interval of the predict value |
Rico Derks
set.seed(123) # dummy data my_data <- data.frame(x = 1:10, y = 1:10 + rnorm(10)) # Create linear model model <- lm(y ~ x, data = my_data) # Single y reverse_predict(model = model, new_y = 5) # $x # [1] 4.874066 # $confidence_interval # [1] 2.578921 # Triplicate y's reverse_predict(model = model, new_y = c(5.0, 4.9, 5.3)) # $x # [1] 4.946685 # $confidence_interval # [1] 1.622068
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.