Programming Tips

Strengthen your programming skills with tips and techniques from the experts

Analytics | Programming Tips
Rick Wicklin 0
Symbolic derivatives in SAS

Did you know that you can get SAS to compute symbolic (analytical) derivatives of simple functions, including applying the product rule, quotient rule, and chain rule? SAS can form the symbolic derivatives of single-variable functions and partial derivatives of multivariable functions. Furthermore, the derivatives are output in a form that

Advanced Analytics | Programming Tips
Makoto Unemi (畝見 真) 0
SAS Viyaで線形回帰

SAS Viyaで線形回帰を行う方法を紹介します。 言語はPythonを使います。 SAS Viyaで線形回帰を行う方法には大きく以下の手法が用意されています。 多項回帰: simpleアクションセットで提供。 一般化線形回帰または一般線形回帰: regressionアクションセットで提供。 機械学習で回帰: 各種機械学習用のアクションセットで提供。 今回は単純なサインカーブを利用して、上記3種類の回帰モデルを作ってみます。   【サインカーブ】 -4≦x<4の範囲でサインカーブを作ります。 普通に $$y = sin(x) $$を算出しても面白みがないので、乱数を加減して以下のようなデータを作りました。これをトレーニングデータとします。 青い点線が $$y=sin(x)$$ の曲線、グレーの円は $$y=sin(x)$$ に乱数を加減したプロットです。 グレーのプロットの中心を青い点線が通っていることがわかります。 今回はグレーのプロットをトレーニングデータとして線形回帰を行います。グレーのプロットはだいぶ散らばって見えますが、回帰モデルとしては青い点線のように中心を通った曲線が描けるはずです。 トレーニングデータのデータセット名は "sinx" とします。説明変数は "x"、ターゲット変数は "y" になります。 各手法で生成したモデルで回帰を行うため、-4≦x<4 の範囲で0.01刻みで"x" の値をとった "rangex" というデータセットも用意します。 まずはCASセッションを生成し、それぞれのデータをCASにアップロードします。 import swat host = "localhost" port = 5570 user = "cas" password = "p@ssw0rd"

Data Visualization | Programming Tips
Warren F. Kuhfeld 0
Advanced ODS Graphics: Examining and processing templates

This post shows a variety of techniques including how to use PROC TEMPLATE and the SOURCE statement, PROC SGPLOT with multiple Y-axis tables, create comparable axes in two side-by-side graphs, create a broken axis, write and use a table template that wraps text, and find and display examples of certain statements in graph templates and fonts in style templates.

Programming Tips
Rick Wicklin 0
The arithmetic-geometric mean

All statisticians are familiar with the classical arithmetic mean. Some statisticians are also familiar with the geometric mean. Whereas the arithmetic mean of n numbers is the sum divided by n, the geometric mean of n nonnegative numbers is the n_th root of the product of the numbers. The geometric

1 37 38 39 40 41 65

Back to Top