We fit a linear regression for the economic journals demand model. ```{r regression} data("Journals", package = "AER") journals_lm <- lm(log(subs) ~ log(price/citations), data = Journals) journals_lm ``` A scatter plot with the fitted regression line is shown in the figure below. ```{r visualization, echo=FALSE, fig.height=5, fig.width=6} plot(log(subs) ~ log(price/citations), data = Journals) abline(journals_lm) ``` The fitted regression line is \[ \log(\mbox{subscriptions}) \quad = \quad `r round(coef(journals_lm)[1], digits = 2)` `r if(coef(journals_lm)[2] < 0) "-" else "+"` `r abs(round(coef(journals_lm)[2], digits = 2))` \cdot \log(\mbox{price per citation}) \] The table below summarizes the results of the model along with a slightly extended model in type of table commonly used in economics and social science publications. This can be easily produced with the _modelsummary_ package. ```{r summary-table} journals_lm2 <- lm(log(subs) ~ log(price/citations) + foundingyear, data = Journals) library("modelsummary") msummary(journals_lm2, stars = TRUE) ```