From 0d71bc012ef307091f1d757584a908d00cae3805 Mon Sep 17 00:00:00 2001 From: may <414107241@qq.com> Date: Sun, 14 Jan 2018 19:00:42 +0800 Subject: [PATCH 1/2] x1,x2 is g1,g2 --- 06_StatisticalInference/08_tCIs/index.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06_StatisticalInference/08_tCIs/index.Rmd b/06_StatisticalInference/08_tCIs/index.Rmd index 44d768a00..e207a183a 100644 --- a/06_StatisticalInference/08_tCIs/index.Rmd +++ b/06_StatisticalInference/08_tCIs/index.Rmd @@ -178,7 +178,7 @@ sp <- sqrt((7 * 15.34^2 + 20 * 18.23^2) / (8 + 21 - 2)) ## Mistakenly treating the sleep data as grouped ```{r} n1 <- length(g1); n2 <- length(g2) -sp <- sqrt( ((n1 - 1) * sd(x1)^2 + (n2-1) * sd(x2)^2) / (n1 + n2-2)) +sp <- sqrt( ((n1 - 1) * sd(g1)^2 + (n2-1) * sd(g2)^2) / (n1 + n2-2)) md <- mean(g2) - mean(g1) semd <- sp * sqrt(1 / n1 + 1/n2) rbind( From 75a239cca8f3d564db109dec865af5a0bf031593 Mon Sep 17 00:00:00 2001 From: may <414107241@qq.com> Date: Sun, 18 Feb 2018 14:22:05 +0800 Subject: [PATCH 2/2] fix two things --- 08_PracticalMachineLearning/016preProcessingPCA/index.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/08_PracticalMachineLearning/016preProcessingPCA/index.Rmd b/08_PracticalMachineLearning/016preProcessingPCA/index.Rmd index c48265cd7..a9d22c139 100644 --- a/08_PracticalMachineLearning/016preProcessingPCA/index.Rmd +++ b/08_PracticalMachineLearning/016preProcessingPCA/index.Rmd @@ -18,6 +18,7 @@ mode : selfcontained # {standalone, draft} ```{r setup, cache = F, echo = F, message = F, warning = F, tidy = F} # make this an external chunk that can be included in any file options(width = 100) +library(knitr) opts_chunk$set(message = F, error = F, warning = F, comment = NA, fig.align = 'center', dpi = 100, tidy = F, cache.path = '.cache/', fig.path = 'fig/') options(xtable.type = 'html') @@ -158,7 +159,7 @@ plot(spamPC[,1],spamPC[,2],col=typeColor) ```{r pcaCaret,dependson="spamPC",cache=TRUE,fig.height=3.5,fig.width=3.5} preProc <- preProcess(log10(training[,-58]+1),method="pca",pcaComp=2) trainPC <- predict(preProc,log10(training[,-58]+1)) -modelFit <- train(training$type ~ .,method="glm",data=trainPC) +modelFit <- train(y=training$type,method="glm",x=trainPC) ``` ---