gnrnd4( key1=624710806, key2=6120300706, key3=2500010 ) L1 L2 summary(L1) summary(L2) lm_L2L1 <- lm(L2~L1) lm_L2L1 cor(L1,L2) plot(L1,L2) abline(lm_L2L1)we generate the data, display the data and summaries of the data, compute and display the intercept and coefficient for the regression equation, compute and display the correlation coefficient, and display a plot of the points along with the regression line.
lm( )
function and finding the correlation coefficient
is just using the cor( )
function.