Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use R to do this problem step by step. There is a direction. please show me R results and R code. Thank you. 3.

please use R to do this problem step by step. There is a direction. please show me R results and R code. Thank you. image text in transcribed
3. A simple simulation for Bernoulli random variables, and logistic regression part 1. Suppose we have a single covariate z. Generate n 1000 independent Bernoulli(TE) random variables (Y i 1,...,nt, according to the model logit Bo Biz, i 1,..., n (pi)- where H E(Y), with Ao 1, Bh 0.5, and design points ar regularly spaced on the interval (-10, 10) Hints for coding in R: (a) You can use command seq to generate regularly spaced design points. (b) You can do all steps using vectors you don't need any loops here. (c) After assigning values for n, Bo, and {ai i 1, 1000 calculate the corresponding true values for i 1,...,n (Hints: what is the relationship between pu and T for Bernoulli and what link is be- ing used in the model above? Hence write down the equation for each T, in terms of the corresponding ze and your parameter values. Use this equation to calculate the vector of success probabilities.) (d) Plot logit (vertical axis) versus ri horizontal axis) for these n- 1000 points (e) Plot T, (vertical axis) versus z (horizontal axis) for these n 1000 points. (f) Now use R command "rbinom", with the appropriate parameter vector and constants to simulate Y P Bernoulli(mi). What are the only possible values for Y? Save your results as a vector Y

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

7-2 What are the different types of networks?

Answered: 1 week ago