Generate Data

x <- rnorm(100)
y <- rexp(100,5)
plot(y~x)

plot of chunk unnamed-chunk-1

Create Model

m <- lm(y~x)
summary(m)
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.2202 -0.1673 -0.0840  0.0801  1.0255 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.21245    0.02399    8.86  3.7e-14 ***
## x           -0.00554    0.02294   -0.24     0.81    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.237 on 98 degrees of freedom
## Multiple R-squared:  0.000594,   Adjusted R-squared:  -0.0096 
## F-statistic: 0.0583 on 1 and 98 DF,  p-value: 0.81

Confidence intervals for coefficients

confint(m)
##                2.5 %  97.5 %
## (Intercept)  0.16484 0.26005
## x           -0.05107 0.03999

ANOVA

anova(m)
## Analysis of Variance Table
## 
## Response: y
##           Df Sum Sq Mean Sq F value Pr(>F)
## x          1    0.0  0.0033    0.06   0.81
## Residuals 98    5.5  0.0561

Run the plot sequence

plot(m)

plot of chunk unnamed-chunk-5plot of chunk unnamed-chunk-5plot of chunk unnamed-chunk-5plot of chunk unnamed-chunk-5