Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Python code to create a raw_data table that such that raw_data.pivot(outcome, treatment) produces the observed counts. Hints: np.full(714, Rogaine) produces an array of length

Write Python code to create a raw_data table that such that raw_data.pivot("outcome", "treatment") produces the observed counts. Hints: np.full(714, "Rogaine") produces an array of length 714 filled with the string "Rogaine" np.concatenate([array1, array2, array3]) glues any number of arrays together into a single array

image text in transcribed

Next you need to randomly permute the treatment labels, thereby destroying any association between treatment and outcome, and find out what values of the Chi-square distance you would obtain under the null hypotheses of "no association" (or equivalently "no treatment effect") To do that you first need to make up the raw_data table that gave rise to the observed_counts. The raw_data table will have 1,431 rows (one for each subject), and two columns, "treatment" and "outcome". The treatment column has entries "Rogaine" and "Placebo". The outcome column has entries "no_growth", "new_vellus", ... , "dense_growth" Question 3. Write Python code to create a raw_data table that such that raw_data.pivot("outcome", "treatment") produces the observed counts. Hints: np.full(714, "Rogaine") produces an array of length 714 filled with the string "Rogaine" np.concatenate([array1, array2, array3]) glues any number of arrays together into a single array raw_data.pivot("outcome", "treatment") Next you need to randomly permute the treatment labels, thereby destroying any association between treatment and outcome, and find out what values of the Chi-square distance you would obtain under the null hypotheses of "no association" (or equivalently "no treatment effect") To do that you first need to make up the raw_data table that gave rise to the observed_counts. The raw_data table will have 1,431 rows (one for each subject), and two columns, "treatment" and "outcome". The treatment column has entries "Rogaine" and "Placebo". The outcome column has entries "no_growth", "new_vellus", ... , "dense_growth" Question 3. Write Python code to create a raw_data table that such that raw_data.pivot("outcome", "treatment") produces the observed counts. Hints: np.full(714, "Rogaine") produces an array of length 714 filled with the string "Rogaine" np.concatenate([array1, array2, array3]) glues any number of arrays together into a single array raw_data.pivot("outcome", "treatment")

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

8-6 Who poses the biggest security threat: insiders or outsiders?

Answered: 1 week ago