Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This week, we are going to do learn how to summarize categorical data using Rguroo. We will also learn how to upload a dataset from

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
This week, we are going to do learn how to summarize categorical data using Rguroo. We will also learn how to upload a dataset from a text file into Rguroo. For this problem set we will use the dataset called PCP.death from the Introductory Statistics textbook. Below is a description of the dataset PCP.death: Pneumocystis carinii pneumonia (PCP) is the most common opportunistic infection in HIV-infected patients and a life-threatening disease. Many North Americans with AIDS have one or two episodes of PCP during the course of their HIV infection. PCP is a consideration factor in mortality, morbidity, and expense; and recurrences are common. In the data set given in PCP.death, we have: Treatments, coded as A and B Patient characteristics: baseline CD4 count, gender (1, male; 0, female), race (1, white; 2, black; 3, other), weight (!b), homosexuality (1, yes; 0, no) PCP recurrence indicator (1, yes; 0, no), PDATE or time to recurrence (months) DIE or survival indicator (1, yes; 0, no), DDATE or time to death (or to date last seen for survivors; months) Download the dataset PCP.death.txt from Canvas and save it in your Desktop (for easy access), unless you have a designated folder for MATH-303 that you can readily put the data file into. Once downloaded and saved, go to the Data section, click Data Import -> Import Dataset to open up the File Import dialog box. Under File, choose the PCP.death.txt file you have downloaded. In the Characters box, change the symbol for Missing Data from NA to "." (DOT). Then click the Upload button. When the file has successfully uploaded, you will see the following: Summary of Data set 'PCP.death' Numerical Variables No. Variable No. read observed Min Q1 Q3 Mean Variance SE of Q2 Max missing deviation mean 233 310 155.5 89.634 8034.167 5.091 310 78 155.5 OBS 310 0 5.478 CD4 310 296 14 24 56 125 715 88.574 94.251 8883.167 0.942 0.234 0.055 0.013 SEX 310 310 309 2 1.359 0.601 0.361 0.034 RACE 310 12 12 127 144 161 276 138.715 43.873 1924.838 2.541 WT 310 298 0.498 0.248 0.028 HOMO 310 308 2 0 0.552 310 o 0.161 0.368 0.136 0.021 PCP 310 310 310 o o 9.2 14.35 19.4 30.2 14.365 6.855 16.995 0.389 PDATE 0.29 0.026 DIE 310 310 0.455 0.207 DDATE 310 310 o 9.6 15.55 19.8 30.2 15.106 6.611 43.7 0.375 Categorical Variables Variable Level 1 Level 2 TRT A: 154 B: 156 Notice that all the variables, except for Treatment were labeled as Numerical Variables, however, several of those variables are actually Categorical such as the variables Sex, Race, Homo, PCP, and Die. So, weneed to edit the variable types. To do so, right-click on the Dataset PCP.death on the left panel, and choose Variable Type Editor to open the dialog box to edit the variable types. Variable Type Editor ? Numerical Label / ID Factor / Categorical Ex. NA Ordinal? Level Label ? OBS TRT No items to show. No items to show. CD4 SEX RACE WT HOMO PCP PDATE DIE DDATE Update Reset Close One by one drag the variables that must be categorical into the Factor/Categorical box. Move also the variable OBS into the Label/ID box. Variable Type Editor Numerical Label / ID Factor / Categorical Ex. NA Ordinal 2 Level Label CD4 OBS TRT No items to show. WT SEX PDATE RACE DDATE HOMO PCP DIE Update Reset Close HOMO 10 :136 TE:170 TINA'S. Z Then click the Update button and then the Close button. Now you have your data all set to do some descriptive statistics on the categorical variables. Answer the following questions based on the PCP.death dataset. Question 1: Which variables in the list are dichotomous qualitative variables? List them all below. Question 2: What type of quantitative variable is PDATE?Let us make some contingency table based on the PCP.death data. Recall that a contingency table is a table showing the distribution of frequency of two qualitative variables, with the categories of one variable represented in the rows and the other in columns. To illustrate, let us make the contingency table between TRT and PCP. To create a contingency table, go to the Analytics section, click Analysis > Tabulation to open the Data Tabulation window. Select PCP.death for the Dataset. Then click the Add Table button on the bottom left corner of the Data Tabulation window. In the box under Table Name, give the contingency table we are creating, say Irtqur. Then, inside the Parameters box, choose TRT for Factor 1 and PCP for Factor 2. We will keep the Totals as the checked box for this table. .1 Data Tabulation o X PCP.death v Table Name Retain Parameters '7 TrtPcpCT - X Factor 1 : TRT v Factor 2 : PCP v 2Cond. Factor 3: v _ Cond. Frequency: Numerical. . v J Totals _ Proportions _ Percentages Order; 0 Default Asc. Deso. Add Table Reset Selected Tables Click the Preview Eye button to see the contingency table output. You should see the Tabulation Report output: Tabulation Report Joint Distribution of TRT and PCP: Counts Row Variable is PCP Column Variable is TRT A B Total 0 140 120 260 Total 154 156 31 {J Question 3: Now it is your turn to make a contingency table. Depending on your Peer Group Number, make the assigned contingency table below: Peer Group Number Make the Contingency Table between PCP and 1, 5 SEX 2, 6 RACE 3, 7 HOMO 4, 3 DIE Take a screenshot of the resulting contingency table in the Tabulation Report and paste it below. Now let us make a marginal table. Suppose we want to make a marginal table for the TRT variable. Using the same steps in making a contingency table, go to the Analytics section, click Analysis > Tabulation to open the Data Tabulation window. Select PCP.death for the Dataset. Then click the Add Table button on the bottom left corner of the Data Tabulation window. In the box under Table Name, give the contingency table we are creating, say IrtMT. Then, inside the Parameters box, choose TRT for Factor 1. Since this is a marginal table, let us display the Totals, Proportions, and Percentages. So put a check on all those boxes. .4 Data Tabulation 0 X PCP.death v Table Name Retain Parameters I? TrtMT l ' X Factor 1 : m V Factor 2 : v I ICond. Factor 3 : v | lCond. Frequency: Numelical... v IJ] Totals IJ: Proportions |Jj Percentages Order: .-..Defau|tl Asc Desc. Add Table Reset Selected Tables Click the Preview Eye button to see the marginal table output. You should see the Tabulation Report output: Total Total Total Question 4: Now it is your turn to make a marginal table. Create the Counts, Proportions, and Percentages marginal tables. Depending on your Peer Group Number, make the assigned marginal table TRT TRT TRT Tabulation Report Distribution of TRT: Counts Frequency Distribution of TRT: Proportions Relative Frequency Distribution of TRT: Percentages Percent 154 156 310 0.49677 0.50323 1 49.877 50.323 100 below: Peer Group Number Make the Marginal Table for 1,6 SEX 2 RACE 3 HOMO 4 DIE 5,7 PCP Take a screenshot of the resulting Tabulation report showing all your marginal tables and paste it below. Now, let us make some bar graphs. Under the Plots section, click Create Plot - Barplot to open the Barplot window. Select PCP.death for the Dataset. Suppose we want to make a side-by-side proportion barchart for PCP based on TRT. Under the Categorical tab, choose TRT for Factor 1 and PCP for Factor 2. Then choose Side by side and Proportions from the radio buttons on the right. Barplot OX * Dataset : PCP.death Categorical ? Numerical ? Categorical Numerical Factor 1 : TRT Side by side Stacked Factor 2 : PCP Counts Proportions Frequency : Num. Variable... Add Value Labels Label ? Barplot of PCP for Different TRT X-Axis : Title : Y-Axis :Then, click the Preview Eye button to see the hatpjot output below: Barplot of PCP for Different TRT 0.72 Relative Frequency PCP Notice that in the PCP categories label, instead of seeing 0 and 1, my graph above has No for 0 and Yes for 1. In order to change the category labels to those, go to Level Editor and edit the Labels for the Levels of PCP, as shown below, and re-click the Preview Eye to update the graph. Question 5: Now it is your turn to make a barpjpjt. Depending on your Peer Group Number, make the assigned contingency table below: Peer Group Number Make the Side-bySide Proportion Bar Chart between PCP and 1, 5 SEX 2, 6 RACE 3, 7 HOMO 4, 3 DIE Take a screenshot of the resulting bar plot and paste it below

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

Precalculus With Limits A Graphing Approach, Texas Edition

Authors: Ron Larson

6th Edition

1305443462, 9781305443464

More Books

Students also viewed these Mathematics questions

Question

=+3. How can this knowledge be fed into the policy process?

Answered: 1 week ago

Question

Go, do not wait until I come

Answered: 1 week ago