The purpose of this in-class lab is to practice conducting hypothesis tests about regression parameters in R. The lab may be completed in a group. To get credit, upload your .R script to the appropriate place on Canvas.
Open up a new R script (named ICL7_XYZ.R
, where XYZ
are your initials) and add the usual “preamble” to the top:
# Add names of group members HERE
library(tidyverse)
library(broom)
library(wooldridge)
library(magrittr)
library(modelsummary)
We’ll use a new data set on Research and Development (R&D) expenditures, called rdchem
. The data set contains information on 32 companies in the chemical industry.
df <- as_tibble(rdchem)
Check out what’s in the data by typing
datasummary_df(df)
datasummary_skim(df,histogram=FALSE)
The main variables are measures of R&D, profits, sales, and profits as a percentage of sales (profmarg
, i.e. profit margin).
Estimate the following regression model: \[
rdintens = \beta_0 + \beta_1 \log(sales) + \beta_2 profmarg + u
\] Note that the variable \(log(sales)\) already exists in df
as lsales
. \(rdintens\) is in percentage units, so a number of 2.6 means that the company’s total R&D expenditures are 2.6% of its sales.
I won’t show you the code for estimating this model, as it should be old hat by now. If you’ve forgotten, I recommend looking at code from a previous lab.
Answer the following questions:
lsales
. If \(sales\) increase by 10%, what is the estimated percentage point change in \(rdintens\)?tidy(est)
, test the hypothesis that sales affects R&D intensity at the 10% level. In other words, test: \[
H_0: \beta_1 = 0;
H_a: \beta_1 \neq 0
\]