Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello,
In my regression model I'm trying to constrain values of one of one of my parameters to be between 0 and 1 using solve block and minerr function (model attached). Anybody has an idea how can I do it?
Regards,
Tomasz
Solved! Go to Solution.
Weighting does the job for me. The result is a very small, but positive value of m.
Generally your second approach using the full vector of residuals and minerr rather then the single SSE-value is the better one and also in your case you get the better SSE value that way.
Your system seems to be conditioned in a way that the best SSE values are achieved with negative values of m. So if you demand m>0 the best choice would be m=0 (or only marginal larger). Larger values of m increase the error.
You may demand m>0.1 and the solve block will return m=0.1
So you can experiment with various values between 0 and 1 and all values greater than zero will give you higher SSE values than m=0.
Not sure which parameter should be constrained.
Does a constraint like
0<m<1
not work? I see you have written just m>0.
I just see that m2 is negative even though you wrote m>0. It could help to give more "weight" to this constraint (at the cost of the others) by writing 10^6*m>0 or something like that.
Can't try myself without the Excel data file.
Hi Werner_E,
I tried constraining m to be 0<m<1 but it doesn't work, neither does weighting. unfortunately my model has physical meaning if m has values between 0 and 1. I attach spreadsheet.
Weighting does the job for me. The result is a very small, but positive value of m.
Generally your second approach using the full vector of residuals and minerr rather then the single SSE-value is the better one and also in your case you get the better SSE value that way.
Your system seems to be conditioned in a way that the best SSE values are achieved with negative values of m. So if you demand m>0 the best choice would be m=0 (or only marginal larger). Larger values of m increase the error.
You may demand m>0.1 and the solve block will return m=0.1
So you can experiment with various values between 0 and 1 and all values greater than zero will give you higher SSE values than m=0.
Thanks, seems like a solution to my problem. Could I ask you what does weighting do? I don't quite get it how setting constrain of m belonging to (10^5;10^6) would make my parameter to be greater than zero?
I dont't know exactly how the algorithm for minerr in Prime is working. But obviously its calculating the absolute (?) difference of the values from the one you demand and calculates something similar to an SSE. That is 31 values from your residuals plus the difference of m to the desired 0 (or greater).
Without weighting (m>0) we get m=-0.3 which is an absolute difference of 0.3 which seems to have indeed some influence on the out come (m=-0.35 and SSE=7.364 without m>0 , m=-0.3 and SSE=7.377 with that constraint). But the constraint has to fight against the 31 residuals which should be near zero.
When we write 10^6*m>0 the same value of m creates a difference of 300000 which is rather high and so Prime tries to make that better (at the cost of the values in the residual vector of course) for an overall better fit. Your SSE (which does not include the constraint m>0) gets worse that way.
When you want to weight the condition m>0.1 you could multiply both sides by 10^6 and you et 10^6*m>10^5.
You could also write 10^6*(m-0.1)>0 for better readability.
BTW, if m=0 is an option, you may make m a constant and not a parameter to your functions as weighting m>0 high will result in m=0 anyway.
This data set is representing only one set of data from many I have (total 64 data sets representing various conditions). From some data regression I get parameters with values that are in the "right range" some are not like this I shared. Comparing the parameters of the regression from different sets I can validate them and see if they make sense for different conditions (physical properties) which I know from literature research how they should influence the model. For this particular data set the result of m<0 or m=0 doesn't make sense because. And I have data sets for very similar conditios (physical properties) that gives me values of m(0,1). Variance of the parameters from my regression analysis is to big. Hence now, I have to think how can I use mathcad to somehow find values of parameters from different sets that will make sense based on the conditions (physical properties) for each set.