(This article was first published on CloudStat, and kindly contributed to R-bloggers)

Input

Output
Testing for regression
Input:
advertising=c(1,2,3,4,5) sales=c(1,1,2,2,4) sales.Reg=lm(sales~advertising) summary(sales.Reg)Output:
> advertising=c(1,2,3,4,5)
> sales=c(1,1,2,2,4)
>
> sales.Reg=lm(sales~advertising)
> summary(sales.Reg)
Call:
lm(formula = sales ~ advertising)
Residuals:
1 2 3 4 5
4.000e-01 -3.000e-01 -3.237e-17 -7.000e-01 6.000e-01
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1000 0.6351 -0.157 0.8849
advertising 0.7000 0.1915 3.656 0.0354 *
---
Signif. codes: 0 "***" 0.001 "**" 0.01 "*" 0.05 "." 0.1 " " 1
Residual standard error: 0.6055 on 3 degrees of freedom
Multiple R-squared: 0.8167, Adjusted R-squared: 0.7556
F-statistic: 13.36 on 1 and 3 DF, p-value: 0.03535
>
To leave a comment for the author, please follow the link and comment on his blog: CloudStat.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series,ecdf, trading) and more...

Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).