Skip to content

Instantly share code, notes, and snippets.

View nickpettican's full-sized avatar
📚
Studying

Nicolas Pettican nickpettican

📚
Studying
View GitHub Profile
#!/usr/bin/perl
use diagnostics;
use strict;
use warnings;
use Getopt::Long;
# Defining bin size and parameters
print "Enter file name:\n";
@nickpettican
nickpettican / stats04
Last active April 29, 2019 09:32
Session04
# CHAPTER 6:
# TWO SAMPLES
# The classical tests:
# - Comparing two variances: Fisher's F test
var.test
# - Comparing two sample means with normal errors: Student's t test
t.test
# - Comparing two means with non-normal errors: Wilcoxon's test
@nickpettican
nickpettican / stats04_labuena.R
Created November 23, 2015 13:55
Session04.R
# CHAPTER 7
# LINEAR REGRESSION
reg.data <- read.csv("c:\\MSc\\Statistics\\Data\\tannin.csv")
attach(reg.data)
names(reg.data)
plot(tannin,growth,pch=21,bg="blue")
# LINEAR REGRESSION IN R
lm(growth∼tannin)
abline(lm(growth∼tannin),col="green")
fitted <- predict(lm(growth∼tannin))
# ANOVA: ANALYSIS OF VARIANCE
# Regression and ANOVA are identical approaches except for the nature of the explanatory variables
# STATISTICAL BACKGORUND
# The emphasis of ANOVA is on hypothesis testing
# To estimate means and standard errors of differences between means
# Comparing two means by t-test: (difference between two means)/standard error of the difference -> compare with critical value
# In ANOVA we compare 3 or more means
@nickpettican
nickpettican / RP1_R_commands
Last active March 9, 2016 14:57
RP1shortcuts
# write out table with data
write.table(merged_data, file='merged_data.tsv', quote=FALSE, sep='\t')
# open multiple datasets
temp = list.files(pattern="*.tsv")
gsub('.stv','',temp)
gsub('_output.tsv','_abundance',temp)
temp2 <- gsub('_output.tsv','_abundance',temp)
df <- read.table(temp[1])
df <- read.table(temp[1],col.names=c('ID','T','P',temp2[1]))
@nickpettican
nickpettican / havas_datacleaner.py
Created August 24, 2016 12:04
Used to clean some data for HavasLynx assignment for Excel and Tableau manipulation
#!/usr/bin/env python
import os
import csv
DATADIR = "C:\Users\User\Downloads\HavasLynx"
DATAFILE = "tin00028.tsv"
EUCODES = "2letterEU.txt"
OUTFILE = "internetuse_EU.csv"
function addNavTracking() {
let parentNavs = document.querySelectorAll(".header-navigation li.menu-item");
if (parentNavs.length) {
parentNavs.forEach(item => {
let label = item.querySelector("a").textContent;
if (label) {
item.addEventListener("click", () => {
ga("send", "event", "Menu-Nav", "click", label);
});
}