Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with R programming questions. a) Using generate factor levels, produce the R command of the following outputs: 4 > data. 1 Length Supplement

Please help with R programming questions.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

a) Using generate factor levels, produce the R command of the following outputs: 4 > data. 1 Length Supplement Dose 1 Short Orange Juice 0.5mg/day 2 Short Orange Juice 0.5mg/day 3 Short Orange Juice 0.5mg/day Short Orange Juice img/day 5 Medium Orange Juice 1mg/day Medium Orange Juice img/day 7 Medium Vit C 1. 5mg/day Medium Vit C 1.5mg/day 9 Long Vit C 1.5mg/day 10 Long Vit C 2mg/day 11 Long Vit C 2mg/day 12 Long Vit C 2mg/day 8 b) Referring data. 1 in part (a), write the R command to produce the following output. > data.2 Dose 0.5mg/day Img/day 1. 5mg/day 2mg/day Supplement Length Orange Juice Short 3 1 0 0 Medium 0 2 0 0 Long O 0 0 Vit C Short 0 0 Medium 0 2 Long 1 O O O O NA a) Let Xz --Gamma(3,9) and X --Gamma(3.5, 12) be independent. Write the R command to produce the following dataset which is generated by convolutions W = X1 + X, using set seed 100 > W [11] [1,2] [13] [,4] [5] [1,] 0.495 0.440 0.550 0.792 0.396 [2,] 0.347 0.837 0.418 0.505 0.892 [3,] 0.456 0.723 0.744 0.314 0.885 [4,] 0.619 0.355 0.728 0.418 0.541 [5,) 0.573 0.507 0.497 0.573 0.390 [6,] 0.901 0.423 0.337 0.509 1.113 b) Produce the following output based on the data obtained in part (a). > xx1 [11] 1,2] [3] [1,] 0.440 0.792 0.396 [2,] 0.723 0.314 0.885 [3,] 0.507 0.573 0.390 [4,] 0.423 0.509 NA By using the above data (xx1), write a suitable R commands to replace NA with 0.888. a) Using generate factor levels, produce the R command of the following outputs: 4 > data. 1 Length Supplement Dose 1 Short Orange Juice 0.5mg/day 2 Short Orange Juice 0.5mg/day 3 Short Orange Juice 0.5mg/day Short Orange Juice img/day 5 Medium Orange Juice 1mg/day Medium Orange Juice img/day 7 Medium Vit C 1. 5mg/day Medium Vit C 1.5mg/day 9 Long Vit C 1.5mg/day 10 Long Vit C 2mg/day 11 Long Vit C 2mg/day 12 Long Vit C 2mg/day 8 b) Referring data. 1 in part (a), write the R command to produce the following output. > data.2 Dose 0.5mg/day Img/day 1. 5mg/day 2mg/day Supplement Length Orange Juice Short 3 1 0 0 Medium 0 2 0 0 Long O 0 0 Vit C Short 0 0 Medium 0 2 Long 1 O O O O NA a) Let Xz --Gamma(3,9) and X --Gamma(3.5, 12) be independent. Write the R command to produce the following dataset which is generated by convolutions W = X1 + X, using set seed 100 > W [11] [1,2] [13] [,4] [5] [1,] 0.495 0.440 0.550 0.792 0.396 [2,] 0.347 0.837 0.418 0.505 0.892 [3,] 0.456 0.723 0.744 0.314 0.885 [4,] 0.619 0.355 0.728 0.418 0.541 [5,) 0.573 0.507 0.497 0.573 0.390 [6,] 0.901 0.423 0.337 0.509 1.113 b) Produce the following output based on the data obtained in part (a). > xx1 [11] 1,2] [3] [1,] 0.440 0.792 0.396 [2,] 0.723 0.314 0.885 [3,] 0.507 0.573 0.390 [4,] 0.423 0.509 NA By using the above data (xx1), write a suitable R commands to replace NA with 0.888

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago