library(entropy)
b100 = c(5, 10, 17, 68)
e100 = entropy.ChaoShen(b100)
e100
## [1] 0.9444
b200 = c(34, 41, 46, 79)
e200 = entropy.ChaoShen(b200)
e200
## [1] 1.331
b400 = c(35, 58, 71, 236)
e400 = entropy.ChaoShen(b400)
e400
## [1] 1.111
b800 = c(46, 59, 270, 425)
e800 = entropy.ChaoShen(b800)
e800
## [1] 1.059
b1000 = c(147, 210, 234, 409)
e1000 = entropy.ChaoShen(b1000)
e1000
## [1] 1.315
y = c(e100, e200, e400, e800, e1000)
plot(y, ylim = c(-1, 3), ylab = "Shannon Entropy", xaxt = "n", xlab = "Training Sample Size")
axis(1, at = c(1, 2, 3, 4, 5), c(100, 200, 400, 800, 1000))
lme = lm(y ~ (c(0, 1, 2, 3, 4)))
summary(lme)
##
## Call:
## lm(formula = y ~ (c(0, 1, 2, 3, 4)))
##
## Residuals:
## 1 2 3 4 5
## -0.1139 0.2258 -0.0409 -0.1400 0.0690
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.0583 0.1342 7.89 0.0042 **
## c(0, 1, 2, 3, 4) 0.0469 0.0548 0.86 0.4544
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.173 on 3 degrees of freedom
## Multiple R-squared: 0.197, Adjusted R-squared: -0.071
## F-statistic: 0.735 on 1 and 3 DF, p-value: 0.454
abline(lme, col = "red")