Statistics Technology & Digital Applications 2 — Questions and Answers
Question 1: In R, which function is used to compute the Pearson correlation coefficient between two numeric vectors x and y?
- cov(x, y)
- cor(x, y) (Correct answer)
- var(x, y)
- mean(x, y)
Correct answer: cor(x, y)
The cor() function in R computes the Pearson correlation coefficient by default when given two numeric vectors.
Question 2: A data analyst runs a logistic regression in Python's scikit-learn and calls model.predict_proba(X). What does this return?
- Class labels for each observation
- Log-odds for each class
- Probability estimates for each class (Correct answer)
- Confusion matrix values
Correct answer: Probability estimates for each class
predict_proba() returns estimated class probabilities rather than hard class label predictions.
Question 3: Which SQL aggregate function computes the arithmetic mean of a numeric column named 'score'?
- SUM(score)
- COUNT(score)
- AVG(score) (Correct answer)
- MEDIAN(score)
Correct answer: AVG(score)
AVG() is the standard SQL aggregate function that calculates the arithmetic mean of non-null values in a column.
Question 4: In a Jupyter Notebook, a statistician wants to display a histogram of variable 'data' using matplotlib. Which call is correct?
- plt.bar(data)
- plt.scatter(data)
- plt.hist(data) (Correct answer)
- plt.pie(data)
Correct answer: plt.hist(data)
plt.hist() generates a histogram, which displays the frequency distribution of a continuous variable.
Question 5: Which Excel function calculates the standard deviation of a population stored in cells A1:A20?
- =STDEV(A1:A20)
- =STDEVP(A1:A20) (Correct answer)
- =VAR(A1:A20)
- =AVERAGE(A1:A20)
Correct answer: =STDEVP(A1:A20)
STDEVP() divides by N (population), while STDEV() divides by N-1 (sample), making STDEVP correct for a full population.
Question 6: A researcher uses a statistical software package and sets a random seed before running a simulation. What is the primary reason for doing this?
- To speed up computation
- To ensure reproducible results (Correct answer)
- To increase sample size
- To reduce Type I error
Correct answer: To ensure reproducible results
Setting a random seed fixes the sequence of pseudo-random numbers, ensuring the same results can be reproduced by others running the same code.
Question 7: In Tableau, which chart type is best suited for showing the relationship between two continuous statistical variables?
- Gantt chart
- Scatter plot (Correct answer)
- Treemap
- Bullet chart
Correct answer: Scatter plot
A scatter plot maps two continuous variables on the x and y axes, making it ideal for visualizing correlation and bivariate distributions.
In R, which function is used to compute the Pearson correlation coefficient between two numeric vectors x and y?