Last active
May 1, 2017 05:49
-
-
Save Gedevan-Aleksizde/e3a394011fc1e3e18d051c3fff95fbc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glmnet.mock <- function(formula=y~., family="gaussian", data, ...){ | |
fam.link <- strsplit(family, "\\(|\\)")[[1]] | |
family <- fam.link[1] | |
if(length(fam.link) >=2) link <- fam.link[2] | |
else link <- "identity" | |
return(glmnet(x=model.matrix(formula, data), | |
y=get(link)(model.response(model.frame(formula, data))), | |
family = family, | |
...) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment