Logistic regression with box constraints served me well in the past for problems similar to yours. You are interested in prediction, not in inference, so, as long a suitable estimate of generalization error (for example, 5-fold cross-validation error) is low enough, you should be ok.
Let's consider a logit link function and a linear model:
$$\beta_0+\beta_1 x_1 +\beta_2 x_2 =\log{\frac{\mu}{1-\mu}}$$
where $\mu=\mathbb{E}[y|x_1]$
Then
$$\frac{\partial \mu}{\partial x_1}=\beta_1 \frac{\exp{(-\beta_0-\beta_1 x_1 -\beta_2 x_2)}}{(1+\exp{(-\beta_0-\beta_1 x_1 -\beta_2 x_2)})^2}>0 \iff \beta_1>0 $$
Thus constraint 1 and 2 are satisfied if you just use logistic regression with the constraint that $\beta_1>0$. In general, monotonicity constraints with respect to one or more variables are relatively easy to enforce with GLMs (Generalized Linear Models) such as logistic regression, because the monotonicity of the link function and the fact that it's expressed it as a linear function of the predictors imply that $\mu$ is always monotonic with respect to the continuous predictors.
An R package which supports logistic regression with box constraints (constraints of the type $a_i\leq\beta_i\leq b_i$) is glmnet
. Its usage is a bit different from other regression functions in R, so have a look at ?glmnet
. Constraint 3 wouldn't need specific attention in most cases, because most R regression functions will automatically encode categorical variables using dummy variables. Unfortunately, glmnet
is one of the few functions which doesn't do that. You need to use model.matrix
to solve this: if my_data
holds your observations $X=\{x_{1i},x_{2i}\}_{i=1}^N$, then
M <- model.matrix(~ x1 + x2, my_data)
will build a design matrix suitable for use with glmnet
.
The only limitation of this approach lies in the fact that we have modeled the logit function as a linear function of the predictors. This may prove not flexible enough for your problem: in other words, you could get a large cross-validation error. If this is so, you should look into nonparametric logistic regression - here, however, you need to fit GAMs (Generalized Additive Models), not GLMs, and imposing monotonicity becomes more complicated. The package mgcv
and the function mono.con
are your friends here - you'll need to read quite a lot of documentation. Gavin Simpson's answer to question
How to smooth data and force monotonicity
which you linked in your question, has a good example.
Finally, I reiterate that this approach (as well as all other approaches which rely on logistic regression, whether Bayesian or frequentist) only makes sense because you need a quick tool to approximate in an automated way multiple unknown functions inside your reinforcement learning workflow. $y|\mathbf{x}$ doesn't really have the binomial distribution, so you cannot expect to get realistic estimates of standard errors, confidence intervals, etc. If you need a real statistical model, which would give you not only point estimates but also realistic prediction intervals, then you need to take into account the real conditional distribution of your output. This question might help:
Judging the quality of a statistical model for a percentage
mgcv
is a great package, and unless constrained polynomial regression is good enough for your application, you won't get out of this without using some specialized packages (or reinventing A LOT of wheels). Why don't you show us your data, so that we can help you better? $\endgroup$ – DeltaIV Apr 10 '17 at 14:54glmnet
. You may implement it by hand in any languages, but you need at least access to some library/tools for optimization. $\endgroup$ – DeltaIV Apr 12 '17 at 13:35