Statistics Quiz - Languages R
Free practice quiz: Statistics (Languages R). 53 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
Play all 53 questions freeSample questions
In R, which function is primarily used for calculating the variance of a dataset?
- sd()
- mean()
- var()
- median()
Show answer
Answer: C. var()
The `var()` function in R is specifically designed to compute the sample variance of a numeric vector. `sd()` calculates the standard deviation, `mean()` calculates the average, and `median()` finds the middle value.
What does the standard deviation measure?
- The average value of the data
- The spread or dispersion of data points around the mean
- The middle value of the dataset
- The range of the data
Show answer
Answer: B. The spread or dispersion of data points around the mean
Standard deviation quantifies the amount of variation or dispersion of a set of values. A low standard deviation indicates that the values tend to be close to the mean, while a high standard deviation indicates that the values are spread out over a wider range.
Which statistical measure is sensitive to outliers?
- Median
- Interquartile Range
- Mean
- Mode
Show answer
Answer: C. Mean
The mean is calculated by summing all values and dividing by the count. Extreme values (outliers) can significantly pull the mean towards them, thus making it sensitive to outliers. The median and IQR are more robust to outliers.
In R, what does `set.seed(n)` primarily do?
- Sets the working directory.
- Ensures reproducibility of random number generation.
- Clears the console.
- Loads a dataset.
Show answer
Answer: B. Ensures reproducibility of random number generation.
Calling `set.seed(n)` before generating random numbers ensures that the sequence of random numbers generated will be the same each time the code is run. This is crucial for reproducible research.
What is the primary goal of descriptive statistics?
- To make predictions about future events.
- To draw conclusions about a population based on a sample.
- To summarize and describe the main features of a dataset.
- To establish cause-and-effect relationships.
Show answer
Answer: C. To summarize and describe the main features of a dataset.
Descriptive statistics involve methods for summarizing and organizing data, such as calculating measures of central tendency (mean, median), dispersion (variance, standard deviation), and creating visualizations like histograms and box plots.