Skip to content

monotonic factors

2 messages · Jeffrey Pollock, Greg Snow

#
One approach would be to code dummy variables for your factor levels, have d1 equal to 0 for 'low' and 1 for 'med' and 'high', then have d2 equal to 1 for 'high' and 0 otherwise.  For linear regression there are functions that will fit a model with all non-negative coefficients, but I don't know of anything like that for glms, so one option is to fit with all the dummy variables, then if any of the estimated coefficients are negative remove that variable (force it to 0) and refit.