Posts Tagged ‘ simulation ’

Simulate multivariate clusters in SAS

September 13, 2017
By
Simulate multivariate clusters in SAS

This article shows how to simulate data from a mixture of multivariate normal distributions, which is also called a Gaussian mixture. You can use this simulation to generate clustered data. The adjacent graph shows three clusters, each simulated from a four-dimensional normal distribution. Each cluster has its own within-cluster covariance, [...] The post Simulate multivariate clusters in SAS appeared first on The DO Loop.

Read more »

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 Random segments and broken sticks appeared first on The DO Loop.

Read more »

easy riddle

July 11, 2017
By
easy riddle

From the current Riddler, a problem that only requires a few lines of code and a few seconds of reasoning. Or not. N households each stole the earnings from one of the (N-1) other households, one at a time. What is the probability that a given household is not burglarised? And what are the expected […]

Read more »

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 Runs in coin tosses; patterns in random seating appeared first on The DO Loop.

Read more »

How to choose a seed for generating random numbers in SAS

June 1, 2017
By
How to choose a seed for generating random numbers in SAS

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 How to choose a seed for generating random numbers in SAS appeared first on The DO Loop.

Read more »

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 Simulate lognormal data in SAS appeared first on The DO Loop.

Read more »

what does more efficient Monte Carlo mean?

March 16, 2017
By
what does more efficient Monte Carlo mean?

“I was just thinking that there might be a magic trick to simulate directly from this distribution without having to go for less efficient methods.” In a simple question on X validated a few days ago [about simulating from x²φ(x)] popped up the remark that the person asking the question wanted a direct simulation method […]

Read more »

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 Monte Carlo estimates of joint probabilities appeared first on The DO Loop.

Read more »

an accurate variance approximation

February 6, 2017
By
an accurate variance approximation

In answering a simple question on X validated about producing Monte Carlo estimates of the variance of estimators of exp(-θ) in a Poisson model, I wanted to illustrate the accuracy of these estimates against the theoretical values. While one case was easy, since the estimator was a Binomial B(n,exp(-θ)) variate [in yellow on the graph], […]

Read more »

a well-hidden E step

February 2, 2017
By
a well-hidden E step

A recent question on X validated ended up being quite interesting! The model under consideration is made of parallel Markov chains on a finite state space, all with the same Markov transition matrix, M, which turns into a hidden Markov model when the only summary available is the number of chains in a given state […]

Read more »


Subscribe

Email:

  Subscribe