#install.packages("flux")
#install.packages("effects")
#install.packages("gplots")
library(flux)
## Warning: package 'flux' was built under R version 3.2.5
## Loading required package: caTools
## This is flux 0.3-0
library(effects)
## Warning: package 'effects' was built under R version 3.2.5
library(gplots)
## Warning: package 'gplots' was built under R version 3.2.5
## 
## Attaching package: 'gplots'
## Det følgende objekt er maskeret fra 'package:stats':
## 
##     lowess
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.5
Hood <- read.table(file="Hood.txt", header=TRUE, dec = ".")
head(Hood)
##   Time Day V_CO2 V_CO2_sd  V_O2 V_O2_sd   RER   EE DIT
## 1  -30   1 226.5     29.6 257.8    27.2 0.879 1792   0
## 2   30   1 237.6     35.5 282.5    39.9 0.841 1948 156
## 3   60   1 255.2     36.6 290.2    34.7 0.879 2022 230
## 4   90   1 231.5     32.1 289.2    35.4 0.801 1974 182
## 5  120   1 230.4     21.9 294.2    23.6 0.783 2000 208
## 6  150   1 232.7     26.6 284.1    26.9 0.819 1948 156
Hood$Day <- factor(Hood$Day)
Hood$Treat <- factor(Hood$Day, levels = 1:2, labels = c("Walnut", "Banana"))

Hood$EE0[1:6] <- with(subset(Hood, Hood$Day == 1), Hood$EE[1])
Hood$EE0[7:12] <- with(subset(Hood, Hood$Day == 2), Hood$EE[7])
Hood$EE-Hood$EE0
##  [1]   0 156 230 182 208 156   0 764 925 959 964 682
Hood$DIT0[1:6] <- with(subset(Hood, Hood$Day == 1), Hood$DIT[1])
Hood$DIT0[7:12] <- with(subset(Hood, Hood$Day == 2), Hood$DIT[7])

Hood$RER0[1:6] <- with(subset(Hood, Hood$Day == 1), Hood$RER[1])
Hood$RER0[7:12] <- with(subset(Hood, Hood$Day == 2), Hood$RER[7])

VAS <- read.table(file="VAS2.txt", header=TRUE, dec = ".")
head(VAS)
##   VAS_no. Day Time naus hung sat full much
## 1     1.0   1  -30   14   73  36    0   97
## 2     2.1   1   20   74    4  85   51   51
## 3     2.0   1   55   85   76  25   40   79
## 4     3.0   1   85   88   37  71   61   51
## 5     4.0   1  115   91   38  60   58   58
## 6     5.0   1  145   44   82  24   21   63
VAS$VAS_no. <- factor(VAS$VAS_no.)
VAS$Day <- factor(VAS$Day)
VAS$Treat <- factor(VAS$Day, levels = 1:2, labels = c("Walnut", "Banana"))
VAS2 <- read.table(file="VAS3.txt", header=TRUE, dec = ".")
head(VAS2)
##   Day  Treat naus.30 naus20 naus55 naus85 naus115 naus145 naus175 hung.30
## 1   1 Walnut      14     74     85     88      91      44      33      73
## 2   2 Banana      13     30     23     10      18      16      10      73
##   hung20 hung55 hung85 hung115 hung145 hung175 sat.30 sat20 sat55 sat85
## 1      4     76     37      38      82      91     36    85    25    71
## 2      8     14     14      24      25      54     12    64    72    65
##   sat115 sat145 sat175 full.30 full20 full55 full85 full115 full145
## 1     60     24     16       0     51     40     61      58      21
## 2     64     53     54      12     79     74     70      52      56
##   full175 much.30 much20 much55 much85 much115 much145 much175
## 1      20      97     51     79     51      58      63      89
## 2      43      65     32     29     41      35      64      72
VAS2$Day <- factor(VAS2$Day)

