-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
212c736
commit 107fb11
Showing
102 changed files
with
157 additions
and
5,644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NA_position <- function(x, y){ | ||
all(is.na(x) == is.na(y)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
smart_test <- function(x){ | ||
t <- table(x) | ||
if (min(t) >= 5){ | ||
chi <- chisq.test(t) | ||
print(c(chi$statistic, chi$parameter, chi$p.value)) | ||
}else { | ||
fisher.test(t)[1] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
most_significant <- function(x){ | ||
vec <- as.vector(x) | ||
sap <- sapply(vec, function(vec) chisq.test(table(vec))$p.value) | ||
return(names(sap[sap==min(sap)])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dat <- iris[, 1:4] | ||
means <-colMeans(dat) | ||
t_f <- t(t(dat)>means) | ||
rowss <- rowSums(t_f) | ||
iris$important_cases <- factor(ifelse(rowss>=3,"Yes","No")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
get_important_cases <- function(x){ | ||
means <- colMeans(x) | ||
t_f <- t(t(x)>means) | ||
rowss <- rowSums(t_f) | ||
x$important_cases <- factor(ifelse(rowss>=ncol(x)%/%2+1,"Yes","No")) | ||
return(x) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
stat_mode <- function(x){ | ||
tablo <- table(x) | ||
return(as.numeric(names(tablo[tablo == max(tablo)]))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
max_resid <- function(x){ | ||
chi_t <- chisq.test(table(x))$stdres | ||
ind <- which(chi_t == max(chi_t), arr.ind = T) | ||
return(c(rownames(ind), rownames(t(chi_t))[ind[2]])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
library("ggplot2") | ||
obj <- ggplot(diamonds,aes(x = color, fill = cut))+ | ||
geom_bar(position = "dodge") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
get_coefficients <- function(dataset){ | ||
return(exp(glm(y~x,data = dataset,family = "binomial")$coef)) | ||
} |
107 changes: 0 additions & 107 deletions
107
Fundamentals of statistics part 2/R tasks/Task 1/R task 1.ipynb
This file was deleted.
Oops, something went wrong.
107 changes: 0 additions & 107 deletions
107
Fundamentals of statistics part 2/R tasks/Task 1/R task 1.r
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
centered <- function(test_data, var_names){ | ||
means <- colMeans(test_data[var_names]) | ||
transp <- t(t(test_data[var_names])-means) | ||
test_data[var_names] <- transp | ||
return(test_data) | ||
} |
83 changes: 0 additions & 83 deletions
83
Fundamentals of statistics part 2/R tasks/Task 10/Task 10.ipynb
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.