Posts Tagged ‘ simulation ’

Head-tail versus head-head: A counterintuitive property of coin tosses

April 13, 2016
By
Head-tail versus head-head: A counterintuitive property of coin tosses

I saw an interesting mathematical result in Wired magazine. The original article was about mathematical research into prime numbers, but the article included the following tantalizing fact: If Alice tosses a coin until she sees a head followed by a tail, and Bob tosses a coin until he sees

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Head-tail versus head-head: A counterintuitive property of coin tosses

Generate points uniformly inside a d-dimensional ball

April 6, 2016
By
Generate points uniformly inside a d-dimensional ball

Last week I showed how to generate random points uniformly inside a 2-d circular region. That article showed that the distance of a point to the circle's center cannot be distributed uniformly. Instead, you should use the square root of a uniform variate to generate 2-D distances to the origin.

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Generate points uniformly inside a d-dimensional ball

Generate points uniformly inside a circular region in 2-D

March 30, 2016
By
Generate points uniformly inside a circular region in 2-D

It is easy to generate random points that are uniformly distributed inside a rectangle. You simply generate independent random uniform values for each coordinate. However, nonrectangular regions are more complicated. An instructive example is to simulate points uniformly inside the ball with a given radius. The two-dimensional case is to

The post Read more »

Tags: ,
Posted in SAS | Comments Off on Generate points uniformly inside a circular region in 2-D

Simulate from the multinomial distribution in the SAS DATA step

March 16, 2016
By
Simulate from the multinomial distribution in the SAS DATA step

There are several ways to simulate multinomial data in SAS. In the SAS/IML matrix language, you can use the RANDMULTINOMIAL function to generate samples from the multinomial distribution. If you don't have a SAS/IML license, I have previously written about how to use the SAS DATA step or PROC SURVEYSELECT

The post Read more »

Tags: ,
Posted in SAS | Comments Off on Simulate from the multinomial distribution in the SAS DATA step

Monte Carlo estimates of pi and an important statistical lesson

March 14, 2016
By
Monte Carlo estimates of pi and an important statistical lesson

Today is March 14th, which is annually celebrated as Pi Day. Today's date, written as 3/14/16, represents the best five-digit approximation of pi. On Pi Day, many people blog about how to approximate pi. This article uses a Monte Carlo simulation to estimate pi, in spite of the fact that

The post Read more »

Tags: , , ,
Posted in SAS | Comments Off on Monte Carlo estimates of pi and an important statistical lesson

Four essential sampling methods in SAS

February 15, 2016
By
Four essential sampling methods in SAS

Many simulation and resampling tasks use one of four sampling methods. When you draw a random sample from a population, you can sample with or without replacement. At the same time, all individuals in the population might have equal probability of being selected, or some individuals might be more likely

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Four essential sampling methods in SAS

Sample with replacement and unequal probability in SAS

February 10, 2016
By
Sample with replacement and unequal probability in SAS

How do you sample with replacement in SAS when the probability of choosing each observation varies? I was asked this question recently. The programmer thought he could use PROC SURVEYSELECT to generate the samples, but he wasn't sure which sampling technique he should use to sample with unequal probability. This

The post Read more »

Tags: , ,
Posted in SAS | Comments Off on Sample with replacement and unequal probability in SAS

Monte Carlo simulation for contingency tables in SAS

October 28, 2015
By
Monte Carlo simulation for contingency tables in SAS

The FREQ procedure in SAS supports computing exact p-values for many statistical tests. For small and mid-sized problems, the procedure runs very quickly. However, even though PROC FREQ uses efficient methods to avoid unnecessary computations, the computational time required by exact tests can be prohibitively expensive for large sample sizes.

The post Read more »

Tags: ,
Posted in SAS | Comments Off on Monte Carlo simulation for contingency tables in SAS

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.