This file contains hidden or 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
| colnames()%<>% trimws %>% gsub("\\(%\\)", "pp", .) %>% | |
| make.names %>% gsub("\\.+", "\\.", .) | |
| # whitespace from the beginning/end is trimmed | |
| # replaces (%) with a "pp" abbreviation for percentage | |
| # all white chars are subed with a dot | |
| # multiple dots are concatenated to a single one | |
| require(magrittr) |
This file contains hidden or 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
| \raggedleft $ \square $ |
This file contains hidden or 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
| \usepackage{amsmath} | |
| % lazy numbering for aling*: | |
| \newcommand{\numberthis}{\addtocounter{equation}{1}\tag{\theequation}} | |
| %in the document: | |
| \begin{align*} | |
| &\Pb{X_n > n(p + \epsilon)} = \sum_{j = K}^{n} \Pb{X_n = j} \\ | |
| &\leq \sum_{j = K}^{n} \Pb{X_n = K} r_K ^{j-K} | |
| \leq \sum_{j = K}^{\infty} \Pb{X_n = K} r_K ^{j-K} \\ | |
| &= \Pb{X_n = K} \cdot \frac{1}{1 - r_K} \numberthis \label{eq:bound} |
This file contains hidden or 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
| % define basic sets: | |
| \newcommand{\R}{\mathbb{R}} % real numbers | |
| \newcommand{\N}{\mathbb{N}} % natural numbers | |
| \newcommand{\Z}{\mathbb{Z}} % integers etc. | |
| \newcommand{\bb}{\mathbb} % blackboard font | |
| %and probability operators | |
| \newcommand{\Pb}[1]{\mathbb{P}(#1)} | |
| \newcommand{\Ex}[1]{\mathbb{E}(#1)} |
This file contains hidden or 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
| ```{r} | |
| pb <- txtProgressBar(min = 0, max = 20, style = 3) | |
| for(i in 1:20){ | |
| Sys.sleep(0.1) | |
| # update progress bar | |
| setTxtProgressBar(pb, i) | |
| } | |
| close(pb) | |
| ``` |
This file contains hidden or 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
| ```{r} | |
| plot(degree(g5, mode = "in"), degree(n5, mode = "out"), type = "p") | |
| cor.test(degree(g5, mode = "in"), degree(g5, mode = "out")) | |
| ``` |
This file contains hidden or 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
| AssignAddin <- function() { | |
| rstudioapi::insertText(" <- ") | |
| } |
This file contains hidden or 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
| which_mutual(g5) %>% table | |
| which_multiple(g5) %>% table | |
| which_loop(g5) %>% table |
This file contains hidden or 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
| {plot(density(in_deg), col=2) # where in_deg is a list of degrees - one obs. per verticle | |
| lines(density(out_deg), col=3)} |
This file contains hidden or 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
| library(fitdistrplus) | |
| library(lattice) | |
| in_geom_fit <- fitdist(in_deg, "geom") | |
| summary(in_geom_fit) | |
| plot(in_geom_fit) | |
| quantiles <- seq(0, 1, 0.05) | |
| qqmath(~in_deg, distribution=function(p){ qgeom(p, prob = in_geom_fit$estimate)}, main="Q-Q plot against geometric distribution", xlab = "geometirc from estimate") |