Practice exam 1
Block 1 - Diagnostic analytics and causality
2Which statement about a normal distribution is correct?
3The conversion of a webshop rises from 2.0% to 2.3% after a new banner, based on a small sample. Which question does statistics ask here?
4A chain investigates whether advertisements increase revenue. The research shows that advertisements mainly lead to more store visits, and that more store visits lead to more revenue. Which role do store visits have?
Block 2 - Descriptive statistics, sampling and correlation
5A supermarket chain has an ordered list of N = 2000 customers (simulated data) and wants to approach n = 50 customers with systematic sampling. Which fixed step do you use?
6A survey asks "How much of your waste do you separate?" and almost everyone says "all of it", while measurements show something else. Which bias?
7For n = 100 observations (simulated data) s = 15. What is the half width of the 90% confidence interval (critical value 1.64)?
8Look at the summary of the cooling costs pCool of 211 homes. What does the difference between mean (10.116) and median (9.079) together with the maximum 83.103 say?
> summary(En$pCool) Min. 1st Qu. Median Mean 3rd Qu. Max. 2.000 6.988 9.079 10.116 11.822 83.103
Block 3 - Hypothesis testing
9A test gives a p-value of 0.03. Which interpretation is correct?
10A bank tests H0: "the transaction is legitimate". An alarm goes off for a transaction that turns out to be legitimate. Which error is this?
11A company wants to know whether the mean Leverage (target debt ratio) is greater than 0.30. What is the conclusion at alpha = 0.05?
> t.test(Gov$Leverage, alternative = "greater", mu = 0.3)
One Sample t-test
data: Gov$Leverage
t = 3.7721, df = 182, p-value = 0.0001094
alternative hypothesis: true mean is greater than 0.3
95 percent confidence interval:
0.3334157 Inf
sample estimates:
mean of x
0.3594892
12A one-way ANOVA tests whether mean rateTrain differs between three ManipDest conditions. What do you conclude?
> fit <- aov(rateTrain ~ ManipDest, data = Fl)
> summary(fit)
Df Sum Sq Mean Sq F value Pr(>F)
ManipDest 2 59836 29918 49.31 <2e-16 ***
Residuals 690 418634 607
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> tapply(Fl$rateTrain, Fl$ManipDest, mean, na.rm = TRUE)
1 2 3
29.00431 38.03404 15.37168
13A shop measures satisfaction for the same 40 customers before and after a refit. Which test fits best?
14On a scale from 1 to 5 a respondent scores 2 on a negatively worded item. What is the score after reverse coding?
Block 4 - Data cleaning and management
15What does this output say about the phone data (1224 rows)?
> dim(Ph)
[1] 1224 13
> colSums(is.na(Ph))
X brand_name model_name os popularity
0 0 0 0 0
best_price lowest_price highest_price sellers_amount screen_size
0 260 260 0 2
memory_size battery_size release_date
112 10 0
> round(100 * colMeans(is.na(Ph)), 1)
X brand_name model_name os popularity
0.0 0.0 0.0 0.0 0.0
best_price lowest_price highest_price sellers_amount screen_size
0.0 21.2 21.2 0.0 0.2
memory_size battery_size release_date
9.2 0.8 0.0
> sum(complete.cases(Ph))
[1] 852
16mean(Ph$lowest_price) returns NA. What is the cause and the fix?
> mean(Ph$lowest_price)
[1] NA
> mean(Ph$lowest_price, na.rm = TRUE)
[1] 7716.019
> sum(!is.na(Ph$lowest_price))
[1] 964
> Pc <- Ph[complete.cases(Ph[, c("best_price", "lowest_price", "highest_price")]),
+ ]
> nrow(Pc)
[1] 964
> mean(Pc$best_price)
[1] 8567.024
> mean(Ph$best_price, na.rm = TRUE)
[1] 7941.207
Block 5 - Linear regression
17Two analysts each draw a straight line through the same scatter of revenue and advertising. What makes the OLS line special?
18A retail chain models the weekly revenue of 90 stores (omzet, in €1000) using the advertising budget (reclame, in €1000), the number of employees (personeel) and a dummy for own parking (parkeer, 1 = yes). Which interpretation of the coefficient of parkeer is correct?
> rO <- lm(omzet ~ reclame + personeel + parkeer, data = wk)
> summary(rO)
Call:
lm(formula = omzet ~ reclame + personeel + parkeer, data = wk)
Residuals:
Min 1Q Median 3Q Max
-51.782 -15.942 1.157 14.433 46.104
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 43.2653 8.8803 4.872 4.99e-06 ***
reclame 2.6625 0.6187 4.303 4.44e-05 ***
personeel 6.3089 0.5061 12.465 < 2e-16 ***
parkeer -7.0823 4.8682 -1.455 0.149
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23 on 86 degrees of freedom
Multiple R-squared: 0.6644, Adjusted R-squared: 0.6527
F-statistic: 56.75 on 3 and 86 DF, p-value: < 2.2e-16
19A retail chain models the weekly revenue of 90 stores (omzet, in €1000) using the advertising budget (reclame, in €1000), the number of employees (personeel) and a dummy for own parking (parkeer, 1 = yes). Which statement about R² and adjusted R² is correct?
> rO <- lm(omzet ~ reclame + personeel + parkeer, data = wk)
> summary(rO)
Call:
lm(formula = omzet ~ reclame + personeel + parkeer, data = wk)
Residuals:
Min 1Q Median 3Q Max
-51.782 -15.942 1.157 14.433 46.104
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 43.2653 8.8803 4.872 4.99e-06 ***
reclame 2.6625 0.6187 4.303 4.44e-05 ***
personeel 6.3089 0.5061 12.465 < 2e-16 ***
parkeer -7.0823 4.8682 -1.455 0.149
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23 on 86 degrees of freedom
Multiple R-squared: 0.6644, Adjusted R-squared: 0.6527
F-statistic: 56.75 on 3 and 86 DF, p-value: < 2.2e-16
20A retail chain models the weekly revenue of 90 stores (omzet, in €1000) using the advertising budget (reclame, in €1000), the number of employees (personeel) and a dummy for own parking (parkeer, 1 = yes). The coefficient of parkeer has p = 0.149. Which conclusion at α = 0.05 is correct?
> rO <- lm(omzet ~ reclame + personeel + parkeer, data = wk)
> summary(rO)
Call:
lm(formula = omzet ~ reclame + personeel + parkeer, data = wk)
Residuals:
Min 1Q Median 3Q Max
-51.782 -15.942 1.157 14.433 46.104
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 43.2653 8.8803 4.872 4.99e-06 ***
reclame 2.6625 0.6187 4.303 4.44e-05 ***
personeel 6.3089 0.5061 12.465 < 2e-16 ***
parkeer -7.0823 4.8682 -1.455 0.149
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23 on 86 degrees of freedom
Multiple R-squared: 0.6644, Adjusted R-squared: 0.6527
F-statistic: 56.75 on 3 and 86 DF, p-value: < 2.2e-16
21The store model (omzet ~ reclame + personeel + parkeer) leaves out "location in a shopping centre". Shopping-centre stores have more revenue and also spend more on advertising; location is not related to personeel or parkeer. Which consequence is likely?
22A retail chain models the weekly revenue of 90 stores (omzet, in €1000) using the advertising budget (reclame, in €1000), the number of employees (personeel) and a dummy for own parking (parkeer, 1 = yes). What does the model predict for the weekly revenue (in €1000) of a store with reclame = 10, personeel = 12 and own parking?
> rO <- lm(omzet ~ reclame + personeel + parkeer, data = wk)
> summary(rO)
Call:
lm(formula = omzet ~ reclame + personeel + parkeer, data = wk)
Residuals:
Min 1Q Median 3Q Max
-51.782 -15.942 1.157 14.433 46.104
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 43.2653 8.8803 4.872 4.99e-06 ***
reclame 2.6625 0.6187 4.303 4.44e-05 ***
personeel 6.3089 0.5061 12.465 < 2e-16 ***
parkeer -7.0823 4.8682 -1.455 0.149
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23 on 86 degrees of freedom
Multiple R-squared: 0.6644, Adjusted R-squared: 0.6527
F-statistic: 56.75 on 3 and 86 DF, p-value: < 2.2e-16
23A retail chain models the weekly revenue of 90 stores (omzet, in €1000) using the advertising budget (reclame, in €1000), the number of employees (personeel) and a dummy for own parking (parkeer, 1 = yes). What is the t-value for the test of H0: β(reclame) = 0 against H1: β ≠ 0?
> rO <- lm(omzet ~ reclame + personeel + parkeer, data = wk)
> summary(rO)
Call:
lm(formula = omzet ~ reclame + personeel + parkeer, data = wk)
Residuals:
Min 1Q Median 3Q Max
-51.782 -15.942 1.157 14.433 46.104
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 43.2653 8.8803 4.872 4.99e-06 ***
reclame 2.6625 0.6187 4.303 4.44e-05 ***
personeel 6.3089 0.5061 12.465 < 2e-16 ***
parkeer -7.0823 4.8682 -1.455 0.149
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23 on 86 degrees of freedom
Multiple R-squared: 0.6644, Adjusted R-squared: 0.6527
F-statistic: 56.75 on 3 and 86 DF, p-value: < 2.2e-16
Block 6 - Logistic regression, overfitting and validation
24A web shop wants to predict whether a visitor buys (1) or does not buy (0). Why is a linear regression with OLS on this 0/1 outcome less suitable than a logistic regression?
25See the output of the acceptance model (n = 500, simulated data). What do you conclude about Leeftijd at α = 0.05?
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.059258 0.636016 -4.810 1.51e-06 ***
Inkomen 0.043241 0.009569 4.519 6.22e-06 ***
Koophuis 1.010191 0.231169 4.370 1.24e-05 ***
Leeftijd -0.014108 0.007500 -1.881 0.06 .
26The coefficient of Inkomen (in €1,000) is 0.043241. By what factor do the odds of acceptance change with €10,000 extra income, holding other variables equal?
27Of 2,000 transactions, 30 are fraudulent. A model always predicts 'no fraud'. What is the accuracy of this model?
28For Koophuis the Estimate is 1.010191 and the Std. Error 0.231169. What is the z value?
29A telecom company can retain a customer about to cancel with an offer that costs €10 per customer. If it misses a canceller, it loses €400 in revenue. Which adjustment fits these costs?
30An analyst estimates two models for renewal of a fitness membership on 150 training and 150 test observations: simple (3 predictors) and extended (29 parameters, with interactions and noise variables; simulated data). Accuracy at threshold 0.5: simple train 0.67 and test 0.62; extended train 0.85 and test 0.58. What do you conclude?
Block 7 - Open questions on R output
7.1Tasks (together at most 200 words): 1. Interpret the coefficients of Storingen and Jaarcontract in business language, including significance at α = 0.05 (4 points). 2. Calculate the accuracy and the sensitivity of the model (2 points). 3. Explain why management's judgement is misleading (3 points).
A telecom company wants to predict which customers cancel (Opzegt = 1). For 1000 customers (simulated data), Klantjaren (years as a customer), Storingen (number of outages in the past year) and Jaarcontract (Ja = customer has an annual contract, reference category Nee) were recorded. The company estimates a logistic regression. With a threshold of 0.5 the confusion matrix below results (1 first, TP top left, as on the exam). Management thinks the model is good because the accuracy is high.
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.00234 0.25439 -7.871 3.52e-15 ***
Klantjaren -0.06843 0.03214 -2.129 0.0333 *
Storingen 0.47901 0.08446 5.671 1.42e-08 ***
JaarcontractJa -1.08271 0.23463 -4.614 3.94e-06 ***
Null deviance: 693.03 on 999 degrees of freedom
Residual deviance: 634.01 on 996 degrees of freedom
AIC: 642.01
Waargenomen
Voorspeld 1 0
1 2 3
0 108 887
Answer builder
7.2Write a short reflection on the output. Address the following points (250 words maximum in total): 1. Interpret the main regression coefficients from the output. 2. Interpret the p-values and what they say about statistical significance. 3. Assess the model fit and the predictive power of the model. 4. What concerns are there about the sample (bias, representativeness) and how do internal and external validity affect your conclusions?
An estate agent investigates what explains the value per m2 (valuem2, in dollars) of houses on Long Island. The 90 houses are the sales that the office mediated in one year; the predictors are the annual property tax (taxes, in dollars), the number of rooms (rooms), the age (age, in years) and the lot size (lotsize). Write a short reflection (at most 250 words in total) on the output.
> rB <- lm(valuem2 ~ taxes + rooms + age + lotsize, data = Hu)
> summary(rB)
Call:
lm(formula = valuem2 ~ taxes + rooms + age + lotsize, data = Hu)
Residuals:
Min 1Q Median 3Q Max
-102.17 -36.91 -16.50 32.39 185.05
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 453.778348 45.955407 9.874 9.21e-16 ***
taxes -0.004509 0.008509 -0.530 0.5976
rooms 2.553870 5.452191 0.468 0.6407
age -1.112723 0.483400 -2.302 0.0238 *
lotsize -0.202761 0.017868 -11.348 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 60.54 on 85 degrees of freedom
Multiple R-squared: 0.6384, Adjusted R-squared: 0.6214
F-statistic: 37.52 on 4 and 85 DF, p-value: < 2.2e-16
Answer builder
7.3Assignments (together at most 150 words): 1. Name the role of visit frequency and of age in the causal relationship scheme (2 points). 2. Formulate one testable hypothesis about the effect of the trial month on renewal, and give the corresponding null hypothesis (3 points). 3. Explain why it is important to formulate the hypothesis before the data collection (2 points).
A fitness chain wants to know whether a free trial month raises the probability that members renew their membership. The director thinks a trial month makes members visit the gym more often (visit frequency), and that members who visit more often renew more often. He expects this effect to be stronger for members under 30 than for older members. No data have been collected yet.