Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

Polynomial Regression with Interaction

Language: Layout:
+ ] Show input
Absolute running time: 1.91 sec, cpu time: 2.12 sec, memory peak: 59 Mb, absolute service time: 1,93 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 + I(Time^2) * Diet)

Residuals:
     Min       1Q   Median       3Q      Max 
-143.679  -10.038   -0.696    8.508  125.452 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
(Intercept)     34.49227    4.35509   7.920 1.25e-14 ***
Time             5.53099    0.78421   7.053 5.10e-12 ***
I(Time^2)        0.06554    0.03770   1.739   0.0826 .  
Diet2            4.23604    5.59678   0.757   0.4494    
Diet3            2.55418    5.59678   0.456   0.6483    
Diet4           10.88120    5.60776   1.940   0.0528 .  
I(Time^2):Diet2  0.07686    0.02541   3.025   0.0026 ** 
I(Time^2):Diet3  0.21022    0.02541   8.274 9.23e-16 ***
I(Time^2):Diet4  0.12361    0.02582   4.788 2.15e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 33.51 on 569 degrees of freedom
Multiple R-squared:  0.7807,	Adjusted R-squared:  0.7777 
F-statistic: 253.3 on 8 and 569 DF,  p-value: < 2.2e-16