Skip to main content
29 events
when toggle format what by license comment
S Mar 4 at 0:21 history suggested Fellow InstituteOfMathophile CC BY-SA 4.0
the family = "binomial" is missing. otherwise it will not work.
Mar 3 at 20:18 review Suggested edits
S Mar 4 at 0:21
Jan 16, 2023 at 13:34 comment added T. Beige Isn't it necessary to standardize the variables before using glmnet? Or provided glmnet the standardization of X automatically?
Jun 13, 2019 at 23:44 comment added Alex @jiggunjer I didn't write these lines of code so your question is probably best directed at the original poster.
Jun 13, 2019 at 9:31 comment added jiggunjer @Alex wouldn't model.matrix(asthma ~ gender + m_edu + p_edu + f_color + age + bmi_p)[, -1] give the same result as the two lines above? Why use an extra step to concatenate the continuous variables with data.frame ?
Jul 9, 2018 at 16:12 comment added PM. @pat (+1) Why doesn't it need to specify family='binomial' in the cv.glmnet call?
May 19, 2018 at 14:08 comment added Shahin Why MSE for binary response variable? Isn't it wrong?
Jan 11, 2017 at 22:08 comment added iamdeit In the last part, where you use cv to find the best lambda. What would I do with that lambda?, because glmmod is enough for making predictions right?
S Jan 4, 2017 at 21:00 history suggested Max Ghenis CC BY-SA 3.0
Added spaces after commas
Jan 4, 2017 at 20:31 review Suggested edits
S Jan 4, 2017 at 21:00
S Jan 4, 2017 at 20:27 history edited gung - Reinstate Monica CC BY-SA 3.0
Improved formatting, removed unnecessary `grid()` call.
S Jan 4, 2017 at 20:27 history suggested Max Ghenis CC BY-SA 3.0
Improved formatting, removed unnecessary `grid()` call.
Jan 4, 2017 at 19:46 review Suggested edits
S Jan 4, 2017 at 20:27
Oct 27, 2015 at 5:16 comment added Alex The line xfactors <- model.matrix(asthma ~ gender + m_edu + p_edu + f_color)[,-1] codes the categorical variable f_color (as declared by as.factor in the previous lines). It should use the default R dummy variable coding, unless the contrasts.arg argument is supplied. This means all the levels of f_color are equally weighted and non directional, except for the first one which is used as the reference class and absorbed into the intercept.
May 12, 2014 at 20:41 comment added beroe Can I ask how this handles the f_color variable? Is factor level 1 to 4 considered a larger step that 1 to 2, or are these all equally weighted, non-directional, and categorical? (I want to apply it to an analysis with all unordered predictors.)
Oct 9, 2013 at 22:39 vote accept Matt Reichenbach
Oct 9, 2013 at 22:09 comment added pat 1) Cross validation is used to choose lambda and coefficients (at min error). In this mockup, there is no local min (there was a warning also related to too few obs); I would interpret that all coefficients were shrunk to zero with the shrinkage penalties (best model has only intercept) and re-run with more (real) observations and maybe increase lambda range. 2) Yes, in the example where I chose coef(glmmod)[,10]... you choose lambda for the model via CV or interpretation of results. Could you mark as solved if you felt I solved your question? thanks.
Oct 9, 2013 at 14:22 vote accept Matt Reichenbach
Oct 9, 2013 at 14:22
Oct 9, 2013 at 14:21 comment added Matt Reichenbach this is exactly what I was looking for +1, the only questions I have are 1) what can you do with the cross validation lambda of 0.2732972? and 2) From the glmmod, are the selected variables favorite color (yellow), gender, and father's education (bachelor's degree)? Thanks so much!
Oct 8, 2013 at 23:02 history edited pat CC BY-SA 3.0
added 1499 characters in body
Oct 8, 2013 at 22:55 history edited pat CC BY-SA 3.0
added 1499 characters in body
Oct 8, 2013 at 21:39 history edited pat CC BY-SA 3.0
added 27 characters in body
Oct 8, 2013 at 21:31 history edited pat CC BY-SA 3.0
added 56 characters in body
Oct 8, 2013 at 21:16 history undeleted pat
Oct 8, 2013 at 21:09 history edited pat CC BY-SA 3.0
deleted 40 characters in body
Oct 8, 2013 at 20:40 history edited pat CC BY-SA 3.0
added 46 characters in body
Oct 8, 2013 at 20:29 history deleted pat via Vote
Oct 8, 2013 at 20:28 history edited pat CC BY-SA 3.0
added 96 characters in body
Oct 8, 2013 at 20:21 history answered pat CC BY-SA 3.0