essayreg2: Linear Regression (Cloze with Essay and File Upload)

Exercise template for interpreting a regression with two explanatory variables based on randomly-generated data (with either a linear, semi-logarithmic, or log-log relationship) in form of a cloze including essay and file upload.

Name:
essayreg2
Type:
Related:
Preview:

Using the data provided in regression.csv estimate a linear regression of y on x1 and x2. Answer the following questions.

Proportion of variance explained (in percent):

F-statistic:

Characterize in your own words how the response y depends on the regressors x1 and x2.

Upload the R script you used to analyze the data.

The presented results describe a semi-logarithmic regression.


Call:
lm(formula = log(y) ~ x1 + x2, data = d)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.68802 -0.67816 -0.01803  0.68866  2.35064 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.06802    0.13491  -0.504    0.616
x1           1.37863    0.13351  10.326 9.34e-15
x2          -0.21449    0.13995  -1.533    0.131

Residual standard error: 1.052 on 58 degrees of freedom
Multiple R-squared:  0.6511,    Adjusted R-squared:  0.6391 
F-statistic: 54.12 on 2 and 58 DF,  p-value: 5.472e-14

The mean of the response y increases with increasing x1. If x1 increases by 1 unit then a change of y by about 296.94 percent can be expected. Also, the effect of x1 is significant at the 5 percent level.

Variable x2 has no significant influence on the response at 5 percent level.

The R-squared is 0.6511 and thus 65.11 percent of the variance of the response is explained by the regression.

The F-statistic is 54.12.

  • Proportion of variance explained: 65.11 percent.
  • F-statistic: 54.12.
  • Characterization: semi-logarithmic.
  • R code.

Using the data provided in regression.csv estimate a linear regression of y on x1 and x2. Answer the following questions.

Proportion of variance explained (in percent):

F-statistic:

Characterize in your own words how the response y depends on the regressors x1 and x2.

Upload the R script you used to analyze the data.

The presented results describe a log-log regression.


Call:
lm(formula = log(y) ~ log(x1) + log(x2), data = d)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.2455 -0.2693 -0.0071  0.2339  0.9976 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.01096    0.04900  -0.224    0.824
log(x1)      0.96949    0.04432  21.875   <2e-16
log(x2)      0.02591    0.05341   0.485    0.629

Residual standard error: 0.447 on 81 degrees of freedom
Multiple R-squared:  0.8555,    Adjusted R-squared:  0.8519 
F-statistic: 239.8 on 2 and 81 DF,  p-value: < 2.2e-16

The mean of the response y increases with increasing x1. If x1 increases by 1 percent then a change of y by about 0.97 percent can be expected. Also, the effect of x1 is significant at the 5 percent level.

Variable x2 has no significant influence on the response at 5 percent level.

The R-squared is 0.8555 and thus 85.55 percent of the variance of the response is explained by the regression.

The F-statistic is 239.78.

  • Proportion of variance explained: 85.55 percent.
  • F-statistic: 239.78.
  • Characterization: log-log.
  • R code.

Using the data provided in regression.csv estimate a linear regression of y on x1 and x2. Answer the following questions.

Proportion of variance explained (in percent):

F-statistic:

Characterize in your own words how the response y depends on the regressors x1 and x2.

Upload the R script you used to analyze the data.

The presented results describe a log-log regression.


Call:
lm(formula = log(y) ~ log(x1) + log(x2), data = d)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.90603 -0.25642 -0.01465  0.21672  1.25306 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  0.07904    0.06266   1.261    0.213
log(x1)     -0.82335    0.06078 -13.547   <2e-16
log(x2)     -0.03764    0.06424  -0.586    0.560

Residual standard error: 0.4479 on 54 degrees of freedom
Multiple R-squared:  0.7784,    Adjusted R-squared:  0.7702 
F-statistic: 94.85 on 2 and 54 DF,  p-value: < 2.2e-16

The mean of the response y decreases with increasing x1. If x1 increases by 1 percent then a change of y by about -0.82 percent can be expected. Also, the effect of x1 is significant at the 5 percent level.

Variable x2 has no significant influence on the response at 5 percent level.

The R-squared is 0.7784 and thus 77.84 percent of the variance of the response is explained by the regression.

The F-statistic is 94.85.

  • Proportion of variance explained: 77.84 percent.
  • F-statistic: 94.85.
  • Characterization: log-log.
  • R code.
Description:
The results of a linear regression model (linear, semi-logarithmic, or log-log) need to be obtained and interpreted in a "cloze" question. This comprises two "num" elements (R-squared and F-statistic), an open-ended "essay" element for interpreting the model output, and a "file" upload for the R script used by the participants. This type of extended cloze question is currently supported in QTI 2.1 (OpenOlat in particular).
Solution feedback:
Yes
Randomization:
Random numbers and text blocks
Mathematical notation:
No
Verbatim R input/output:
Yes
Images:
No
Other supplements:
regression.csv
Raw: (1 random version)
PDF:
essayreg2-Rmd-pdf
essayreg2-Rnw-pdf
HTML:
essayreg2-Rmd-html
essayreg2-Rnw-html

Demo code:

library("exams")

set.seed(403)
exams2html("essayreg2.Rmd")
set.seed(403)
exams2pdf("essayreg2.Rmd")

set.seed(403)
exams2html("essayreg2.Rnw")
set.seed(403)
exams2pdf("essayreg2.Rnw")