cancer <- read.csv("cancer.csv")
#Figure 1.1
n <- nrow(cancer)
Y <- cancer$Mean_Area
X <- cancer$Mean_mean_G #
min(X)
## [1] 47.49451
max(X)
## [1] 110.6758
mean(X)
## [1] 73.90454
sd(X)
## [1] 12.42109
linmod <- lm(Y ~ X)
plot(
X,
Y,
xlab = "Average Green Intensity", #
ylab = "Average nuclear area",
pch = 16,
col = "Green", #
)
title(main = "Figure 1.1: Green Color Intensity And Average Nuclear Area") #
b0 <- linmod$coef[1]
b1 <- linmod$coef[2]
abline(a = b0, b = b1, col = "orange")

summary(linmod)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min 1Q Median 3Q Max
## -241.42 -85.27 -15.04 65.08 642.15
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 227.423 62.867 3.618 0.000395 ***
## X 5.851 0.839 6.974 7.06e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 134.3 on 165 degrees of freedom
## Multiple R-squared: 0.2277, Adjusted R-squared: 0.223
## F-statistic: 48.64 on 1 and 165 DF, p-value: 7.058e-11
Y.hat <- linmod$fitted.values
SSR <- sum((Y.hat - mean(Y)) ^ 2)
SSE <- sum((Y - Y.hat) ^ 2)
MSR <- SSR / 1
MSE <- SSE / (n - 2)
F.statistic <- MSR / MSE
#Figure 1.2
n <- nrow(cancer)
Y <- cancer$Mean_Area
X <- cancer$Mean_mean_G #
min(X)
## [1] 47.49451
max(X)
## [1] 110.6758
mean(X)
## [1] 73.90454
sd(X)
## [1] 12.42109
linmod <- lm(Y ~ X)
plot(
X,
Y,
xlab = "Average Green Intensity", #
ylab = "Average nuclear area",
pch = 16,
col = "Green", #
)
title(main = "Figure 1.2: Blue Color Intensity And Average Nuclear Area") #
b0 <- linmod$coef[1]
b1 <- linmod$coef[2]
abline(a = b0, b = b1, col = "orange")

summary(linmod)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min 1Q Median 3Q Max
## -241.42 -85.27 -15.04 65.08 642.15
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 227.423 62.867 3.618 0.000395 ***
## X 5.851 0.839 6.974 7.06e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 134.3 on 165 degrees of freedom
## Multiple R-squared: 0.2277, Adjusted R-squared: 0.223
## F-statistic: 48.64 on 1 and 165 DF, p-value: 7.058e-11
Y.hat <- linmod$fitted.values
SSR <- sum((Y.hat - mean(Y)) ^ 2)
SSE <- sum((Y - Y.hat) ^ 2)
MSR <- SSR / 1
MSE <- SSE / (n - 2)
F.statistic <- MSR / MSE
#Figure 1.3
n <- nrow(cancer)
Y <- cancer$Mean_Area
X <- cancer$Mean_mean_B #
min(X)
## [1] 72.08346
max(X)
## [1] 128.9248
mean(X)
## [1] 94.72136
sd(X)
## [1] 10.84549
linmod <- lm(Y ~ X)
plot(
X,
Y,
xlab = "Average Red Intensity", #
ylab = "Average nuclear area",
pch = 16,
col = "Blue", #
)
title(main = "Figure 1.3: Blue Color Intensity And Average Nuclear Area") #
b0 <- linmod$coef[1]
b1 <- linmod$coef[2]
abline(a = b0, b = b1, col = "orange")

