Language:EN
Pages: 8
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
enter data into columns and provide headersscore e

Enter data into columns and provide headersscore epitools app

BIOSTATS 640 - Spring 2023 Unit 4. Categorical Data Analysis (2 of 2) R and Online Apps

Unit 4 – Categorical Data Analysis
Practice Problems (2 of 2)

This exercise gives you practice performing a2 x K test of trend for contingency table data.

The Western Collaborative Group Study (WCGS) was a prospective study of 3,154 men, all initially disease-free, who were followed for events of coronary heart disease (CHD). At the eight years follow-up mark, there were 257 events of CHD. Several potential predictors of CHD were of interest, including: age (at enrollment), cholesterol, systolic blood pressure, hematocrit, ECG status, smoking, and relative weight.

35-40 41-45 Age at Enrollment (years) 55-60 Total =
46-50 51-55
no 512 1036 680 463 206 2987
yes 31 55 70 65 36 257
Total = 543 1091 750 528 242 3154

sol_categorical 2 of 2.docx Page 1 of 8

BIOSTATS 640 - Spring 2023 Unit 4. Categorical Data Analysis (2 of 2) R and Online Apps

chd not chd
1 31 512
2 55 1036
3 70 680
4 65 463
5 36 206

In EpiTools App, paste data into data box. Click SUBMIT

BIOSTATS 640 - Spring 2023 Unit 4. Categorical Data Analysis (2 of 2) R and Online Apps

Question #1B
HO: No association of interval of age with event of CHD
HA: Monotone increasing trend in event of CHD with increasing interval of age, one-sided

cat("\nQuestion 1\nWCGS Data\n\n")

##

## CHD 35-40 41-45 46-50 51-55 55-60
## No 512 1036 680 463 206
## Yes 31 55 70 65 36

Inspect Data
library(gmodels) # Attach package {gmodels}

BIOSTATS 640 - Spring 2023 Unit 4. Categorical Data Analysis (2 of 2) R and Online Apps

Q1a) Test of General Association

## Null: No Association CHD w Interval Age

chisq.test(tableq1)

## X-squared = 46.653, df = 4, p-value = 0.000000001801

HO: No association of interval of age with event of CHD

unlikely result. Conclude these data provide statistically significant evidence of an association.

Q1b) Test of Trend

## Chi Square Test of Trend

## Null: No Monotone Association CHD w Interval Age

## data: tableq1

## Z = -6.3852, dim = 5, p-value = 0.00000000008561 Z-score=-6.3852 -> Chi Square = [-6.3852]2

p-value <<< .0001

Reject the null hypothesis. Assumption of the null hypothesis and application to the data has led to an extremely

#2. Source: Triola MM and Triola MF. Biostatistics for the Biological and Health Sciences Boston: Pearson Addison Wesley, John Wiley, 2006. Chapter 10, Section 10-2. page 491.

This exercise gives you practice performing a chi square goodness of fit (GOF) test.

0 1 2
7 8 9
3 4 5 6
Frequency 35 0 2 1 4 24 1 4 7 2

2b. How many degrees of freedom does your chi square statistic have? Degrees of freedom = (# intervals) - 1
= 9

2c. What is the value of your chi square statistic?
156.5

BIOSTATS 640 - Spring 2023 Unit 4. Categorical Data Analysis (2 of 2) R and Online Apps

Online Apps Solution

sol_categorical 2 of 2.docx Page 6 of 8

q2_df
## digit observed_n expected_percent
## 1 0 35 0.1
## 2 1 0 0.1
## 3 2 2 0.1
## 4 3 1 0.1
## 5 4 4 0.1
## 6 5 24 0.1
## 7 6 1 0.1
## 8 7 4 0.1
## 9 8 7 0.1
## 10 9 2 0.1

Q2 – Chi Square GOF Test, minimal

## Chi Square GOF Test

## Null: Equal Frequencies (10%) of Each Last Digit

digit <- c(0,1,2,3,4,5,6,7,8,9) # Last digit
obs <- c(35,0,2,1,4,24,1,4,7,2) # observed counts
q2_full <- data.frame(digit,obs) # combine to make data frame n_size <- sum(obs) # total sample size

q2_full$exp <-rep(n_size/10,times=10) # null hypothesis expected counts

BIOSTATS 640 - Spring 2023 Unit 4. Categorical Data Analysis (2 of 2) R and Online Apps

# Output Stuff

cat("\np-value =", pvalue)
## p-value = 0

sol_categorical 2 of 2.docx Page 8 of 8

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Kimberly Washington

PageId: ELI39BFDF2