[R] Least Median Square Regression
Bryan Mac
bryanmac.24 at gmail.com
Sat Oct 8 09:40:39 CEST 2016
Hi R-help,
How do you perform least median square regression in R? Here is what I have but received no output.
LMSRegression <- function(df, indices){
sample <- df[indices, ]
LMS_NAR_NIC_relation <- lm(sample$NAR~sample$NIC, data = sample, method = "lms")
rsquared_lms_nar_nic <- summary(LMS_NAR_NIC_relation)$r.square
LMS_SQRTNAR_SQRTNIC_relation <- lm(sample$SQRTNAR~sample$SQRTNIC, data = sample, method = "lms")
rsquared_lms_sqrtnar_sqrtnic <- summary(LMS_SQRTNAR_SQRTNIC_relation)$r.square
out <- c(rsquared_lms_nar_nic, rsquared_lms_sqrtnar_sqrtnic)
return(out)
}
Also, which value should be looked at decide whether this is best regression model to use?
Bryan Mac
bryanmac.24 at gmail.com
[[alternative HTML version deleted]]
More information about the R-help
mailing list