ransac_reg | R Documentation |
Fits a robust linear model ('lm') using the RANSAC algorithm.
ransac_reg(formula, data, n_min, n_iter = 100, tol = 0.2, verbose = FALSE)
formula |
Model formula (as in 'lm'). |
data |
Data frame containing the model variables. |
n_min |
Minimum number of points to fit the model (e.g., 2 for a straight line). |
n_iter |
Number of iterations (higher values make the model more robust). |
tol |
Absolute tolerance to consider a point as an inlier. |
verbose |
If 'TRUE', shows progress messages. |
An 'lm' model fitted only to the inliers, with an additional class '"ransac_model"' and an '"inliers"' attribute.
set.seed(123)
x <- 1:10
y <- c(1, 2, 3, 4, 5, 6, 7, 8, 50, 60) # some outliers
data <- data.frame(x = x, y = y)
model <- ransac_reg(y ~ x, data = data, n_min = 2, tol = 5)
summary(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.