Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer all the question including how we would classify the variable please!! INSTRUCTIONS You will need to use R to answer this question. You must

Answer all the question including how we would classify the variable please!! INSTRUCTIONS
You will need to use R to answer this question.
You must submit a single pdf file containing your complete solutions including the R code and output.
Solutions need not be typed (although they can be) but handwritten solutions will need to be scanned
to a pdf file which must be readable.
Question 1
You will work with the NHANES dataset.
Task 1: Load the NHANES package and the NHANES dataset in your workspace. (1)
Task 2: Remove the duplicate cases from the dataframe and store the new dataframe in another object. I
am calling it df here. (1)
Use the code below for this task:
#Extract the unique IDs
df - NHANES[!duplicated(NHANES$ID),]
Task 3: Inspect the HHIncome variable!
How would you classify the variable
(i) based on its characteristic - Quantitative or Qualitative?
(ii) based on how R interprets it?
(iii) based on scales of measurement? (3)
How many categories are there in the variable? (1)
Calculate the frequency table and report the category with highest frequency (modal category).(2)
To display the variable, we can use a Barplot. In R, the barplot() function can be used to create it.
Use the code below to create the plot. (2)HHI_bp - barplot(freq_table, horiz = TRUE, yaxt='n')axis(2, at=HHI_bp, labels=levels(df$HHIncome), las =1)Provide a suitable title using the main parameter and labels for x-axis and y-axis using xlab and ylab
parameter. (3)
Task 4: Inspect the BMI variable!
How would you classify the variable
(i) based on its characteristic - Quantitative or Qualitative?
(ii) based on how R interprets it?
(iii) based on scales of measurement? (3)
Construct three histograms with 10,50 and 100 breaks. Make the y-axis of these histograms density.
You will need to use the parameter probability. Provide a suitable title for each plot (write how
many breaks) and label the x-axis. (5)
Comment on the shape of the histogram. (2)
Compute the sample mean and the sample standard deviation. Watchout for the missing values!
R uses NA to code the missing observations. (2)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions