Posts Tagged ‘ simulation ’

Random segments and broken sticks

July 26, 2017
By
Random segments and broken sticks

A classical problem in elementary probability asks for the expected lengths of line segments that result from randomly selecting k points along a segment of unit length. It is both fun and instructive to simulate such problems. This article uses simulation in the SAS/IML language to estimate solutions to the

The post Read more »

Tags: ,
Posted in SAS | Comments Off on Random segments and broken sticks

Runs in coin tosses; patterns in random seating

June 5, 2017
By
Runs in coin tosses; patterns in random seating

If you toss a coin 28 times, you would not be surprised to see three heads in a row, such as ...THHHTH.... But what about eight heads in a row? Would a sequence such as THHHHHHHHTH... be a rare event? This question popped into my head last weekend as I

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Runs in coin tosses; patterns in random seating

How to choose a seed for generating random numbers in SAS

June 1, 2017
By

Last week I was asked a simple question: "How do I choose a seed for the random number functions in SAS?" The answer might surprise you: use any seed you like. Each seed of a well-designed random number generator is likely to give rise to a stream of random numbers,

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on How to choose a seed for generating random numbers in SAS

Simulate lognormal data in SAS

May 10, 2017
By
Simulate lognormal data in SAS

A SAS customer asked how to simulate data from a three-parameter lognormal distribution as specified in the PROC UNIVARIATE documentation. In particular, he wanted to incorporate a threshold parameter into the simulation. Simulating lognormal data is easy if you remember an important fact: if X is lognormally distributed, then Y=log(X)

The post Read more »

Tags: ,
Posted in SAS | Comments Off on Simulate lognormal data in SAS

Monte Carlo estimates of joint probabilities

March 1, 2017
By
Monte Carlo estimates of joint probabilities

Monte Carlo techniques have many applications, but a primary application is to approximate the probability that some event occurs. The idea is to simulate data from the population and count the proportion of times that the event occurs in the simulated data. For continuous univariate distributions, the probability of an

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Monte Carlo estimates of joint probabilities

Simulate many samples from a linear regression model

February 1, 2017
By
Simulate many samples from a linear regression model

In a previous article, I showed how to simulate data for a linear regression model with an arbitrary number of continuous explanatory variables. To keep the discussion simple, I simulated a single sample with N observations and p variables. However, to use Monte Carlo methods to approximate the sampling distribution

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Simulate many samples from a linear regression model

Simulate data for a linear regression model

January 25, 2017
By
Simulate data for a linear regression model

This article shows how to simulate a data set in SAS that satisfies a least squares regression model for continuous variables. When you simulate to create "synthetic" (or "fake") data, you (the programmer) control the true parameter values, the form of the model, the sample size, and magnitude of the

The post Read more »

Tags: ,
Posted in SAS | Comments Off on Simulate data for a linear regression model

The contaminated normal distribution

December 28, 2016
By
The contaminated normal distribution

How can you generate data that contains outliers in a simulation study? The contaminated normal distribution is a simple but useful distribution you can use to simulate outliers. The distribution is easy to explain and understand, and it is also easy to implement in SAS. What is a contaminated normal

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on The contaminated normal distribution

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

Sponsors





Dear readers, proc-x is looking for sponsors who would be willing to support the site in exchange for banner ads in the right sidebar of the site. If you are interested, please e-mail me at: tal.galili@gmail.com
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.