Linear Regression

Description

The training stress score (TSS) is used to quantify cycling workout based on relative intensity and duration of the workout. Work (measured in kilojoules) is the actual work done during the cyclists workout. The following R commands calculates the regression line to predict the TSS from the amount of work done. In this case, our estimated simple regression equation is

(1)
\begin{align} \hat{y} = 0.0923 x -7.6823. \end{align}

To use R in a Sage cell, the language must be set to R. See https://github.com/sagemath/sagecell/blob/master/doc/embedding.rst for details.

Sage Cell

Code

work <- c(557, 1227, 337, 2073, 388, 1647, 348, 1241, 1583, 349, 1155)
tss <- c(40, 107, 25, 178, 29, 139, 21, 119, 144, 23, 97) 
fit <- lm(tss~work)
fit

Options

None

Tags

Primary Tags: Statistics: Simple linear regression

Secondary Tags: Simple linear regression: Regression

Related Cells

Attribute

Permalink:

Author: T. Judson

Date: 21 Jul 2017 09:23

Submitted by: Tom Judson

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License