Blood <- read.table(file="Blood.txt", header=TRUE, dec = ".")
Blood$Day <- factor(Blood$Day)
Blood$FFA <- Blood$FFA/1000
BloodWal <- subset(Blood, Blood$Day==1)
BloodBan <- subset(Blood, Blood$Day==2)
Blood2 <- read.table(file="Blood2.txt", header=TRUE, dec = ".")
Blood2$Day <- factor(Blood2$Day)
Blood2Wal <- subset(Blood2, Blood2$Day==1)
Blood2Ban <- subset(Blood2, Blood2$Day==2)
with(Hood, hist(EE))

with(Hood, qqnorm(EE))
with(Hood, qqline(EE))

with(Hood, hist(RER))

with(Hood, qqnorm(RER))
with(Hood, qqline(RER))

with(Hood, hist(DIT))

with(Hood, qqnorm(DIT))
with(Hood, qqline(DIT))

with(VAS, hist(naus))

with(VAS, qqnorm(naus))
with(VAS, qqline(naus))

with(VAS, hist(hung))

with(VAS, qqnorm(hung))
with(VAS, qqline(hung))

with(VAS, hist(sat))

with(VAS, qqnorm(sat))
with(VAS, qqline(sat))

with(VAS, hist(full))

with(VAS, qqnorm(full))
with(VAS, qqline(full))

with(VAS, hist(much))

with(VAS, qqnorm(much))
with(VAS, qqline(much))

with(BloodBan, hist(Glu))

with(BloodBan, qqnorm(Glu))
with(BloodBan, qqline(Glu))

with(BloodWal, hist(Glu))

with(BloodWal, qqnorm(Glu))
with(BloodWal, qqline(Glu))

with(BloodBan, hist(FFA))

with(BloodBan, qqnorm(FFA))
with(BloodBan, qqline(FFA))

with(BloodWal, hist(FFA))

with(BloodWal, qqnorm(FFA))
with(BloodWal, qqline(FFA))

with(BloodBan, hist(Pep))

with(BloodBan, qqnorm(Pep))
with(BloodBan, qqline(Pep))

with(BloodWal, hist(Pep))

with(BloodWal, qqnorm((Pep)^2))
with(BloodWal, qqline((Pep)^2))

with(Blood, hist(FFA))

with(Blood, qqnorm(FFA))
with(Blood, qqline(FFA))

with(Blood, hist(Pep))

with(Blood, qqnorm(Pep))
with(Blood, qqline(Pep))

Testing