summary(linmod)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min 1Q Median 3Q Max
## -212.24 -88.20 -11.88 63.00 614.36
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -40.3952 88.6243 -0.456 0.649
## X 7.3927 0.9296 7.953 2.75e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 129.9 on 165 degrees of freedom
## Multiple R-squared: 0.2771, Adjusted R-squared: 0.2727
## F-statistic: 63.24 on 1 and 165 DF, p-value: 2.748e-13
Y.hat <- linmod$fitted.values
SSR <- sum((Y.hat - mean(Y)) ^ 2)
SSE <- sum((Y - Y.hat) ^ 2)
MSR <- SSR / 1
MSE <- SSE / (n - 2)
F.statistic <- MSR / MSE
cancer <- read.csv("cancer.csv")
n <- nrow(cancer)
Y <- cancer$Mean_Area
X <- cancer$Mean_mean_B #
min(X)
## [1] 72.08346
max(X)
## [1] 128.9248
mean(X)
## [1] 94.72136
sd(X)
## [1] 10.84549
linmod <- lm(Y ~ X)
plot(
X,
Y,
xlab = "Average Red Intensity", #
ylab = "Average nuclear area",
pch = 16,
col = "Blue", #
)
title(main = "Figure 1.3: Blue Color Intensity And Average Nuclear Area") #
b0 <- linmod$coef[1]
b1 <- linmod$coef[2]
abline(a = b0, b = b1, col = "orange")

summary(linmod)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min 1Q Median 3Q Max
## -212.24 -88.20 -11.88 63.00 614.36
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -40.3952 88.6243 -0.456 0.649
## X 7.3927 0.9296 7.953 2.75e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 129.9 on 165 degrees of freedom
## Multiple R-squared: 0.2771, Adjusted R-squared: 0.2727
## F-statistic: 63.24 on 1 and 165 DF, p-value: 2.748e-13
Y.hat <- linmod$fitted.values
SSR <- sum((Y.hat - mean(Y)) ^ 2)
SSE <- sum((Y - Y.hat) ^ 2)
MSR <- SSR / 1
MSE <- SSE / (n - 2)
F.statistic <- MSR / MSE
#Figure 1.4
n <- nrow(cancer)
Y <- cancer$Mean_Area
X <- cancer$Mean_mean_HSV #
min(X)
## [1] 64.13022
max(X)
## [1] 131.2717
mean(X)
## [1] 90.31242
sd(X)
## [1] 13.5191
linmod <- lm(Y ~ X)
plot(
X,
Y,
xlab = "Average HSV Value", #
ylab = "Average nuclear area",
pch = 16,
col = "Purple", #
)
title(main = "Figure 1.4: HSV And Average Nuclear Area") #
b0 <- linmod$coef[1]
b1 <- linmod$coef[2]
abline(a = b0, b = b1, col = "orange")

summary(linmod)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min 1Q Median 3Q Max
## -216.81 -76.39 -13.02 66.50 587.15
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 68.5727 65.1806 1.052 0.294
## X 6.5471 0.7138 9.172 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 124.3 on 165 degrees of freedom
## Multiple R-squared: 0.3377, Adjusted R-squared: 0.3337
## F-statistic: 84.12 on 1 and 165 DF, p-value: < 2.2e-16
Y.hat <- linmod$fitted.values
SSR <- sum((Y.hat - mean(Y)) ^ 2)
SSE <- sum((Y - Y.hat) ^ 2)
MSR <- SSR / 1
MSE <- SSE / (n - 2)
F.statistic <- MSR / MSE
#Figure 1.5
n <- nrow(cancer)
Y <- cancer$Mean_Area
X <- cancer$Mean_mean_BR #
min(X)
## [1] 0
max(X)
## [1] 67.65289
mean(X)
## [1] 7.98594
sd(X)
## [1] 11.35399
linmod <- lm(Y ~ X)
plot(
X,
Y,
xlab = "Average BR Value", #
ylab = "Average nuclear area",
pch = 16,
col = "Purple", #
)
title(main = "Figure 1.5: BR And Average Nuclear Area") #
b0 <- linmod$coef[1]
b1 <- linmod$coef[2]
abline(a = b0, b = b1, col = "orange")

summary(linmod)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min 1Q Median 3Q Max
## -262.41 -90.99 -13.53 61.53 737.19
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 633.489 14.023 45.175 < 2e-16 ***
## X 3.302 1.012 3.262 0.00135 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 148.1 on 165 degrees of freedom
## Multiple R-squared: 0.06057, Adjusted R-squared: 0.05488
## F-statistic: 10.64 on 1 and 165 DF, p-value: 0.001346
Y.hat <- linmod$fitted.values
SSR <- sum((Y.hat - mean(Y)) ^ 2)
SSE <- sum((Y - Y.hat) ^ 2)
MSR <- SSR / 1
MSE <- SSE / (n - 2)
F.statistic <- MSR / MSE