powered by
Fits a linear model using the Polynomial Maximization Method (order 2), which is robust to non-Gaussian errors.
lm_pmm2( formula, data, max_iter = 50, tol = 1e-06, regularize = TRUE, reg_lambda = 1e-08, na.action = na.fail, weights = NULL, verbose = FALSE )
S4 object of class PMM2fit
PMM2fit
R formula for the model
data.frame containing variables in the formula
integer: maximum number of iterations for the algorithm
numeric: tolerance for convergence
logical: add small value to diagonal for numerical stability
numeric: regularization parameter (if regularize=TRUE)
function for handling missing values, default is na.fail
optional weight vector (not yet implemented)
logical: whether to print progress information
The PMM2 algorithm works as follows:
Fits ordinary least squares (OLS) regression to obtain initial estimates
Computes central moments (m2, m3, m4) from OLS residuals
Iteratively improves parameter estimates using a gradient-based approach
PMM2 is especially useful when error terms are not Gaussian.
set.seed(123) n <- 80 x <- rnorm(n) y <- 2 + 3 * x + rt(n, df = 3) dat <- data.frame(y = y, x = x) fit <- lm_pmm2(y ~ x, data = dat) summary(fit, formula = y ~ x, data = dat)
Run the code above in your browser using DataLab