Get Similar Answers, Custom Writing & Assignment Help Services

To hire a writer, fill the order form in a few guided steps - with details from your paper's instructions.

Posted: November 17th, 2022

Assignment #2

Assignment #2
Due Date: November 15th, 11:59pm
This assignment is worth 10% of your final grade and has 4 sections. Please save all your code for this assignment as a .R file and name that file:
“assignment_2_lastname_firstname.R”. If your .R file is not correctly named, you will lose 0.5 mark. Be sure to save while you write your code for this assignment. Please number each part in your assignment in the form of a comment. At the top of your code, please comment your name, student number, and “Assignment #2”.
Section 1.
Part 1.1. We have created three lines of code that you will need to run at the beginning of your R code. Each line of code will produce 20 numbers and you will need to create a vector with these numbers and assign it the appropriate name (please see below). Please only run these lines of code once. Please note that each student will receive a
random set of numbers (i.e. your numbers will not be the same as any of your classmates). (0.75 mark)
• sample(160:200, 20, replace=TRUE) o assign the above 20 numbers to the name ‘height’.
• sample(50:113, 20, replace=TRUE) o assign the above 20 numbers to the name ‘weight’.
• sample(0:1260, 20, replace=TRUE) o assign the above 20 numbers to the name ‘exercise_minutes’.
Part 1.2. Using the three vectors produced in Part 1.1, create a dataframe and name this dataframe ‘df’. Once you create this dataframe, it will appear in your Global
Environment and this dataframe should contain 20 observations and 3 variables (0.25 mark).
Section 2.
Part 2.1. Last week, you learned about covariance and correlation in the online lecture. You will now apply what you learned in this assignment. In the next parts, you will be calculating the correlation coefficient of the ‘weight’ and ‘exercise_minutes’ variables. (There are no marks for this part, this is just a description.)
Part 2.2. Plot a histogram of each variable in the ‘df’ dataframe, comment the shape, and any other relevant commentary about each histogram. (2.25 marks)
Part 2.3. Calculate the mean, median, and standard deviation of each of the variables, provide these values as comments, and comment how they relate to the histogram. (3 marks)
Part 2.4. Create a new variable (i.e. column) in the ‘df’ dataframe and name this column ‘new_variable1’. This variable should contain the values calculated using the following calculation: (???? – ??¯), where ???? is each value in the ‘weight’ variable (i.e. ??1 is the first value of the ‘weight’ variable) and ??¯ is the mean of all the values in the ‘weight’ variable. (0.25 mark)
Part 2.5. Create a new variable (i.e. column) in the ‘df’ dataframe and name this column ‘new_variable2’. This variable should contain the values calculated using the following calculation: (???? – ??¯), where ???? is each value in the ‘exericse_minutes’ variable (i.e. ??3is the third value of the y variable) and ??¯ is the mean of all the values in the ‘exericse_minutes’ variable. (0.25 mark)
Part 2.6. Create a new variable (i.e. column) in the ‘df’ dataframe and name this column ‘product_2_variables’. This variable should contain the values of the product between the ‘new_variable1’ and ‘new_variable2’ columns you created in Part 2.4 and Part 2.5. (Here is the equation: (???? – ??¯)(???? – ??¯) ). (0.25 mark)
Part 2.7. In this part you will need to calculate the correlation coefficient of the ‘weight’ and ‘exercise_minutes’ variables. We have walked you through the first steps of how to calculate this coefficient in Parts 2.3-2.6. Now using those parts, the knowledge that you gained from Lecture 7, as well as the equation presented in Lecture 7 Slide 21, calculate the correlation coefficient and comment this value. Please be sure to use R to calculate the coefficient and show all your steps in this component. (1.5 marks)
Section 3.
Part 3.1. Using two built-in R functions, calculate both the covariance and correlation of the ‘weight’ and ‘exericse_minutes’ variables. Provide both values as comments. (1.0 mark)
Section 4.
Part 4.1. Please describe the direction and effect size of your correlation coefficient calculated in Part 2.7 as comments in your code. (0.5 mark)

Order | Check Discount

Tags: Assignment #2

Assignment Help For You!

Special Offer! Get 15-30% Off on Each Order!

Why Seek Our Custom Writing Services

Every Student Wants Quality and That’s What We Deliver

Graduate Essay Writers

Only the most qualified writers are selected to be a part of our research and editorial team, with each possessing specialized knowledge in specific subjects and a background in academic writing.

Affordable Prices

Our prices strike the perfect balance between affordability and quality. We offer student-friendly rates that are competitive within the industry, without compromising on our high writing service standards.

100% Plagiarism-Free

No AI/chatgpt use. We write all our papers from scratch thus 0% similarity index. We scan every final draft before submitting it to a customer.

How it works

When you decide to place an order with Nursing Study Bay, here is what happens:

Fill the Order Form

You will complete our order form, filling in all of the fields and giving us as much guidelines - instruction details as possible.

Assignment of Writer

We assess your order and pair it with a skilled writer who possesses the specific qualifications for that subject. They then start the research/writing from scratch.

Order in Progress and Delivery

You and the assigned expert writer have direct communication throughout the process. Upon receiving the final draft, you can either approve it or request revisions.

Giving us Feedback (and other options)

We seek to understand your experience. You can also review testimonials from other clients, from where you can select your preferred professional writer to assist with your homework assignments.

For Similar Answers, Custom Essay Writing & Assignment Help Services

Find an expert with a few clicks and guided steps, fill an order form for your nursing paper. We write AI-plagiarism free essays and research papers. Anytime!.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00