Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the dataset HW 2 which has many columns including two that are named ' A ' and ' B ' consisting of numeric values
Consider the dataset HW which has many columns including two that are named
and consisting of numeric values that has been loaded into Rstudio.
Specify Rstudio code one line which could be used to accomplish the following:
a Multiply every entry of by the corresponding row entry in
b Print the relative standing see earlier lecture for formula of each
observation in B treating it as a population
c Create an new objectvector call it whatever you want that contains the
last values in B
d Create a new object called "ColVariances" which is a vector which contains
the sample variances of each column A and B
Hint: You know how to create objects. You know how to compute the
variances of each column. You know how to merge two numbers in this
case the columns means
e Create a for loop that outputs a vector containing the products of every
entry in column A with the preceding entry in column A starting from the
row
Hint: We did something similar when creating returns.
Hint: You can create a dataset using the following code to test out your answers:
MYDATAdata. frame
Note: You are being asked for the code in this problem, not the output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started