Ask Other Engineering Expert

Introduction

This is a short analysis assignment to be undertaken individually.

This assignment involves three tasks, involving a file of simple patient data (the data are fictional and do not refer to real people).

The first task is to check the integrity of a data file (check for the presence of data errors and problems) by writing simple R code. The file contains a number of errors and potential problems. Some of the errors are obvious if you inspect the data by eye. However, marks will not be awarded for simply stating what the errors or problems are. Marks will be awarded for R code that demonstrates the presence (or absence) of errors and problems in the given data. The R code that you will submit does not need to be the most elegant or ‘clever' code possible: we are seeking a demonstration of basic R usage in this assignment. It should still be clear, concise, commented and correct.

The second task involves writing R code to perform some descriptive analysis of the data.

The third task requires you to write an R function to calculate a derived value: Body Mass Index (BMI). You will then use that function to add a column for BMI to the data. You will then need to use R to draw a histogram of the distribution of BMI.

Marking

There are 3 tasks. Task 1 is worth 30 marks. Task 2 is worth 20 marks. Task 3 is worth 10 marks. This assignment is out of 60 and contributes 30% of your final assessment mark.

Recommendations

You should prepare all your work using RStudio. Create a project called ‘assignment-2' and a script file within that project called ‘solution.R'. Put all your code in ‘solution.R' and we will run this file (and only this file) when marking your assignment.

This assignment is not difficult but will take time to complete so don't leave it until the last minute. The time available to you before this is due is more than adequate to complete the assignment.

A description of the data file ‘diabetes1.csv'

A study is underway to determine how many people presenting to an Emergency Department (ED) in a hospital with ear infections have diagnosed diabetes. The file diabetes1.csv is provided to you supposedly with the following specifications.

The file ‘diabetes1.csv' contains data on 1000 patients presenting to the ED with otitis externa (outer ear infection) in CSV format.1

Table T1 describes the data in the file column by column. Each row of the file contains one record with the column in the order as given on the first header line.2 In the table:

- A column marked as mandatory means the data in that column are required in all records

- A column marked as optional means that the data in that column may be missing for some records

Table T1:

 

Column name

 

Required?

 

Type

 

Comments

 

ID

 

mandatory

 

integer

 

unique for each patient

 

surname

 

mandatory

 

character string

 

patient's surname in upper case

 

middle.name

 

optional

 

character string

 

patient's middle name (if they have one) in mixed case

 

first.name

 

mandatory

 

character string

 

patient's first or given name in mixed case

 

gender

 

mandatory

 

character string

 

"Female" or "Male" only

 

systolic_bp

 

mandatory

 

integer

 

pressure reading in mmHg in the range 60- 220 mmHg

 

diastolic_bp

 

mandatory

 

integer

 

pressure reading in mmHg in the range 50- 150 mmHg

 

Age

 

mandatory

 

integer

 

age in whole years, only patients 18 years and older have been enrolled in the study

 

Height(cm)

 

mandatory

 

decimal number

 

measured height of the patient in cm

 

Column name

 

Required?

 

Type

 

Comments

 

weight

 

mandatory

 

integer

 

measured weight of the patient, fully clothed and with shoes on, in kg

 

RandomBSL

 

optional

 

decimal

 

blood sugar level (BSL), measured in millimole per litre (mmol/L), ≥ 2.2 mmol/L

 

HbA1c

 

optional

 

decimal

 

haemoglobin A1c measurement, as a percentage

 

DiabetesDiagnosis

 

optional

 

logical

(TRUE or FALSE)

 

whether the patient had been previously diagnosed as suffering from diabetes

Task 1

Remember: you will be submitting R code that calculates/demonstrates answers to the following questions not just a printed output. We will not be marking the printed output of your programme. We need to be able to run your programme to mark it.

Read the file ‘diabetes1.csv' into an R data frame.

You will want to use StringsAsFactors=FALSE as an optional argument to the read.csv() function to prevent character variables being automatically converted to factors.

Check that the data file conforms to the specifications for it:

- Does it have the correct number of rows?

- Does it contain all the columns it is supposed to contain

- Does it contain no additional columns?

- For each column, calculate the number and proportion (percentage) of records for which the data are missing.

