Set Factor Variables
Dan2 <- read_csv("Dan2.csv")
## Parsed with column specification:
## cols(
## Element = col_character(),
## Predicted = col_double(),
## Actual = col_double(),
## logpred = col_double(),
## logactual = col_double(),
## Group = col_character()
## )
Dan2$Group = as.factor(Dan2$Group)
Dan2$Element = as.factor(Dan2$Element)
Dan2
## # A tibble: 75 x 6
## Element Predicted Actual logpred logactual Group
## <fctr> <dbl> <dbl> <dbl> <dbl> <fctr>
## 1 HAW4 3.040000 2.8200000 0.4828736 0.45016374 THC
## 2 HAW5 2.340000 2.3600000 0.3692159 0.37363175 THC
## 3 HEMWat 23 1.350000 4.0649500 0.1314832 0.60905521 THC
## 4 HEMWat 24 0.490000 2.4669550 -0.3060911 0.39216123 THC
## 5 HEMWat 25 0.520000 1.6843229 -0.2817922 0.22642536 THC
## 6 HEW9 0.940000 1.2101977 -0.0271998 0.08285634 THC
## 7 HEW10 0.630000 0.9697192 -0.1980524 -0.01335401 THC
## 8 HEW11 0.470000 0.7408328 -0.3255874 -0.13027982 THC
## 9 HAW4 2.130211 1.4300000 0.3284226 0.15552806 CBD
## 10 HAW5 1.622111 1.2200000 0.2100807 0.08593629 CBD
## # ... with 65 more rows
R2
summary(lm(Actual~Predicted, data = Dan2[Dan2$Group == "THC",]))
##
## Call:
## lm(formula = Actual ~ Predicted, data = Dan2[Dan2$Group == "THC",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8633 -0.6812 -0.2988 0.2512 1.9515
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.3322 0.6140 2.170 0.0731 .
## Predicted 0.5787 0.4032 1.435 0.2012
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.035 on 6 degrees of freedom
## Multiple R-squared: 0.2556, Adjusted R-squared: 0.1315
## F-statistic: 2.06 on 1 and 6 DF, p-value: 0.2012
summary(lm(Actual~Predicted, data = Dan2[Dan2$Group == "CBD",]))
##
## Call:
## lm(formula = Actual ~ Predicted, data = Dan2[Dan2$Group == "CBD",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.5399 -0.2872 -0.1509 0.2814 0.5998
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.02992 0.25822 0.116 0.91102
## Predicted 0.91071 0.19138 4.759 0.00206 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.423 on 7 degrees of freedom
## Multiple R-squared: 0.7639, Adjusted R-squared: 0.7301
## F-statistic: 22.65 on 1 and 7 DF, p-value: 0.002062
summary(lm(Actual~Predicted, data = Dan2[Dan2$Group == "CBDA",]))
##
## Call:
## lm(formula = Actual ~ Predicted, data = Dan2[Dan2$Group == "CBDA",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.19208 -0.14333 -0.01197 0.08183 0.30802
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.1294 0.1021 1.267 0.2455
## Predicted 0.3539 0.0776 4.561 0.0026 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1733 on 7 degrees of freedom
## Multiple R-squared: 0.7482, Adjusted R-squared: 0.7122
## F-statistic: 20.8 on 1 and 7 DF, p-value: 0.002602
summary(lm(Actual~Predicted, data = Dan2[Dan2$Group == "all",]))
##
## Call:
## lm(formula = Actual ~ Predicted, data = Dan2[Dan2$Group == "all",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.2209 -0.4409 -0.1681 0.4572 1.5806
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.6263 0.2138 2.929 0.00734 **
## Predicted 0.4414 0.1401 3.150 0.00433 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6981 on 24 degrees of freedom
## Multiple R-squared: 0.2925, Adjusted R-squared: 0.263
## F-statistic: 9.924 on 1 and 24 DF, p-value: 0.004332
summary(lm(Actual~Predicted, data = Dan2[Dan2$Group == "all minus thc hemwat",]))
##
## Call:
## lm(formula = Actual ~ Predicted, data = Dan2[Dan2$Group == "all minus thc hemwat",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.69218 -0.40566 -0.05699 0.24658 1.36185
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.3528 0.1716 2.056 0.0524 .
## Predicted 0.8647 0.1389 6.226 3.55e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5115 on 21 degrees of freedom
## Multiple R-squared: 0.6486, Adjusted R-squared: 0.6319
## F-statistic: 38.76 on 1 and 21 DF, p-value: 3.554e-06
R2 (log)
summary(lm(logactual~logpred, data = Dan2[Dan2$Group == "THC",]))
##
## Call:
## lm(formula = logactual ~ logpred, data = Dan2[Dan2$Group == "THC",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.23405 -0.16609 -0.04797 0.14622 0.28874
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.25802 0.07778 3.317 0.0161 *
## logpred 0.47376 0.26187 1.809 0.1204
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2195 on 6 degrees of freedom
## Multiple R-squared: 0.353, Adjusted R-squared: 0.2451
## F-statistic: 3.273 on 1 and 6 DF, p-value: 0.1204
summary(lm(logactual~logpred, data = Dan2[Dan2$Group == "CBD",]))
##
## Call:
## lm(formula = logactual ~ logpred, data = Dan2[Dan2$Group == "CBD",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.22170 -0.19463 -0.05139 0.14718 0.32087
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.04816 0.07017 -0.686 0.51464
## logpred 0.88291 0.24075 3.667 0.00799 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2084 on 7 degrees of freedom
## Multiple R-squared: 0.6577, Adjusted R-squared: 0.6088
## F-statistic: 13.45 on 1 and 7 DF, p-value: 0.007993
summary(lm(logactual~logpred, data = Dan2[Dan2$Group == "CBDA",]))
##
## Call:
## lm(formula = logactual ~ logpred, data = Dan2[Dan2$Group == "CBDA",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.27840 -0.21708 0.01327 0.10900 0.37433
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.33215 0.07802 -4.257 0.00376 **
## logpred 0.71637 0.26303 2.724 0.02961 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2288 on 7 degrees of freedom
## Multiple R-squared: 0.5145, Adjusted R-squared: 0.4451
## F-statistic: 7.418 on 1 and 7 DF, p-value: 0.02961
summary(lm(logactual~logpred, data = Dan2[Dan2$Group == "all",]))
##
## Call:
## lm(formula = logactual ~ logpred, data = Dan2[Dan2$Group == "all",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.47352 -0.19419 0.01573 0.20669 0.41102
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.005258 0.050025 -0.105 0.91716
## logpred 0.440347 0.128715 3.421 0.00224 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2492 on 24 degrees of freedom
## Multiple R-squared: 0.3278, Adjusted R-squared: 0.2998
## F-statistic: 11.7 on 1 and 24 DF, p-value: 0.002238
summary(lm(logactual~logpred, data = Dan2[Dan2$Group == "all minus thc hemwat",]))
##
## Call:
## lm(formula = logactual ~ logpred, data = Dan2[Dan2$Group == "all minus thc hemwat",
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.39810 -0.16355 0.07652 0.14216 0.33136
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.06303 0.04881 1.291 0.211
## logpred 0.61418 0.12786 4.803 9.55e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2159 on 21 degrees of freedom
## Multiple R-squared: 0.5235, Adjusted R-squared: 0.5008
## F-statistic: 23.07 on 1 and 21 DF, p-value: 9.547e-05