This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up**This preview shows
pages
1–2. Sign up
to
view the full content.*

Introduction to One-Variable Transformations
Statistics 342
Example #1
- Transformations of a Single Random Variable: Normal Distribution
Generate a sample of 10,000 observations from a normal distribution with mean = 10 and standard
deviation = 3
normsample<- rnorm(10000, 10, 3)
Calculate the observed mean of this sample.
mean(normsample)
[1] 10.03625
Calculate the observed standard deviation of this sample.
sqrt(var(normsample))
[1] 3.021919
Get a histogram of this sample data.
The "prob = T" part of the command gives you a probability
histogram.
hist(normsample, prob = T)
Transform the observed data in normsample to a new variable called newdata.
This transformation
takes the value of the normal random variable and subtracts the mean and divides by the standard
deviation.
This is the standardization process discussed in typical introductory statistics courses.
newdata<- (normsample - 10)/3
Calculate the observed mean of the observations of this new variable.
Notice that the value is

This
** preview**
has intentionally

This is the end of the preview. Sign up
to
access the rest of the document.

Ask a homework question
- tutors are online