- For each column, calculate the number and proportion (percentage) of records for which the data are valid (exists and is a legal value).

- Calculate the number and proportion (percentage) of records overall that contain no invalid values in any column. A missing optional value is not invalid.

Task 2

You may need to correct some problems with the data as provided in order to calculate these quantities.

All changes to the data must be made using R code, so that the changes are repeatable. Do not edit

‘diabetes1.csv (or a copy of it) by hand. You will lose marks for editing the input data to correct problems.

If you need to correct or modify the data we suggest you load the ‘raw' data into a dataframe and write a function to correct the dataframe then analyse the corrected data.

Calculate the following descriptive statistics.

- Number of patients in each of the following age brackets:

o 0-17,18-24, 25-44, 45-64, 65-84, 85+

- Number and percentage of patients:

o previously diagnosed with diabetes

o not previously diagnosed with diabetes

- Number of patients in each age group previously diagnosed with diabetes, and not previously diagnosed with diabetes (note: this is 12 values).

- The ID numbers of all patients aged over 64 years who have not previously been diagnosed with diabetes.

- Draw a histogram of RandomBSL. Some proportion of the marks will be given for proper labelling of the histogram and its axes.

Task 3

Write an R function to calculate Body Mass Index (BMI).

BMI is calculated using the following formula:

BMI = weight in kg/(height in m)2

Use your BMI function to add a column containing the calculated BMI for each patient to the data frame containing the patient data.

Draw a histogram of BMI. Some proportion of the marks will be given for proper labelling of the histogram and its axes.

Attachment:- diabetes.rar

Other Engineering, Engineering

  • Category:- Other Engineering
  • Reference No.:- M92278907
  • Price:- $90

Guranteed 48 Hours Delivery, In Price:- $90

Have any Question?


Related Questions in Other Engineering

Register design a cpu register is simply a row of

Register design A CPU register is simply a row of flip-flops (i.e. SR, JK, T, etc) put side by side in an array to make the size of register required. For example, an 8 bit register has 8 flip-flops side by side for stor ...

A detailed review of spatial modulation and simulation

A Detailed Review of Spatial Modulation and Simulation Learning Outcomes a. Learn how to model mobile communication channels d. Discern knowledge development and directions on the recent advances in 4G to the research pr ...

Mine safety amp environmental engineering assignment -part

Mine Safety & Environmental Engineering Assignment - Part 1 - Questions 1. Occupational health and safety is the primary factor that needs to be considered in the mining industry. Discuss this statement. 2. Define the fo ...

Projectflow processing of liquor in a mineral refining

Project Flow Processing of Liquor in a Mineral Refining Plant The aim of this project is to design a flow processing system of liquor (slurry) in a mineral (aluminum) refining plant. Aluminum is manufactured in two phase ...

Learning outcomes evaluate multiuser communication and

Learning Outcomes Evaluate multiuser communication and resource sharing techniques; Apply the techniques of, and report on, digital communication applications using Matlab and hardware devices. Assignment Description The ...

Operations engineering assignment -please select only one

Operations Engineering Assignment - Please select only one of the following case studies for your assignment: CASE A. Tesla Motors Tesla is an innovative manufacturer that designs, assemble and sells fully electric vehic ...

Select a risk problem from the list below and prepare a

Select a risk problem from the list below and prepare a risk management plan in accordance with AS/NZS ISO 31000:2009. Please ensure that: - Establish the context clearly, in accordance with the Standard; - Define your s ...

Engineering materials term paper assignment -conduct a

ENGINEERING MATERIALS TERM PAPER ASSIGNMENT - Conduct a thorough literature search and write a 15-20 page technical review paper on the evolution of the engineering materials used in the manufacturing of any one of the f ...

Task 1using the lab kit design a circuit for the processor

Task 1: Using the lab kit, design a circuit for the processor to control the output of a connected 7-segment LED display device. You will be provided with a standard common anode 7-segment display of the type FND-507 (or ...

Control theory - lab reportsfor experiments 1 to 4 you must

Control Theory - Lab Reports For experiments 1 to 4 you must undertake the following: a) At the start of each section (including the pre-lab activities) there are a number learning outcomes. That is, what students should ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As