Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 156 m³ 1,4 °C
- 2 199 m³ 0,3 °C
- 3 173 m³ 2,3 °C
- 4 69 m³ 9,6 °C
- 5 63 m³ 12,2 °C
- 6 9 m³ 16,9 °C
- 7 9 m³ 20,8 °C
- 8 9 m³ 18,5 °C
- 9 15 m³ 14,3 °C
- 10 19 m³ 11,4 °C
- 11 83 m³ 5,2 °C
- 12 62 m³ 4,2 °C
- cons <- structure(c(156, 199, 173, 69, 63, 9, 9, 9, 15, 19, 83, 62), .Tsp = c(1,
- 1.91666666666667, 12), class = "ts")
- temp <- structure(c(1.4, 0.3, 2.3, 9.6, 12.2, 16.9, 20.8, 18.5, 14.3,
- 11.4, 5.2, 4.2), .Tsp = c(1, 1.91666666666667, 12), class = "ts")
- fit <- lm(c(cons) ~ poly(c(temp), 2))
- summary(fit)
- #Residuals:
- # Min 1Q Median 3Q Max
- #-52.340 -7.920 -2.102 17.963 34.661
- #Coefficients:
- # Estimate Std. Error t value Pr(>|t|)
- #(Intercept) 72.167 7.451 9.686 4.66e-06 ***
- #poly(c(temp), 2)1 -201.911 25.810 -7.823 2.65e-05 ***
- #poly(c(temp), 2)2 69.987 25.810 2.712 0.0239 *
- #---
- #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
- #Residual standard error: 25.81 on 9 degrees of freedom
- #Multiple R-squared: 0.8839, Adjusted R-squared: 0.8582
- #F-statistic: 34.28 on 2 and 9 DF, p-value: 6.18e-05
- plot(c(temp), c(cons), pch = 16)
- lines(c(sort(temp)), predict(fit)[order(temp)], type = "b", col = "blue")
- p <- predict(fit, newdata = data.frame(temp = c(5, 15)), se.fit = TRUE)
- res <- cbind(p$fit - 1.96 * p$se, p$fit, p$fit + 1.96 * p$se)
- colnames(res) <- c("lower limit", "pred", "upper limit")
- res
- # lower limit pred upper limit
- #1 83.072304 102.5629 122.05356
- #2 -5.487951 14.9201 35.32816
Add Comment
Please, Sign In to add comment