gpt4 book ai didi

sas - SAS 中的非线性多元回归

转载 作者:行者123 更新时间:2023-12-04 18:20:03 65 4
gpt4 key购买 nike

我有一个包含变量 y、x1 和 x2 的数据集。我想找到适合模型的方程式:

y = k1*x1c1 + k2 *x2c2

通过找到 k1、c1、k2 和 c2。我如何在 SAS 中执行此操作?具体来说,如果 SAS Enterprise Guide 中有简单的方法,那就更好了。

最佳答案

首先,据我所知,EG 中没有 WYSIWYG 可以执行此操作。

您可以使用多个过程,但要使它们收敛(PROC MODEL 可能是我想到的候选对象)并不容易。在此示例中,我使用了 SAS/OR 的 PROC OPTMODEL。

data test;
do i=1 to 1000;
x1 = rannor(123)*10 + 100;
x2 = rannor(123)*2 + 10;
y = 10*(x1**2) + -10*(X2**3) + rannor(123);
output;
end;
run;

proc optmodel;
num n=1000;
set<num> indx;
num y{indx}, x1{indx}, x2{indx};
read data test into indx=[_N_] y x1 x2;

var k1 init 1000,
k2 init 1000,
c1 init 1 ,
c2 init 1 ,
mean init 0;

min sse = sum{i in indx}( (y[i]-(k1*x1[i]**c1 + k2*x2[i]**c2))**2 );

solve with nlp / maxiter=1000 ms;
print k1 k2 c1 c2;
quit;

产生:

                    The OPTMODEL Procedure

Solution Summary

Solver Multistart NLP
Algorithm Interior Point
Objective Function sse
Solution Status Best Feasible
Objective Value 976.35152997

Number of Starts 100
Number of Sample Points 2560
Number of Distinct Optima 78
Random Seed Used 18410
Optimality Error 0.0049799881
Infeasibility 0


k1 k2 c1 c2

9.9999 -9.9993 2 3

关于sas - SAS 中的非线性多元回归,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24272132/

65 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com