gpt4 book ai didi

statistics - Proc Reg 根据新的观察结果做出预测

转载 作者:行者123 更新时间:2023-12-04 01:14:12 26 4
gpt4 key购买 nike

我正在尝试基于 SAS 中的线性模型创建预测区间。我的 SAS 代码是

proc reg data=datain.aswells alpha=0.01;
model arsenic = latitude longitude depth_ft / clb;
run;

我希望使用 latitude=23.75467longitude=90.66169depth_ft=25 进行 95% 的预测区间。该数据点不存在于数据集中,但它在用于计算模型的值范围内。有没有一种简单的方法可以在 SAS 中完成此操作?难道不应该有一种方法可以在 SAS 中轻松计算这个预测区间吗?

最佳答案

最简单的方法是将其添加到您的输入数据集中,同时缺少 ARSENIC 值。然后使用OUTPUT语句输出预测区间。

这是一个例子:

data test;
do i=1 to 100;
x1 = rannor(123);
x2 = rannor(123)*2 + 1;
y = 1*x1 + 2*x2 + 4*rannor(123);
output;
end;
run;

data test;
set test end=last;
output;
if last then do;
y = .;
x1 = 1.5;
x2 = -1;
output;
end;
run;

proc reg data=test alpha=.01;
model y = x1 x2;
output out=test_out(where=(y=.)) p=predicted ucl=UCL_Pred lcl=LCL_Pred;
run;
quit;

输出上的 WHERE 子句将结果集过滤为仅要预测的缺失值。您可以将其删除并获取所有预测值和预测区间。

关于statistics - Proc Reg 根据新的观察结果做出预测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26211840/

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