I want to force one of the coefficients in my model to be less than or equal to zero.
The nnls package allows you to set all coefficients equal to or greater than zero, but I'm at a loss as to how to specify a specific coefficient to be less than zero.
Any help would be greatly appreciated.
The function nnnpls in the same package is "an implementation of least squares with non-negative and non-positive constraints".
Its third argument, con, allows one to specify which coefficients should be non-positive:
numeric vector of length
mwhere elementiis negative if and only if elementiof the solution vectorxshould be constrained to non-positive, as opposed to non-negative, values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With