Now that we are many months into the COVID-19 pandemic, I've started going back and reexamining the data for lessons or trends (you might say hindsight is 20/20). This time, I want to explore how COVID-19 has been spreading around the US. I do this by using a graphical idea
Search Results: sgplot (964)
The Poisson-binomial distribution is a generalization of the binomial distribution. For the binomial distribution, you carry out N independent and identical Bernoulli trials. Each trial has a probability, p, of success. The total number of successes, which can be between 0 and N, is a binomial random variable. The distribution
Learn how to use the SGPLOT procedure for graphical representation when you perform statistical analysis for a quadratic ANCOVA model with the GLM procedure.
The HighLow plot often enables you to create many custom plots without resorting to annotation. Although it is designed to create a candlestick chart for stocks, it is incredibly versatile. Recently, a SAS programmer wanted to create a patient-profile graph that looked like a stacked bar chart but had repeated
Finding the root (or zero) of a nonlinear function is an important computational task. In the case of a one-variable function, you can use the SOLVE function in PROC FCMP to find roots of nonlinear functions in the DATA step. This article shows how to use the SOLVE function to
I recently showed how to use simulation to estimate the power of a statistical hypothesis test. The example (a two-sample t test for the difference of means) is a simple SAS/IML module that is very fast. Fast is good because often you want to perform a sequence of simulations over
A previous article about standardizing data in groups shows how to simulate data from two groups. One sample (with n1=20 observations) is simulated from an N(15, 5) distribution whereas a second (with n2=30 observations) is simulated from an N(16, 5) distribution. The sample means of the two groups are close
Last month a SAS programmer asked how to fit a multivariate Gaussian mixture model in SAS. For univariate data, you can use the FMM Procedure, which fits a large variety of finite mixture models. If your company is using SAS Viya, you can use the MBC or GMM procedures, which
I recently showed how to compute within-group multivariate statistics by using the SAS/IML language. However, a principal of good software design is to encapsulate functionality and write self-contained functions that compute and return the results. What is the best way to return multiple statistics from a SAS/IML module? A convenient
The multivariate normal distribution is used frequently in multivariate statistics and machine learning. In many applications, you need to evaluate the log-likelihood function in order to compare how well different models fit the data. The log-likelihood for a vector x is the natural logarithm of the multivariate normal (MVN) density
During the 2020 Coronavirus pandemic, you've probably formed a great appreciation for good, informative graphics. Good graphics can help you get a handle on thousands of individual data values, see the geographical distribution, or look for trends. In February, I wrote a blog post about creating a coronavirus dashboard with
A previous article discusses the pooled variance for two or groups of univariate data. The pooled variance is often used during a t test of two independent samples. For multivariate data, the analogous concept is the pooled covariance matrix, which is an average of the sample covariance matrices of the
A SAS customer asked how to specify interaction effects between a classification variable and a spline effect in a SAS regression procedure. There are at least two ways to do this. If the SAS procedure supports the EFFECT statement, you can build the interaction term in the MODEL statement. For
The Kullback–Leibler divergence is a measure of dissimilarity between two probability distributions. An application in machine learning is to measure how distributions in a parametric family differ from a data distribution. This article shows that if you minimize the Kullback–Leibler divergence over a set of parameters, you can find a
If you're close to my age, you probably remember Joe Walsh's song Ordinary Average Guy. That song popped into my head when I was writing this example about moving averages, so I encourage you to listen to it while reading the blog post. Many people are looking at graphs lately
This article shows how to find local maxima and maxima on a regression curve, which means finding points where the slope of the curve is zero. An example appears at the right, which shows locations where the loess smoother in a scatter plot has local minima and maxima. Except for
SAS programmers sometimes ask about ways to perform one-dimensional linear interpolation in SAS. This article shows three ways to perform linear interpolation in SAS: PROC IML (in SAS/IML software), PROC EXPAND (in SAS/ETS software), and PROC TRANSREG (in SAS/STAT software). Of these, PROC IML Is the simplest to use and
この記事はSAS Institute Japanが翻訳および編集したもので、もともとはRick Wicklinによって執筆されました。元記事はこちらです(英語)。 2020年における新型コロナウイルスの世界的流行のようなエピデミック状況下では、各国の感染確認者の累計数を示すグラフがメディアによって頻繁に示されます。多くの場合、これらのグラフは縦軸に対数スケール(対数目盛)を使います。このタイプのグラフにおける直線は、新たなケースが指数関数的ペースで急増していることを示します。直線の勾配はケースがどれほど急速に倍加するかの程度を示し、急勾配の直線ほど倍加時間が短いことを示します。ここでの「倍加時間」とは、「関連状況が何も変わらないと仮定した場合に、累計の感染確認者数が倍増するまでに要する時間の長さ」のことです。 本稿では、直近のデータを用いて倍加時間を推計する一つの方法を紹介します。この手法は、線形回帰を用いて曲線の勾配(m)を推計し、その後、倍加時間を log(2) / m として推計します。 本稿で使用しているデータは、2020年3月3日~3月27日の間の、4つの国(イタリア、米国、カナダ、韓国)における新型コロナウイルス感染症(以下、COVID-19)の感染確認者の累計数です。読者の皆さんは、本稿で使用しているデータとSASプログラムをダウンロードすることができます。 累計感染者数の対数スケール・ビジュアライゼーション このデータセットには4つの変数が含まれています。 変数Region: 国を示します。 変数Day: 2020年3月3日からの経過日数を示します。 変数Cumul: COVID-19の感染確認者の累計数を示します。 変数Log10Cumul: 感染確認累計数の「10を底とする対数」(=常用対数)を示します。SASでは、LOG10関数を用いて常用対数を計算することができます。 これらのデータをビジュアル化する目的には、PROC SGPLOTを使用できます。下図のグラフは感染確認者の総数をプロットしていますが、総数の縦軸に常用対数を指定するために「type=LOG」と「logbase=10」というオプションを使用しています。 title "Cumulative Counts (log scale)"; proc sgplot data=Virus; where Cumul > 0; series x=Day y=Cumul / group=Region curvelabel; xaxis grid; yaxis type=LOG logbase=10 grid values=(100 500 1000
I've previously written about how to generate points that are uniformly distributed in the unit disk. A seemingly unrelated topic is the distribution of eigenvalues (in the complex plane) of various kinds of random matrices. However, I recently learned that these topics are somewhat related! A mathematical result called the
I previously wrote about the advantages of adding horizontal and vertical reference lines to a graph. You can also add a diagonal reference line to a graph. The SGPLOT procedure in SAS supports two primary ways to add a diagonal reference line: The LINEPARM statement enables you to specify a
Data tell a story. A purpose of data visualization is to convey that story to the reader in a clear and impactful way. Sometimes you can let the data "speak for themselves" in an unadorned graphic, but sometimes it is helpful to add reference lines to a graph to emphasize
Deep learning is an area of machine learning that has become ubiquitous with artificial intelligence. The complex, brain-like structure of deep learning models is used to find intricate patterns in large volumes of data. These models have heavily improved the performance of general supervised models, time series, speech recognition, object
I have written several articles about how to work with continuous probability distributions in SAS. I always emphasize that it is important to be able to compute the four essential functions for working with a statistical distribution. Namely, you need to know how to generate random values, how to compute
SAS Global Forum 2020 is not the conference experience we thought it would be. Thousands of us had planned to gather in person to share our enthusiasm and knowledge about SAS and power of data and analytics. We were going to combine our skills and knowledge to inspire one another
During an epidemic, such as the coronavirus pandemic of 2020, the media often shows graphs of the cumulative numbers of confirmed cases for different countries. Often these graphs use a logarithmic scale for the vertical axis. In these graphs, a straight line indicates that new cases are increasing at an
A cumulative curve shows the total amount of some quantity at multiple points in time. Examples include: Total sales of songs, movies, or books, beginning when the item is released. Total views of blog posts, beginning when the post is published. Total cases of a disease for different countries, beginning
When you create a graph by using the SGPLOT procedure in SAS, usually the default tick locations are acceptable. Sometimes, however, you might want to specify a set of custom tick values for one or both axes. This article shows three examples: Specify evenly spaced values. Specify tick values that
Martin Mincey of SAS Technical Support shows you how to debug when listing registered SAS fonts, registering new fonts, getting SAS SG procedures to use a new font and more.
Recently, I saw a graphic on Twitter by @neilrkaye that showed the rapid convergence of a regular polygon to a circle as you increase the number of sides for the polygon. The author remarked that polygons that have 40 or more sides "all look like circles to me." That is,
In a previous article, I discussed the binormal model for a binary classification problem. This model assumes a set of scores that are normally distributed for each population, and the mean of the scores for the Negative population is less than the mean of scores for the Positive population. I