Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Regression Won't Run with Year as Categorical Variable but fine as Continuous

    Help!

    I'm having difficulty with my LASSO regression. I posted about this but thought I would make it a bit more broad, as I think it just has to do with some collinearity in my model. I'm using operation year as a continuous variable in my regression model for mortality. When I plug in operation year as a continuous variable, my regression is fine. But when I break operyr into categories (2005-2010, 2011-2015, and 2016-2020) my LASSO just stops and tells me that a minimum deviance was not found. Anyone have any ideas why this might be? Or how I could adjust for this in my model without removing the categories?

    Thanks!

    Jaycee

  • #2
    Hi Jaycee,

    I see you posted about this already here. Note that it is usually helpful to link to another relevant discussion.

    Thank you for providing the problem lines of code in the previous post as well as the exact error message. You should try to do that in all of your questions. It is also often also helpful to provide example data, which you can easily generate with the -dataex- command. Be sure to surround any code, output, or data in code tags (see the # symbol in the post editor) as this will make your post much more readable. I would suggest carefully reading through the FAQ at the top of the page to get a sense of the expectations for posts here. Well written, high quality questions are much more likely to get a response. Of course, it is also possible that no one knows the answer to your question. LASSO is already a bit controversial since (e.g.) it can make basic mistakes in inference and in general there is no guarantee it will find the true generative model.

    It looks like you're getting the following error:

    Code:
    lambda not selected
    No minimum of cross-validation function found. Change in deviance stopping
    tolerance not reached.
    Unfortunately, I don't think there is enough information to clearly diagnose the issue. You might start by going back to your bivariate statistics in order to understand why the model might not converge. Why might that particular set of categories be problematic? You mentioned colinearity as a possibility - well then it might help to standardize or mean center some of your model variables. You might also try adjusting the cvtolerance() option to see if a larger or smaller tolerance allows the model to converge. Finally, you might want to read through this piece of documentation to get a better sense of what might be going wrong, and what you might be able to do to fix it.

    Comment

    Working...
    X