Config Router

  • Google Sheets
  • CCNA Online training
    • CCNA
  • CISCO Lab Guides
    • CCNA Security Lab Manual With Solutions
    • CCNP Route Lab Manual with Solutions
    • CCNP Switch Lab Manual with Solutions
  • Juniper
  • Linux
  • DevOps Tutorials
  • Python Array
You are here: Home / How do I get RSS from a linear model output

How do I get RSS from a linear model output

August 23, 2021 by James Palmer

Here are some ways of computing the residual sum of squares (RSS) using the built-in anscombe data set:
fm <- lm(y1 ~ x1+x2+x3, anscombe) deviance(fm) ## [1] 13.76269 sum(resid(fm)^2) ## [1] 13.76269 anova(fm) # see the Residuals row of the Sum Sq column ## Analysis of Variance Table ## ## Response: y1 ## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 27.510 27.5100 17.99 0.00217 **
## Residuals 9 13.763 1.5292
## —
## Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

anova(fm)[“Residuals”, “Sum Sq”]
## [1] 13.76269

with(summary(fm), df[2] * sigma^2)
## [1] 13.76269

Regarding the last one, note that summary(fm)$df[2] and summary(fm)$sigma are shown in the summary(fm) output in case you want to calculate RSS using only a printout from summary. In particular, for the output shown in the question df[2] = 116 and sigma = 1.928 so RSS = df[2] * sigma^2 = 116 * 1.928^2 = 431.1933 .

As you are using glm, qpcR library can calculate the residual sum-of-squares of nls, lm, glm, drc or any other models from which residuals can be extacted. Here RSS(fit) function returns the RSS value of the model.
install.packages(‘qpcR’)
library(qpcR)
fm <- lm(y1 ~ x1+x2+x3) RSS(fm) check the link to see other functions of qpcR

Related

Filed Under: Uncategorized

Recent Posts

  • How do I give user access to Jenkins?
  • What is docker volume command?
  • What is the date format in Unix?
  • What is the difference between ARG and ENV Docker?
  • What is rsync command Linux?
  • How to Add Music to Snapchat 2021 Android? | How to Search, Add, Share Songs on Snapchat Story?
  • How to Enable Snapchat Notifications for Android & iPhone? | Steps to Turn on Snapchat Bitmoji Notification
  • Easy Methods to Fix Snapchat Camera Not Working Black Screen Issue | Reasons & Troubleshooting Tips to Solve Snapchat Camera Problems
  • Detailed Procedure for How to Update Snapchat on iOS 14 for Free
  • What is Snapchat Spotlight Feature? How to Make a Spotlight on Snapchat?
  • Snapchat Hack Tutorial 2021: Can I hack a Snapchat Account without them knowing?

Copyright © 2025 · News Pro Theme on Genesis Framework · WordPress · Log in