为了账号安全,请及时绑定邮箱和手机立即绑定
首页 手记 SAS Loess Plot

SAS Loess Plot

2019.05.30 04:12 2106浏览

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 *

点击查看更多内容
0人点赞

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

评论

作者其他优质文章

正在加载中
手记
粉丝
20
获赞与收藏
12

关注TA,一起探索更多经验知识

同主题相似文章浏览排行榜

风间影月说签约讲师

51篇手记,涉及Java、MySQL、Redis、Spring等方向

进入讨论

Tony Bai 说签约讲师

152篇手记,涉及Go、C、Java、Python等方向

进入讨论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消