Question

In: Statistics and Probability

Plot the data and line of best fit in R and paste it into this document

C

D

3

2

6

7

8

5

9

4

1

0

3

4

Plot the data and line of best fit in R and paste it into this document

Code:

Plot:

Solutions

Expert Solution

Since we are not given which vaiable is dependent and which is independent, we will consider both the cases to solve this example. You can take any one of the as per the requirement.

Code :


C = c(3,6,8,9,1,3)
D = c(2,7,5,4,0,4)

### Part 1
# Let C be the dependent variable and D be the independent variable.

>reg1 = lm( C ~ D )
>coef1 = reg1$coefficients
>coef1
(Intercept) D
1.7500000 0.8863636
>coef1 = unname(coef1) # returns only values
>plot(x = D, y = C, main = 'C vs D')
>abline(a = coef1[1], b = coef1[2]) # gives regression line, a is intercept and b is slope


### Part 2
# Let D be the dependent variable and C be the independent variable.

>reg2 = lm( D ~ C )
>coef2 = reg2$coefficients
>coef2
(Intercept) C
1.066667 0.520000
>coef2 = unname(coef2) # returns only values
>plot(x = C, y = D, main = 'D vs C')
>abline(a = coef2[1], b = coef2[2]) # gives regression line, a is intercept and b is slope


Related Solutions

collect data exhibiting a relatively linear trend, find the line of best fit, plot the data...
collect data exhibiting a relatively linear trend, find the line of best fit, plot the data and the line, interpret the slope, and use the linear equation to make a prediction. Also find r2 (coefficient of determination) and r (correlation coefficient). Discuss your findings. Your topic may be that is related to sports, your work, a hobby, or something you find interesting.
Find the line of best fit. r = What is the SSE for this problem?
Movies 3 6 0 9 14 5 7 12 2 1 7 0 5 11 4 Books 7 0 18 0 1 4 5 0 6 2 10 9 2 2 0 Find the line of best fit. r = What is the SSE for this problem?
5. a. In a Lineweaver-Burk plot, the y-intercept of the line of best fit is equal...
5. a. In a Lineweaver-Burk plot, the y-intercept of the line of best fit is equal to _____ and the x-intercept of the line of best fit is equal to _____: 1) 1/Vmax ; –1/Km                                                                                             4) –1/Km ; Vmax 2) 1/Km ; 1/Vmax                                                                                              5) Vmax ; Km      3) 1/Vmax ; –Km b. All of the following statements are true about the relationships between [S], Km, Vo, and Vmax EXCEPT: 1) As [S] increases, Vo gets closer to Vmax 2) Vmax occurs when...
A plot of detector signal versus ppm Ca2+ yielded a best fit straight line with a...
A plot of detector signal versus ppm Ca2+ yielded a best fit straight line with a slope of 1.38 volts/ppm. Multiple blank measurements resulted in a standard deviation of 0.18 volts. Using a 2:1 signal-to-noise ratio criteria, calculate the detection limit for Ca2+ in ppm when this method is employed. Thanks!
A plot of detector signal versus ppm Ca2+ yielded a best fit straight line with a...
A plot of detector signal versus ppm Ca2+ yielded a best fit straight line with a slope of 0.13 volts/ppm. Multiple blank measurements resulted in a standard deviation of 0.18 volts. Using a 2:1 signal-to-noise ratio criteria, calculate the detection limit for Ca2+ in ppm when this method is employed.
*Please provide r studio code/file* 1) Find the equation of the best fit line using least...
*Please provide r studio code/file* 1) Find the equation of the best fit line using least squares linear fit of x,y: set.seed(88) x <- 1:100 y <- jitter(1.5*x+8,amount=10) 2) For question 1, Draw the P=0.95 prediction intervals for y when x=1:150 3) For question 1, Find the equation of the best fit line using median-based linear fit of x,y. 4) For question 3, draw the P=0.95 prediction interval for y # when x=1:150
Find the line y = b + mx of best fit through the data {(.1, .2),(.2,...
Find the line y = b + mx of best fit through the data {(.1, .2),(.2, .3),(.3, .7),(.5, .2),(.75, .8)}, using the least squares criterion. (Use one of the software tools: Excel, SPSS, Mathematica, or MATLAB to answer the following items, and print out your results directly from the software)
If the line of best fit for your torque speed curve is described by the following...
If the line of best fit for your torque speed curve is described by the following equation, calculate the no-load speed of the motor. T= -0.021x+0.32
Find a study that uses linear regression and a line of best fit. What is the...
Find a study that uses linear regression and a line of best fit. What is the Correlation Coefficient? What conclusions can you make about the data? Is there a correlation and how strong is it?
(Be sure to paste the R Console Output and code!!!) Using the following data and R,...
(Be sure to paste the R Console Output and code!!!) Using the following data and R, write a brief paragraph about whether the in-home treatment is equally effective as the out-of-home treatment for two separate groups. Here are the data. The outcome variable is level of anxiety after treatment on a scale from 1 to 10. In-Home Treatment Out-of-Home Treatment 3 7 4 6 1 7 1 8 1 7 3 6 3 5 6 6 5 4 1 2...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT