为了账号安全,请及时绑定邮箱和手机立即绑定

SAS Loess Scatter Plot

SAS Day 32: Loess Model Scatter Plot

When I was in Middle School, Sin(x) and Cos(x) are my favorite curves, because they are so predictable! Once we know the cycle and amplitude, we can solve everything about it. 
However, in statistical modeling, oscillating curves are not so welcomed. Today we will introduce the Loess Plot for finding a curve of best fit without assuming the data must fit some distribution shape.

Loess regression is a nonparametric technique that uses locally weighted regression to fit a smooth curve through points in a scatter plot.

LOESS: Locally weighted scatter plot smoothing

we will use ENSO dataset to perform a Loess graph.

ENSO-El Nino Southern Oscillation dataset capture the monthly averaged atmospheric pressure differences between Easter Island and Darwin, Australia for 168 months.

[caption id=“attachment_2190” align=“alignnone” width=“750”]

Cleverpix / Pixabay[/caption]

Basic Loess Graph with 95% Confidence Limits

image

proc sgplot data=sashelp.enso;
title “losess Fit”;
loess y=pressure x=month/clm;
run;

Advanced Loess Graph with Linear, Polynomial, and Penalized B-Spline Model comparison

proc sgplot data=sashelp.enso;
title “Fit Functions”;
reg y=pressure x=month/legendlabel=“Linear”;
reg y=pressure x=month/legendlabel=“Cubic” degree=3 nomarkers;
pbspline y=pressure x=month/nomarkers;
loess y=pressure x=month/nomarkers;
run;

image

proc template;
define statgraph Fits;
begingraph;
entrytitle “Fit Functions”;
layout overlay;
scatterplot y=pressure x=month;
regressionplot y=pressure x=month/lineattrs=GraphData1 name=“Linear”;
regressionplot y=pressure x=month/lineattrs=GraphData2 name=“Cubic” degree=3;
pbsplineplot y=pressure x=month/lineattrs=GraphData3 name=“Penalized B-spline”;
loessplot y=pressure x=month/lineattrs=GraphData4 name=“Loess”;
discretelegend “Linear” “Cubic” “Penalized B-spline” “Loess”;
endlayout;
endgraph;
end;
run;

proc sgrender data=sashelp.enso template=Fits;
run;

Both Proc SGPLOT and Proc Template would generate the same result. As we can see, Linear and 3rd-degree Polynomial are not great approaches for ENSO dataset.  The statistical model winner for ENSO dataset are LOESS and Penalized B-Spline.

Reference:

Creating Statistical Graphics in SAS,
*Warren F.Kuhfeld  *

Happy Practicing!  🍹

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消