Is the sigma from a lm, i.e. fit1 <- lm(y~x) summary(fit1) summary(fit1)$sigma the RMSE (root mean square error) Thanks, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}}
Please forgive my re-sending this question. I did not see any replies from my prior post. My apologies if I missed something. Is the sigma from a lm, i.e. fit1 <- lm(y~x) summary(fit1) summary(fit1)$sigma the RMSE (root mean square error) Thanks, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}}
Roy Mendelssohn
2012-Apr-05 00:15 UTC
[R] meaning of sigma from LM, is it the same as RMSE
?summary.lm -Roy On Apr 4, 2012, at 4:47 PM, John Sorkin wrote:> Please forgive my re-sending this question. I did not see any replies from my prior post. My apologies if I missed something. > > Is the sigma from a lm, i.e. > > fit1 <- lm(y~x) > summary(fit1) > summary(fit1)$sigma > > the RMSE (root mean square error) > > Thanks, > John > > John David Sorkin M.D., Ph.D. > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for th...{{dropped:6}} > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.********************** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ********************** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center 1352 Lighthouse Avenue Pacific Grove, CA 93950-2097 e-mail: Roy.Mendelssohn at noaa.gov (Note new e-mail address) voice: (831)-648-9029 fax: (831)-648-8440 www: http://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
On Apr 05, 2012; 1:47am John Sorkin wrote:> Is the sigma from a lm...the RMSE (root mean square error)John, RMSE is usually calculated using the number of observations/cases, whereas summary.lm()$sigma is calculated using the residual degrees of freedom. See below: ## Helps to study the output of anova() set.seed(231) x <- rnorm(20, 2, .5) y <- rnorm(20, 2, .7) T.lm <- lm(y ~ x)> summary(T.lm)$sigma[1] 0.7403162> anova(T.lm)Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) x 1 0.0036 0.00360 0.0066 0.9363 Residuals 18 9.8652 0.54807> sum(resid(T.lm)^2)[1] 9.865225> sqrt(sum(resid(T.lm)^2)/18)[1] 0.7403162> sqrt(sum(resid(T.lm)^2)/20) ## RMSE (y = 20)[1] 0.7023256 ## OR> sqrt(mean((y-fitted(T.lm))^2))[1] 0.7023256 Regards, Mark. ----- Mark Difford (Ph.D.) Research Associate Botany Department Nelson Mandela Metropolitan University Port Elizabeth, South Africa -- View this message in context: http://r.789695.n4.nabble.com/meaning-of-sigma-from-LM-is-it-the-same-as-RMSE-tp4533515p4534165.html Sent from the R help mailing list archive at Nabble.com.
If you look at the code for summary.lm the line for the value of sigma is: ans$sigma <- sqrt(resvar) and above that we can see that resvar is defined as: resvar <- rss/rdf If that is not sufficient you can find how rss and rdf are computed in the code as well. On Tue, Apr 3, 2012 at 8:56 AM, John Sorkin <jsorkin at grecc.umaryland.edu> wrote:> Is the sigma from a lm, i.e. > > fit1 <- lm(y~x) > summary(fit1) > summary(fit1)$sigma > > the RMSE (root mean square error) > > Thanks, > John > > John David Sorkin M.D., Ph.D. > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:14}}
Again my thanks! John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing)>>> Greg Snow <538280 at gmail.com> 4/5/2012 4:42 PM >>>If you look at the code for summary.lm the line for the value of sigma is: ans$sigma <- sqrt(resvar) and above that we can see that resvar is defined as: resvar <- rss/rdf If that is not sufficient you can find how rss and rdf are computed in the code as well. On Tue, Apr 3, 2012 at 8:56 AM, John Sorkin <jsorkin at grecc.umaryland.edu> wrote:> Is the sigma from a lm, i.e. > > fit1 <- lm(y~x) > summary(fit1) > summary(fit1)$sigma > > the RMSE (root mean square error) > > Thanks, > John > > John David Sorkin M.D., Ph.D. > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:23}}