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
games.howell <- function(grp, obs) { | |
#Create combinations | |
combs <- combn(unique(grp), 2) | |
# Statistics that will be used throughout the calculations: | |
# n = sample size of each group | |
# groups = number of groups in data | |
# Mean = means of each group sample | |
# std = variance of each group sample |
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
""" | |
Simple script for extracting Socrata Open Data Access (SODA) datasets. Compatible with 3+, though one can easily make it 2.7 | |
compatible by changing the `from urllib.error import HTTPError` import to `from urllib2 import HTTPError` | |
Parameters | |
---------- | |
endpoint : string | |
SODA API endpoint of the dataset. | |
count : int, default 1000 |
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
import requests | |
import numpy as np | |
import pandas as pd | |
from six.moves.urllib.error import HTTPError | |
def get_soda_api_data(endpoint, count=1000, offset=0, return_df=True): | |
params = {'$limit': count, '$offset': offset} | |
results = [] |
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
library(caret) | |
ginzberg <- read.csv('D:/Google_Drive/Google_Drive/Resources/Datasets/Rdata/car/Ginzberg.csv') | |
ginzberg <- ginzberg[2:4] | |
train <- createDataPartition(y = ginzberg$depression, | |
p = 0.50, | |
list = FALSE) | |
training <- ginzberg[ train,] |
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
<!--PHP file for adding a basic template portfolio page for Wordpress themes using the Bootstrap framework.--> | |
<?php | |
/* | |
Template Name: Portfolio | |
*/ | |
?> | |
<?php get_header(); ?> |
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
# Function for performing Lagrangian polynomial interpolation https://en.wikipedia.org/wiki/Lagrange_polynomial. | |
# Requires the package rSymPy https://cran.r-project.org/web/packages/rSymPy/index.html. | |
# Parameters: | |
# x: x values of interpolating points | |
# y: values corresponding to x values | |
# Returns: | |
# Simplified interpolated polynomial that passes through the given x and y points | |
lagrange.poly <- function(x, 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
from xlwings import Workbook, Range | |
import pandas as pd | |
import os | |
import re | |
# Script to merge a folder containing Excel workbooks into a single workbook. | |
# The folder should only contain Excel workbooks and must all either be in csv, xls or xlsx format | |
# To run, open the command prompt and enter the command python Merge_Excel_Workbooks.py | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
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
from xlwings import Workbook, Range, Sheet | |
import pandas as pd | |
import os | |
# Alternative method to split an Excel worksheet into multiple sheets based on a column name. | |
# The script will prompt four questions to enter in the required information. The workbook will then open and | |
# split the prompted worksheet into separate worksheets based on the desired column name. | |
# To run, open the command prompt and enter the command python Split_Excel_Worksheet_v2.py | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
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
from xlwings import Workbook, Range, Sheet | |
import pandas as pd | |
# Split Excel data in one worksheet into multiple worksheets based on column name. | |
# Copy this file into the same location as the Excel workbook with the worksheet you wish to split. | |
# Download the zip of the xlwings Github repo here: https://github.com/ZoomerAnalytics/xlwings and copy the | |
# xlwings.bas file from the xlwings folder. Import the xlwings.bas file into your Excel workbook by entering ALT+F11 | |
# and then going to File, Import File and clicking on the file. | |
# Import the Split_Excel_Worksheet.bas file and run by going to the Developer tab on the Excel Ribbon, click Macros, |
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
# Function for calculating the confidence (mean) and prediction intervals of a fitted linear regression model. | |
# Replicates the predict() function with arguments 'confidence' and 'prediction' | |
# Used in post demonstrating the confidence and prediction intervals in linear regression: http://www.aaronschlegel.com/notebook/confidence-prediction-intervals/ | |
# Takes three arguments: | |
# x = vector of independent variable data points | |
# y = vector of dependent variable data points | |
# pred.x = value of x to find predicted y | |
conf.pred.intervals <- function(x, y, pred.x) { |
OlderNewer