Home
Dylan Dijk
Cancel

Useful custom R functions

Heatmaps Given two matrices, this function plots heatmaps for each one with a fixed colour scale to allow for comparison. heatmap_scale = function(matrix1, matrix2, main1 = NULL, main2 = NULL){ ...

Linux Binaries

Add bash script to usr/bin folder then run chmod +x your_binary, and add export PATH=$PATH:~/usr/bin to bottom of .bashrc file. Below I give my Linux binaries CTVsuggestTrain_train_model.sh #!/bi...

Matrix Norms

Matrix and Vector norm inequalities

From this answer: [\begin{align} |Ax|_2 \leq |A|_F |x|_2 \end{align}] From this question can do better with: [\begin{align} |Ax|_2 \leq |A|_2 |x|_2 \end{align}] where $|A|_2$ is the spectral no...

Optimisation foundations

References Introduction to nonlinear optimization - Amir Beck Matteo theory of inference note chapter 8 is on MLE and talks about optimisation. Says stuff like: The terminolog...

R Cheat Sheet

Finding C source code for internal R functions library("pryr") show_c_source(.Internal(backsolve()))

Collinearity and Confounding

Confounding variables A classical example of a confounding variable, and that correlation does not imply causation, is the incorrect assumption that an increase in ice cream sales causes an increa...

Projections

References: Online lecture notes Projections In linear algebra a projection is a linear map from a vector space to itself $P:V \rightarrow V$, often a subspace, such that [P^2 = P] From thi...

Orthogonal Matrices

Linear Regression - Diagnostic Plots

Explain each of the R diagnostic plots for linear regression Give example of linear regression with time series dataset. Plotting autocorrelation of residuals. And plotting residuals vs f...