Question: Correlation in SQL So for this assignment I am asked to find: What is the correlation between interests one day apart? How should I go
Correlation in SQL
So for this assignment I am asked to find:
- What is the correlation between interests one day apart?
How should I go about doing this? have a table of 90 rows with an interest integer and date for each row. I have previously had to do this in R and found the answer, but am confused on how to construct this in SQL. I will attach a hint he gave us:

To calculate the correlation, it may be helpful to know the following o From the reference manual, follow the tabs on the left: Language structure/user-defined variables This should help you to know how to set constants SQL Statement Syntax/Data Definition Statements/Create Table Syntax/Create Table Select Syntax This will show you how to create a table from another table You may want to create a separate table for calculating the correlation Function and Operators It may be beneficial to learn about the lag function Correlation equation: Remember, we use the sample standard deviation, NOT the population standard deviation There is a function in mysql to calculate a sample standard deviation called stddev_samp) To calculate the correlation, it may be helpful to know the following o From the reference manual, follow the tabs on the left: Language structure/user-defined variables This should help you to know how to set constants SQL Statement Syntax/Data Definition Statements/Create Table Syntax/Create Table Select Syntax This will show you how to create a table from another table You may want to create a separate table for calculating the correlation Function and Operators It may be beneficial to learn about the lag function Correlation equation: Remember, we use the sample standard deviation, NOT the population standard deviation There is a function in mysql to calculate a sample standard deviation called stddev_samp)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
