Question

Pft data set has the results of a study on the effect of lead pollution levels on pulmonary function tests.
Column "pft" is 1 for normal pulmonary function test results and 0 for abnormal.
Column "lead" is 1 for low lead pollution levels and 0 for high lead levels
Column "smoke" is an ordinal from 0 to 3 quantifying how many cigarettes the patient smokes daily.
What is the odds ratio that high lead exposure leads to abnormal pulmonary function test results?
Use cross-validation to estimate the accuracy and AUC of your predictive model.
Show your R code.

pft lead smoke
1 0 3
1 0 3
0 0 3
1 0 1
1 0 3
1 0 3
1 0 0
1 0 3
1 0 1
1 0 0
1 0 0
1 0 3
1 0 1
1 0 1
1 0 3
1 0 3
1 0 0
1 0 3
1 0 3
0 0 2
1 0 1
1 0 1
0 0 0
1 0 3
1 0 3
1 0 1
1 0 1
1 0 0
1 0 0
1 0 1
1 0 3
0 0 2
0 0 0
0 0 3
1 0 2
1 0 3
1 0 2
1 0 0
1 0 3
1 0 3
1 0 3
1 0 1
1 0 0
0 0 0
1 0 1
1 0 2
1 0 3
1 0 3
1 0 3
1 0 0
1 0 3
1 0 3
1 0 3
1 0 0
1 0 1
1 0 3
1 0 3
1 0 1
1 0 2
1 0 2
1 0 2
1 0 2
1 0 2
1 0 1
0 0 1
1 0 0
1 0 2
1 0 1
1 0 0
1 0 3
1 0 1
1 0 0
1 0 0
1 0 1
0 0 1
1 0 3
1 0 3
1 0 1
0 0 3
1 0 2
1 0 0
1 0 1
1 0 3
1 0 0
1 0 1
1 0 1
1 0 3
1 0 2
1 0 3
1 0 3
1 0 2
1 0 3
1 1 0
1 1 0
1 1 3
1 1 2
1 1 0
1 1 2
1 1 1
1 1 3
1 1 3
1 1 3
1 1 0
1 1 2
1 1 3
1 1 0
1 1 1
1 1 0
1 1 1
1 1 0
1 1 2
1 1 2
1 1 0
0 1 1
1 1 2
1 1 1
1 1 3
1 1 3
1 1 3
1 1 3
1 1 3
1 1 3
1 1 1
1 1 3
1 1 3
1 1 3
1 1 0
1 1 0
1 1 0
1 1 1
1 1 3
1 1 1
1 1 3
1 1 1
1 1 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0 1 1
1 1 3
1 1 2

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

install.packages("vcd")
library(vcd)
OR <- oddsratio(ctbl, log=FALSE)
OR
# odds ratios for yfac and yhat.fac
#
# [1] 2.32545
(ctbl[1, 1] / ctbl[1, 2]) / (ctbl[2, 1] / ctbl[2, 2])
#
library(ROCR)
pred <- prediction(yhat.fac, yfac=="normal")
perf <- performance(pred, 'tpr','fpr')
plot(perf)
perf <- performance(pred, "auc")
unlist(perf@y.values)
# [1] 0.6149042
perf <- performance(pred, "odds")
max(unlist(perf@y.values), na.rm=TRUE)
# [1] 3.448276...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Data Analysis Using R-Programming
Homework Solution
$65.00
Statistics
R Programming
Mathematics
Computer Science
Data Analysis
Results
Layman's Terms
Figures
Codes
Assumptions
Statistics Questions
Homework Solution
$18.00
Statistics
Data Sets
Mathematics
Linear Regression
ANOVA
Test for Normality
Functions
R Programming
Normal Distribution
Variables
Codes
P-Values
Estimation
Coefficients
Statistics - R Programming Problems
Homework Solution
$63.00
Statistics
Mathematics
R-Programming
Computer Science
Codes
Data Sets
Classification Tree
ROC Curve
Logistic Regression
Matrix
Expression Values
Sensitivity
Support Vector Machine
Functions
Data Analysis and Manipulation
Homework Solution
$35.00
Statistics
Data Analysis
Data Sets
Linear Regression
ANOVA
Normality Test
Null Hypothesis
Alternative Hypothesis
Research
Functions
Tables
Statistics Questions
Homework Solution
$68.00
Statistics
Mathematics
Hypothetical Experiments
Factors
Tables
Model
Regression
Slope
NAP Range
Variance
Species
Richness
Predictors
Coefficient
Determination
Probability Distribution
ANOVA
Functions
Get help from a qualified tutor
Live Chats