Regression Inference in R

From ECLR
Revision as of 09:14, 14 April 2015 by Rb (talk | contribs) (Created page with "here we will discuss how to perform standard inference in regression models. = Setup = We continue the example we started in R_Regression#A first example and which is rep...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

here we will discuss how to perform standard inference in regression models.

Setup

We continue the example we started in R_Regression#A first example and which is replicated here, but note the first line which we include to gain access to the procedures in the AER toolbox:

    library(AER)  # allow access to AER package
    # This is my first R regression!
    setwd("T:/ECLR/R/FirstSteps")              # This sets the working directory
    mydata <- read.csv("mroz.csv")  # Opens mroz.csv from working directory
     
    # Now convert variables with "." to num with NA
    mydata$wage <- as.numeric(as.character(mydata$wage))
    mydata$lwage <- as.numeric(as.character(mydata$lwage))

Before we run our initial regression model we shall restrict the dataframe mydata to those data that do not have missing wage information, using the following subset command:

   mydata <- subset(mydata, wage!="NA")  # select non NA data

Now we can run our initial regression:

    # Run a regression
    reg_ex1 <- lm(lwage~exper+log(huswage),data=mydata)
    reg_ex1_sm <- summary(reg_ex1)


t-tests

We use t-tests to test simple coefficient restrictions on regression coefficients.


F-tests

F-tests are used to test multiple coefficient restrictions on regression coefficients.