Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 a) Write an R function which takes two vectors of data and performs the pooled two- sample Student's t test of of equality of

image text in transcribed

2 a) Write an R function which takes two vectors of data and performs the pooled two- sample Student's t test of of equality of means returning the test statistic and p-value as well as a statement of the conclusion at a specified level of significance defaulting to 0.05. Use your function to test for equality of the means of the following two samples r 6.35 3.47 6.54 6.21 8.72 10.43 y| 8.99 10.94 9.88 11.50 9.90 11.89 12.10 9.33 b) Forward selection is a model-selection process in linear regression in which we wish to model the response variable Y as a linear function of a subset of potential covariates 1,.. ., Xp. The method first checks all single covariate models and selects the one for which the covariate has the smallest p-value provided it is less than some pre-specified level. It then tries to add selecting the model with the most significant added variable. The process continues trying to add one covariate at a time and terminates when a model is found such that none of the remaining covariates have a sufficiently small p-value when added to the model Using a loop and the lm function, construct your own function that takes a response variable and a data.frame of potential covariates and applies forward selection. Your function should return some information ab as the final model Apply your function to the nuclear dataset which you can get as part of the boot package. a second variable to the selected one variable model, again out the order of adding the variables as well 2 a) Write an R function which takes two vectors of data and performs the pooled two- sample Student's t test of of equality of means returning the test statistic and p-value as well as a statement of the conclusion at a specified level of significance defaulting to 0.05. Use your function to test for equality of the means of the following two samples r 6.35 3.47 6.54 6.21 8.72 10.43 y| 8.99 10.94 9.88 11.50 9.90 11.89 12.10 9.33 b) Forward selection is a model-selection process in linear regression in which we wish to model the response variable Y as a linear function of a subset of potential covariates 1,.. ., Xp. The method first checks all single covariate models and selects the one for which the covariate has the smallest p-value provided it is less than some pre-specified level. It then tries to add selecting the model with the most significant added variable. The process continues trying to add one covariate at a time and terminates when a model is found such that none of the remaining covariates have a sufficiently small p-value when added to the model Using a loop and the lm function, construct your own function that takes a response variable and a data.frame of potential covariates and applies forward selection. Your function should return some information ab as the final model Apply your function to the nuclear dataset which you can get as part of the boot package. a second variable to the selected one variable model, again out the order of adding the variables as well

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

how would you have done things differently?

Answered: 1 week ago