# Simple usage
coef <- flm(mpg ~ hp + carb, mtcars, w = wt)
# Same thing in programming usage
flm(mtcars$mpg, qM(mtcars[c("hp","carb")]), mtcars$wt, add.icpt = TRUE)
# Check this is correct
lmcoef <- coef(lm(mpg ~ hp + carb, weights = wt, mtcars))
all.equal(drop(coef), lmcoef)
# Multi-dependent variable (only some methods)
flm(cbind(mpg, qsec) ~ hp + carb, mtcars, w = wt)
# Returning raw results from solver: different for different methods
flm(mpg ~ hp + carb, mtcars, return.raw = TRUE)
flm(mpg ~ hp + carb, mtcars, method = "qr", return.raw = TRUE)
# Test that all methods give the same result
all_obj_equal(lapply(1:6, function(i)
flm(mpg ~ hp + carb, mtcars, w = wt, method = i)))
Run the code above in your browser using DataLab