DIT <- lm(DIT~Treat, Hood)
summary(DIT)
## 
## Call:
## lm(formula = DIT ~ Treat, data = Hood)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -715.67   -7.92   37.50  108.33  248.33 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)    155.3      109.1   1.424  0.18478   
## TreatBanana    560.3      154.2   3.633  0.00459 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 267.1 on 10 degrees of freedom
## Multiple R-squared:  0.569,  Adjusted R-squared:  0.5259 
## F-statistic:  13.2 on 1 and 10 DF,  p-value: 0.004588
EE <- lm(EE~Treat, Hood)
summary(EE)
## 
## Call:
## lm(formula = EE ~ Treat, data = Hood)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -715.67   -7.92   37.50  108.33  248.33 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1947.3      109.1  17.857 6.48e-09 ***
## TreatBanana    587.3      154.2   3.808  0.00344 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 267.1 on 10 degrees of freedom
## Multiple R-squared:  0.5919, Adjusted R-squared:  0.5511 
## F-statistic:  14.5 on 1 and 10 DF,  p-value: 0.003438
RER <- lm(RER~Treat, Hood)
summary(RER)
## 
## Call:
## lm(formula = RER ~ Treat, data = Hood)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.079000 -0.019167  0.007667  0.024000  0.045333 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.83367    0.01640  50.818  2.1e-13 ***
## TreatBanana  0.09133    0.02320   3.937  0.00279 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.04018 on 10 degrees of freedom
## Multiple R-squared:  0.6078, Adjusted R-squared:  0.5686 
## F-statistic:  15.5 on 1 and 10 DF,  p-value: 0.002789
naus <- lm(naus ~ Treat,VAS)
summary(naus)
## 
## Call:
## lm(formula = naus ~ Treat, data = VAS)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -47.286  -7.143  -0.143  12.821  29.714 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   61.286      8.435   7.266 9.93e-06 ***
## TreatBanana  -44.143     11.929  -3.701  0.00303 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 22.32 on 12 degrees of freedom
## Multiple R-squared:  0.533,  Adjusted R-squared:  0.4941 
## F-statistic: 13.69 on 1 and 12 DF,  p-value: 0.003033
hung <- lm(hung ~ Treat,VAS)
summary(hung)
## 
## Call:
## lm(formula = hung ~ Treat, data = VAS)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -53.286 -18.536  -5.786  22.464  42.714 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    57.29      10.61   5.401  0.00016 ***
## TreatBanana   -27.00      15.00  -1.800  0.09701 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.06 on 12 degrees of freedom
## Multiple R-squared:  0.2126, Adjusted R-squared:  0.147 
## F-statistic:  3.24 on 1 and 12 DF,  p-value: 0.09701
sat <- lm(sat ~ Treat,VAS)
summary(sat)
## 
## Call:
## lm(formula = sat ~ Treat, data = VAS)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -42.857 -17.536   4.143  13.571  39.714 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   45.286      8.910   5.083 0.000269 ***
## TreatBanana    9.571     12.600   0.760 0.462146    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 23.57 on 12 degrees of freedom
## Multiple R-squared:  0.04588,    Adjusted R-squared:  -0.03363 
## F-statistic: 0.577 on 1 and 12 DF,  p-value: 0.4621
full <- lm(full~ Treat,VAS)
summary(full)
## 
## Call:
## lm(formula = full ~ Treat, data = VAS)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -43.14 -14.18   2.50  17.93  25.14 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   35.857      8.655   4.143  0.00136 **
## TreatBanana   19.286     12.239   1.576  0.14108   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 22.9 on 12 degrees of freedom
## Multiple R-squared:  0.1714, Adjusted R-squared:  0.1024 
## F-statistic: 2.483 on 1 and 12 DF,  p-value: 0.1411
much <- lm(much ~ Treat,VAS)
summary(much)
## 
## Call:
## lm(formula = much ~ Treat, data = VAS)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -19.29 -15.54  -7.00  16.46  27.29 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   69.714      6.936  10.051 3.39e-07 ***
## TreatBanana  -21.429      9.809  -2.185   0.0495 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 18.35 on 12 degrees of freedom
## Multiple R-squared:  0.2846, Adjusted R-squared:  0.2249 
## F-statistic: 4.773 on 1 and 12 DF,  p-value: 0.04948
FFA <- lm(FFA ~ Treat,Blood)
summary(FFA)
## 
## Call:
## lm(formula = FFA ~ Treat, data = Blood)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.06080 -0.04665 -0.01520 -0.00510  0.17420 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  0.06880    0.03419   2.013  0.07897 . 
## TreatWalnut  0.22740    0.04835   4.704  0.00153 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07644 on 8 degrees of freedom
## Multiple R-squared:  0.7344, Adjusted R-squared:  0.7012 
## F-statistic: 22.12 on 1 and 8 DF,  p-value: 0.001534
Glu <- lm(Glu ~ Treat,Blood)
summary(Glu)
## 
## Call:
## lm(formula = Glu ~ Treat, data = Blood)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -0.560 -0.161 -0.047  0.234  0.530 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   5.0000     0.1558  32.099 9.66e-10 ***
## TreatWalnut   0.3140     0.2203   1.425    0.192    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3483 on 8 degrees of freedom
## Multiple R-squared:  0.2025, Adjusted R-squared:  0.1029 
## F-statistic: 2.032 on 1 and 8 DF,  p-value: 0.1919
Pep <- lm(Pep ~ Treat,Blood)
summary(Pep)
## 
## Call:
## lm(formula = Pep ~ Treat, data = Blood)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -723.4  -43.6    6.9  229.3  437.6 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1088.4      167.5   6.498 0.000189 ***
## TreatWalnut   -752.8      236.9  -3.178 0.013040 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 374.6 on 8 degrees of freedom
## Multiple R-squared:  0.558,  Adjusted R-squared:  0.5027 
## F-statistic:  10.1 on 1 and 8 DF,  p-value: 0.01304