Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pepper's Pill Mill is a pharmaceutical company that is developing a new drug to help fight Alzheimer's disease. The drug has performed well in laboratory

Pepper's Pill Mill is a pharmaceutical company that is developing a new drug to help fight Alzheimer's disease. The drug has performed well in laboratory experiments, and the company has received approval to begin trials with people. To help make sure that the trial is unbiased, they are asking you to develop a Java program that can perform the data analysis and determine the drug's effectiveness.

Each trial consists of 3 groups of individuals undergoing different treatment:

  1. Control Group- No treatment.
  2. Experimental Group - New Drug Administered.
  3. Placebo Group - Fake Drug (sugar pills) Administered.

Every individual in each group gets the same memory evaluation, and the doctor will write down a score for that individual as a number between 0 and 100. There are many patients in each group, so some simple statistics are necessary to determine the effectiveness of the treatment.

DIRECTIONS

Input and Output Your program should take as input:

  • File names for three input files (one for each group in the trial)
  • A file name for the output file

Your program should output:

  • A file with the trial results

Your program should ask for the names of 3 files (input files) that contain memory evaluation data for the three groups in this trial. Your program should then ask for a name for the file that will hold the trial results (the output file). All files will be located in the same directory as your program.

Each input data file contains a list of integers - one on each line. The study is double-blind, so your program will not know which data file corresponds to which experimental group. Additionally, the group sizes may be different.

For each input file, your program should read in the data from the file. Your program will need to calculate the average and standard deviation for that data set. Your program will also need to determine if there is a significant difference between each pair of groups in this trial.

To determine if there is a significant difference between two groups in the trial, your program must compute the positive difference between the averages of the two groups. If the difference between the averages is larger than the standard deviations of both groups, then this is a significant result.

For example, given the following statistics:

group 1: average = 69.00, standard deviation = 18.42 group 2: average = 47.00, standard deviation = 19.92 group 3: average = 51.58, standard deviation = 19.20

There is a significant difference between group 1 and group 2, because:

69.00 - 47.00 is greater than 18.42 and 69.00 - 47.00 is greater than 19.92

However, there is not a significant difference between group 1 and group 3, because:

69.00 - 51.58 is not greater than 18.42

Your program should write the results to an output file. The results file will have two sections. The first section (Statistics) will list the name of each input file, followed by the average and then the standard deviation for that file. The second section (Results) will list the names of the two files being compared, and an indication (true or false) of whether or not the result is significant.

Here is a generalized example of the output file format:

Statistics: :   :   :   Results:  vs.  : (true/false)  vs.  : (true/false)  vs.  : (true/false) 

Required Class In addition to the class that contains your main method, you must implement and use the following TrialGroup class in your program. This class will be used to instantiate objects that will represent each of the three groups in a trial.

Each TrialGroup object will store the important information for one trial group:

the name of the file containing the group data (fileName), the number of data points in that file (count), the sum of the values in that file (sum), and the sum of the squares of the values in that file (sumOfSquares).

These stored values will be used to calculate the average, and the standard deviation for the group.

The TrialGroup object will also be able to determine and return:

the average of the values in the group (getAverage), the standard deviation of the values in the group (getStandardDeviation), and the name of the file that the values came from (getFileName).

TrialGroup

- fileName : String

- count : int

- sum : int

- sumOfSquares : int

+ TrialGroup(fileName : String) <>

+ getAverage( ) : double

+ getStandardDeviation( ) : double

+ getFileName( ) : String

The constructor for this class must initialize a TrialGroup object by:

  1. Storing the file name that is passed in as an argument, in the instance variable fileName.
  2. Opening the file whose name is passed in as an argument (fileName)
  3. Reading in the values in the file and determining the count, sum, and sum of the squares for the values in the file.
  4. Storing these values in the instance variables (count, sum, sumOfSquares)

The getFileName method will simply return a copy of the string stored in the instance variable fileName.

The getAverage method will compute and return the average of the values in this trial group.

The getStandardDeviation method will compute and return the standard deviation of the values in this trial group.

Here is one way to determine the standard deviation of a set of numbers

Find the following values:

count - How many numbers are in the set sum - The sum of the numbers in the set sumOfSquares - The sum of the squares (n * n) of each number (n) in the set

With these values, you can compute the standard deviation like this:

First compute the average (sum / count) Next compute the squareOfAverage (average * average) Then compute the averageOfSquares (sumOfSquares / count) Finally compute the standard deviation: sqrt(averageOfSquares - squareOfAverage)

You may add any attributes (variables) or operations (methods) that you wish to the TrialGroup class. However, you may not delete or change the details of any of the attributes and operations in the given class diagram above.

Test Data

For your testing convenience, Pepper has have provided 3 sets of test files of dummy data, and example output files based on the test files. Download these text files from the link below. Your program should use good programming practice and structure, including the definition and use of at least one class.

data1.dat:

57 96 84 72 64 60 83 33 52 89

data2.dat:

54 47 74 83 35 65 35 57 26 62 12 14 58 40 43

data3.dat:

30 37 52 62 23 70 43 89 77 57 35 44

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions