Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Polynomial Regression

Language: Layout:
+ ] Show input
Absolute running time: 0.69 sec, cpu time: 0.86 sec, memory peak: 35 Mb, absolute service time: 0,71 sec  
edit mode |  history  | discussion
Classes ‘nfnGroupedData’, ‘nfGroupedData’, ‘groupedData’ and 'data.frame':	578 obs. of  4 variables:
 $ weight: num  42 51 59 64 76 93 106 125 149 171 ...
 $ Time  : num  0 2 4 6 8 10 12 14 16 18 ...
 $ Chick : Ord.factor w/ 50 levels "18"<"16"<"15"<..: 15 15 15 15 15 15 15 15 15 15 ...
 $ Diet  : Factor w/ 4 levels "1","2","3","4": 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "formula")=Class 'formula'  language weight ~ Time | Chick
  .. ..- attr(*, ".Environment")=<environment: R_EmptyEnv> 
 - attr(*, "outer")=Class 'formula'  language ~Diet
  .. ..- attr(*, ".Environment")=<environment: R_EmptyEnv> 
 - attr(*, "labels")=List of 2
  ..$ x: chr "Time"
  ..$ y: chr "Body weight"
 - attr(*, "units")=List of 2
  ..$ x: chr "(days)"
  ..$ y: chr "(gm)"
  weight Time Chick Diet
1     42    0     1    1
2     51    2     1    1
3     59    4     1    1
4     64    6     1    1
5     76    8     1    1
6     93   10     1    1

Call:
lm(formula = weight ~ Time)

Residuals:
    Min      1Q  Median      3Q     Max 
-78.609 -15.677  -0.324  11.069 130.391 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  30.9310     4.0948   7.554 1.15e-12 ***
Time          6.8418     0.3286  20.822  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 32.85 on 218 degrees of freedom
Multiple R-squared:  0.6654,	Adjusted R-squared:  0.6639 
F-statistic: 433.5 on 1 and 218 DF,  p-value: < 2.2e-16


Call:
lm(formula = weight ~ Time + I(Time^2))

Residuals:
    Min      1Q  Median      3Q     Max 
-85.702 -12.891   1.099   9.922 123.298 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 38.36142    5.50191   6.972  3.7e-11 ***
Time         4.47324    1.22553   3.650 0.000329 ***
I(Time^2)    0.11202    0.05587   2.005 0.046198 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 32.62 on 217 degrees of freedom
Multiple R-squared:  0.6715,	Adjusted R-squared:  0.6685 
F-statistic: 221.8 on 2 and 217 DF,  p-value: < 2.2e-16


Call:
lm(formula = weight ~ Time + I(Time^2) + I(Time^3))

Residuals:
    Min      1Q  Median      3Q     Max 
-82.186 -12.340   0.015   9.432 126.814 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 41.98477    6.43884   6.521 4.88e-10 ***
Time         1.69828    2.84194   0.598    0.551    
I(Time^2)    0.46066    0.32698   1.409    0.160    
I(Time^3)   -0.01108    0.01024  -1.082    0.280    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 32.61 on 216 degrees of freedom
Multiple R-squared:  0.6733,	Adjusted R-squared:  0.6687 
F-statistic: 148.4 on 3 and 216 DF,  p-value: < 2.2e-16

Analysis of Variance Table

Model 1: weight ~ Time
Model 2: weight ~ Time + I(Time^2)
Model 3: weight ~ Time + I(Time^2) + I(Time^3)
  Res.Df    RSS Df Sum of Sq      F  Pr(>F)  
1    218 235212                              
2    217 230933  1    4278.4 4.0235 0.04612 *
3    216 229688  1    1245.2 1.1710 0.28040  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1