I was wondering if there a way to force a multiple regression model’s coefficient, obtained with the caret package, to be positive (x2>=0). For example, I would like to force x2 in the code below to be a positive number. Thank you!
tc <- trainControl(method = "LOOCV")
model <- train(form = y ~ x1 + x2, data = df, method = "lm",
metric = "MAE", maximize = T,
trControl = tc, na.action = na.omit)