Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code the following in R Studio 4.1 Write a function which takes variables x and y as input and uses a loop to calculate the

Code the following in R Studio

image text in transcribed
4.1 Write a function which takes variables x and y as input and uses a loop to calculate the sample correlation coefficient r, where n (xi - x) (Vi - y ) r= n . SxSy i=1 You may use built-in functions for the means and the standard deviations. (code:5) 4.2 The p-value for the correlation test is calculated as follows: The formula for the test statistic is rvn - t = V1 -r2 The p-value = 2 x P(t > [t|) where the t-distribution has n - 2 degrees of freedom. Write a function that takes the correlation coefficient r and the sample size n as input and calculates the t-value and the p-value. (code:3) 4.3 Write a function that takes a p-value as input and determines the conclusion of the hypothesis test, i.e., if the population correlation coefficient differs significantly from 0 at the 5% significance level, The conclusion should state "Reject HO" if p

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

Finite Math And Applied Calculus

Authors: Stefan Waner, Steven Costenoble

2nd Edition

0534366309, 9780534366308

More Books

Students also viewed these Mathematics questions