The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![Plot confidence intervals for a regression model in SAS](https://blogs.sas.com/content/iml/files/2023/08/CIReg4-640x336.png)
A SAS programmer wanted to use PROC SGPLOT in SAS to visualize a regression model. The programmer wanted to visualize confidence limits for the predicted mean at certain values of the explanatory variable. This article shows two options for adding confidence limits to a scatter plot. You can use a
![Construct an envelope function for the acceptance-rejection method](https://blogs.sas.com/content/iml/files/2023/07/createDistrib3-640x336.png)
The acceptance-rejection method (sometimes called rejection sampling) is a method that enables you to generate a random sample from an arbitrary distribution by using only the probability density function (PDF). This is in contrast to the inverse CDF method, which uses the cumulative distribution function (CDF) to generate a random
![Create a probability distribution from almost any positive function](https://blogs.sas.com/content/iml/files/2023/07/createDistrib1-640x336.png)
There are dozens of common probability distributions for a continuous univariate random variable. Familiar examples include the normal, exponential, uniform, gamma, and beta distributions. Where did these distributions come from? Well, some mathematician needed a model for a stochastic process and wrote down the equation for the distribution, typically by
![The trace of a matrix of crossproducts](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
Let X be any rectangular matrix. What is the trace of the crossproducts matrix, X'*X? Interestingly, you do not need to form the crossproducts matrix to compute the answer! It turns out that tr(X'*X) equals the sum of the squared elements of X. Theorem: For any matrix, X, the trace
![Modifications of the Wilcoxon signed rank test and exact p-values](https://blogs.sas.com/content/iml/files/2023/07/SignedRank4.png)
In a previous article, I discussed the Wilcoxon signed rank test, which is a nonparametric test for the location of the median. The Wikipedia article about the signed rank test mentions a variation of the test due to Pratt (1959). Whereas the standard Wilcoxon test excludes values that equal μ0
![On the computation of the Wilcoxon signed rank statistic](https://blogs.sas.com/content/iml/files/2023/07/SignedRank4.png)
Wilcoxon's signed rank test is a popular nonparametric alternative to a paired t test. In a paired t test, you analyze measurements for subjects before and after some treatment or intervention. You analyze the difference in the measurements for each subject, and test whether the mean difference is significantly different