To estimate the parameters of a model in which all parameters are constrained to be greater than zero and to sum to one, you can use PROC FMM in SAS/STAT®, PROC MODEL in SAS/ETS®, or PROC NLP in SAS/OR®.
Using PROC FMM
These statements create a data set with normally-distributed response, R, whose values are generated from a model with parameters 0.2, 0.3, 0.1, and 0.4 for the predictors X1 through X4, respectively.
data test;
array xarray {4} x1-x4;
do i=1 to 50;
do j=1 to 4;
xarray{j}=0.8+0.4*ranuni(55555);
end;
r = 0.2*x1 + 0.3*x2 + 0.1*x3 + 0.4*x4 + 0.0001*rannor(99999);
output;
end;
run;
The following statements fit the model using PROC FMM in SAS/STAT software. The first four RESTRICT statements constrain each predictor parameter to be positive. The last RESTRICT statement constrains their sum to equal one.
proc fmm data=test;
model r = x1 x2 x3 x4;
restrict x1 1 >= 0;
restrict x2 1 >= 0;
restrict x3 1 >= 0;
restrict x4 1 >= 0;
restrict x1 1 x2 1 x3 1 x4 1 = 1;
run;
Note that the estimated parameters are positive, essentially equal to the true values, and sum to one. The Linear Constraints table shows that the sum-to-one constraint was active at the solution. The four positivity constraints were not active, presumably because their unconstrained estimates were already positive.
x1 + x2 + x3 + x4 |
= |
1 |
Yes |
x1 |
>= |
0 |
No |
x2 |
>= |
0 |
No |
x3 |
>= |
0 |
No |
x4 |
>= |
0 |
No |
0.000024 |
0.000014 |
1.72 |
0.0855 |
0.2002 |
0.000121 |
1655.96 |
<.0001 |
0.2998 |
0.000132 |
2279.43 |
<.0001 |
0.1001 |
0.000114 |
881.33 |
<.0001 |
0.4000 |
0.000099 |
4047.48 |
<.0001 |
1E-8 |
0 |
|
|
|
Using PROC MODEL
These statements estimate the model parameters using the SAS/ETS procedure MODEL. The BOUNDS statement requires each of the parameters to be positive and the RESTRICT statement requires the parameters to sum to one.
proc model data=test;
parms b1 .25 b2 .25 b3 .25 b4 .25;
bounds b1>=0, b2>=0, b3>=0, b4>=0;
restrict b1+b2+b3+b4=1;
r = b1*x1 + b2*x2 + b3*x3 + b4*x4;
fit r;
run; quit;
The results show the estimated parameters to be quite close to the true parameters and that they sum to one. Notice that a test of the sum-to-one restriction is also provided.
3 |
47 |
4.036E-7 |
8.587E-9 |
0.000093 |
1.0000 |
1.0000 |
0.200143 |
0.000112 |
1788.76 |
<.0001 |
|
0.299786 |
0.000122 |
2461.65 |
<.0001 |
|
0.100099 |
0.000105 |
953.32 |
<.0001 |
|
0.399971 |
0.000092 |
4370.01 |
<.0001 |
|
-147998 |
75615.6 |
-1.96 |
0.0492 |
b1+b2+b3+b4=1 |
|
Using PROC NLP
The following statements use PROC NLP in SAS/OR Software to fit the same model.
proc nlp data=test cov=2;
lsq z;
array b{4} b1-b4;
parms b1-b4=.25;
bounds b1-b4>=0;
lincon b1+b2+b3+b4=1;
z = r - (b1*x1 + b2*x2 + b3*x3 + b4*x4);
run;
Again, the estimated parameters are close to their true values and sum to one. However, a test of the restriction is not available.
0.200143 |
0.000112 |
1788.764467 |
3.07422E-115 |
-0.001271 |
0.299786 |
0.000122 |
2461.650232 |
9.33609E-122 |
-0.001271 |
0.100099 |
0.000105 |
953.316396 |
2.15388E-102 |
-0.001271 |
0.399971 |
0.000091526 |
4370.011391 |
1.7996E-133 |
-0.001271 |
|
Operating System and Release Information
SAS System | SAS/STAT | All | n/a | |
SAS System | SAS/ETS | z/OS | | |
OpenVMS VAX | | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
Microsoft Windows XP 64-bit Edition | | |
Microsoft® Windows® for x64 | | |
OS/2 | | |
Microsoft Windows 95/98 | | |
Microsoft Windows 2000 Advanced Server | | |
Microsoft Windows 2000 Datacenter Server | | |
Microsoft Windows 2000 Server | | |
Microsoft Windows 2000 Professional | | |
Microsoft Windows NT Workstation | | |
Microsoft Windows Server 2003 Datacenter Edition | | |
Microsoft Windows Server 2003 Enterprise Edition | | |
Microsoft Windows Server 2003 Standard Edition | | |
Microsoft Windows XP Professional | | |
Windows Millennium Edition (Me) | | |
Windows Vista | | |
64-bit Enabled AIX | | |
64-bit Enabled HP-UX | | |
64-bit Enabled Solaris | | |
ABI+ for Intel Architecture | | |
AIX | | |
HP-UX | | |
HP-UX IPF | | |
IRIX | | |
Linux | | |
Linux on Itanium | | |
OpenVMS Alpha | | |
OpenVMS on HP Integrity | | |
Solaris | | |
Solaris for x64 | | |
Tru64 UNIX | | |
SAS System | SAS/OR | z/OS | | |
OpenVMS VAX | | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
Microsoft Windows XP 64-bit Edition | | |
Microsoft® Windows® for x64 | | |
OS/2 | | |
Microsoft Windows 95/98 | | |
Microsoft Windows 2000 Advanced Server | | |
Microsoft Windows 2000 Datacenter Server | | |
Microsoft Windows 2000 Server | | |
Microsoft Windows 2000 Professional | | |
Microsoft Windows NT Workstation | | |
Microsoft Windows Server 2003 Datacenter Edition | | |
Microsoft Windows Server 2003 Enterprise Edition | | |
Microsoft Windows Server 2003 Standard Edition | | |
Microsoft Windows XP Professional | | |
Windows Millennium Edition (Me) | | |
Windows Vista | | |
64-bit Enabled AIX | | |
64-bit Enabled HP-UX | | |
64-bit Enabled Solaris | | |
ABI+ for Intel Architecture | | |
AIX | | |
HP-UX | | |
HP-UX IPF | | |
IRIX | | |
Linux | | |
Linux on Itanium | | |
OpenVMS Alpha | | |
OpenVMS on HP Integrity | | |
Solaris | | |
Solaris for x64 | | |
Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.