Skip to content

Commit

Permalink
Create stability analysis in robust regression
Browse files Browse the repository at this point in the history
  • Loading branch information
hadigilan committed Jun 11, 2022
0 parents commit fe21821
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions stability analysis in robust regression
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
library(stabs) # for stability selection

fitter<- function (x, y, q, ...){
fit <- hqreg::hqreg(x, y, dfmax = q - 1, method = "quantile", tau = 0.5, alpha = 1)
selected<- which(coef(fit)[-1,length(fit$lambda)]!=0)
ret <- logical(ncol(X_in))
ret[selected] <- TRUE
names(ret) <- colnames(X_in)
cf <- fit$beta[-1,]
sequence <- as.matrix(cf != 0)
return(list(selected = ret, path = sequence))
}

0 comments on commit fe21821

Please sign in to comment.