Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Perform the following operations in a single R script. You will upload the R script as well as screen shots of the output for each

image text in transcribed

Perform the following operations in a single R script. You will upload the R script as well as screen shots of the output for each question, pasted into a SINGLE .doc or .pdf file. Unless otherwise indicated, each question requires only ONE line of R code. 1. Vectors (a) Create a vector V with the values (3, 3^2/2, 3^3/3, ..., 3^25/25) (b) Calculate the sum sigma_i = 1^30 (4^i/i + 3^i/i^2), no more than two lines of R code are required. (c) Let X 300 (the actual values, not the indices). ii. What are the index positions in X that are > 300? iii. How many values in X are within 200 of the maximum value of X? iv. How many values in X are divisible by 3? (modulus operator is %%) v. Sort the numbers in X by increasing value. 2. Matrices Using the sample. int function, create M as a 6 times 10 matrix of random integers chosen from {1, 2, ..., 10}. (a) Compute MM^T (note T indicates the matrix transpose operation), be sure to use matrix multiplication. (b) Use the apply function to find the number of entries in each row that are greater than 5. (c) Use the which function to determine the rows that contain exactly 2 occurrences of the number 1. 3. Simple Functions (a) Write a function that takes two parameters x and n, where x is any real value and n > 0, and returns the value of 1 + x/1 + x^2/2 + ... + x^n (the function itself only requires one line of R code)

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

Students also viewed these Databases questions

Question

2. Why?

Answered: 1 week ago

Question

1. Where do these biases come from?

Answered: 1 week ago