In: Statistics and Probability
Movies 3a and 3b: 1. Using either R studio and/or SPSS calculate the mean and standard deviation for the question 4 data (first tab in your excel spreadsheet). Be sure to cut and paste your output from SPSS and/or your R code into this document. (1 point) The standard deviation was: The mean was:
Age 5 3 5 3 2 3 1 2 4 2 4 2 6 5 5 4 3 5 3 1 4 2 3 5 6 4 4 2 9 8 9 7 7 2 6 4 9 7
Dear student, I have performed it in R studio, I hope it helps. In the case of any doubt, please comment and I would love to clarify it.
sd() is the function in R to calculate the standard deviation whereas mean() is the function to calculate the mean of the dataset.
Code used -
#assigning the dataset to the variable age
age =
c(5,3,5,3,2,3,1,2,4,2,4,2,6,5,5,4,3,5,3,1,4,2,3,5,6,4,4,2,9,8,9,7,7,2,6,4,9,7)
#calculating the mean and assigning it to variable
mean_age
mean_age <- mean(age)
#calculating standard deviation by using the function sd
sd(age)
Output
> mean_age
[1] 4.368421
> sd(age)
[1] 2.222989