Please show work in formula method The US Dept of Energy captures data on the nu
ID: 3325929 • Letter: P
Question
Please show work in formula method
Explanation / Answer
The data is not shared in the question
---- Solution ----
a) Scatter plot
price = variable for price of gasoline
cons = variable for consumption of gasoline
plot(y = price, x = cons, type = "p")
If the plot has a positive or negative trend (the way Y moves with change in X, there is some linear relationship b/w the two variables
b) To calculate Pearson's correlation:-
r = cor(y = price, x = cons, method = "pearson")
If it is positive, Y increases with X (the magnitude is proportional to strength of linear relationship)
If it is negative, Y decreases with X (the magnitude is proportional to strength of linear relationship)
If it is near zero, Y has very small linear relationship with X
c) To calculate linear regression co-efficients,
fit = lm(price ~ cons)
summary(fit)
=> The output of summary function will give regression co-efficient for the variable "cons"
d) The column p-value in the same output will give the significance level.
If p-value << 0.01, the result is of HIGH significance.
---- Solution ----