Running a set of codes given in R for regression analysis

profilespringbird
2021logisticregressioninRproblem.docx

Problem I Practice in R: how to run a simple Cox regression model in R

I need help in running the codes given by my prof to get the output for practice using R.

When I ran the codes as shown below, I got errors. I am supposed to get the output as shown in the following page. Error message says g was not found. Details of instruction for this practice and the required output posted by my prof are shown as follows:

The sample ouput for running the above model with the codes in R is shown as follows:

Running the above codes in R, I am supposed to get the following output.

Problem II Practice in R for multiple logistic regression.

Again , we are supposed to use the code as provided and the sample output is enclosed. I have the same problem as before. I got similar error messages. Please fix my problem so that when I run the code I can produce the same answer as the sample output enclosed here.

Running the above codes in R , I am supposed to get the following output:

Errors messages shown on my computer when I ran the codes for problem I and II:

Please explain what did I do wrong in running this set of code & provide step by step instruction on how to run it.

Please provide me with a revised set of codes for problem I and problem II separately, if necessary, so that when I copy and paste on my desktop computer, I can reproduce the sample output.

Thanks.