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
>

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** CloudStat**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...

**Tags:** cloudstat, R, regression