Testing for…

October 31, 2011
By

[This article was first published on CloudStat, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


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 their blog: CloudStat.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)