O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running a regression with imputed values

Now that you have imputed a value for age, you will be able to run models such as linear regression without having to discard missing values.

Let's try a regression with imputation #2.

First, extract impute #2:

impute.2 <- subset(all_imputed_df,.imp=='2')  

Next, run the summary() function at the console to insure there are no more NAs:

> summary(impute.2).imp   .id   Age  Gender0: 0 1  : 1 Min. :20.00 M:10001: 0 10  : 1 1st Qu.:23.00 F:10002:2000 100 : 1 Median :28.00  3: 0 1000 : 1 Mean :27.58  4: 0 1001 : 1 3rd Qu.:32.00  5: 0 1002 : 1 Max. :35.00    (Other):1994              EducationRegular High School Diploma    :522Bachelor's Degree      :323Some College, 1 or More Years, No Degree:2959th Grade to 12th Grade, No Diploma :169 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required