Question: R coding Question: The following codes are used to select 500 samples out of NHANES data set: install.packages('NHANES') ; install.packages('tidyverse') library(tidyverse) library(NHANES) small.nhanes 17,c(1,3,4,8:11,13,17,20,21,25,46,50,51,52,61)]) small.nhanes

R coding Question:

The following codes are used to select 500 samples out of NHANES data set:

install.packages('NHANES') ; install.packages('tidyverse')

library(tidyverse)

library(NHANES)

small.nhanes <- na.omit(NHANES[NHANES$SurveyYr=="2011_12"

& NHANES$Age > 17,c(1,3,4,8:11,13,17,20,21,25,46,50,51,52,61)])

small.nhanes <- as.data.frame(small.nhanes %>%

group_by(ID) %>% filter(row_number()==1) )

nrow(small.nhanes)

## Checking whether there are any ID that was repeated. If not ##

## then length(unique(small.nhanes$ID)) and nrow(small.nhanes) are same ##

length(unique(small.nhanes$ID))

## Create training set (sample) ##

set.seed(1003756295)

train <- small.nhanes[sample(seq_len(nrow(small.nhanes)), size = 500),]

nrow(train)

length(which(small.nhanes$ID %in% train$ID))

Here is what I should build in R (I need help here)

The combined systolic blood pressure reading (BPSysAve) is our outcome of interest. Every

other variable other than the ID can be considered as predictors. We are mainly interested on the

effect of smoking (SmokeNow) on the combined systolic blood pressure reading. However, we are

also interested in the prediction of the combined systolic blood pressure reading and identifying

which variables are the best for the prediction. Your analysis should include:

Model Diagnostics

Checking for the variance inflation factor (VIF)

Variable selection

Shrinkage methods

Model Validation

Checking the prediction error on the test set after applying various model selection techniques

After selecting the best model interpret and explain the parameter estimates

Conclude on the effect of predictors on the combined systolic blood pressure reading

Can someone help me on coding the above points in R.Thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!