SPSS tutorials

BASICS REGRESSION T-TEST ANOVA CORRELATION

SPSS RV Function

Basic Use

COMPUTE v1 = RV.NORMAL(0,1).

Summary

In SPSS, RV is short for random variable. It draws random values from a given probability distribution.Strictly, probability density functions should be distinguished from probability distribution functions but we'll refer to both as “probability distributions”. The latter is specified as a period separated suffix as in RV.BERNOULLI(.5).RV is mostly but not necessarily used with COMPUTE.

Random sample from standard normal distribution Random Sample (N = 10,000) from a Standard Normal Distribution

SPSS Rv Examples

A nice way to get familiar with some common probability distributions is to visualize them. The syntax below does this by computing random variables from different distributions and creating their histograms with FREQUENCIES. After running it, we'll briefly walk through the distributions we visualized.

SPSS Rv Syntax Examples

*1. Create cases.

input program.
loop id = 1 to 1e4. /* 1e4 is short for 1 * 10**4 (= 10,000).
end case.
end loop.
end file.
end input program.

*2. Normal (Gaussian) distribution.

compute normal_distribution = rv.normal(0,1).

frequencies normal_distribution/histogram/format notable.

*3. Uniform distribution.

compute uniform_distribution = rv.uniform(0,5).

frequencies uniform_distribution/histogram/format notable.

*4. Bernoulli distribution.

compute bernoulli_distribution = rv.bernoulli(.3).

frequencies bernoulli_distribution/histogram/format notable.

*5. Binomial distribution.

compute binomial_distribution = rv.binom(5,.5).

frequencies binomial_distribution/histogram/format notable.

Common Probability Distributions

Final Notes

Previous tutorial: SPSS RANK Command

Next tutorial: SPSS Scratch Variables

Let me know what you think!

*Required field. Your comment will show up after approval from a moderator.

This tutorial has 2 comments