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
| Company | TV Ad Budget | Impressions | |
|---|---|---|---|
| MILLERLITE | 50.1 | 32.1 | |
| PEPSI | 74.1 | 99.6 | |
| STROH'S | 19.3 | 11.7 | |
| FED'LEXPRESS | 22.9 | 21.9 | |
| BURGERKING | 82.4 | 60.8 | |
| COCO-COLA | 40.1 | 78.6 | |
| MCDONALD'S | 185.9 | 92.4 | |
| MCI | 26.9 | 50.7 | |
| DIETCOLA | 20.4 | 21.4 |
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(tidyverse) | |
| library(ggplot2) | |
| set.seed(123) | |
| sample_num <- 1000 | |
| sigma <- 1 | |
| # Generate Two Unit Root Processes | |
| x <- c(0,cumsum(rnorm(sample_num-1, mean=0, sd=sigma))) | |
| y <- c(0,cumsum(rnorm(sample_num-1, mean=0, sd=sigma))) |
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
| optimizeAdStock <- function(grp,sales){ | |
| rmax <- 0 | |
| corrmax <- -1 | |
| rates <- seq(0.00, 1.00, by = 0.01) | |
| corrs <- vector() | |
| for(r in rates){ | |
| adstock <- stats::filter(grp, filter=r, method = "recursive") | |
| corr <- cor(adstock,sales) |
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
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| def broadbent_adstock(grp, r): | |
| adstock = np.zeros(len(grp)) | |
| adstock[0] = grp[0] | |
| for i in range(1,len(grp)): | |
| adstock[i] = grp[i] + r*adstock[i-1] | |
| return adstock |
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
| import audioop | |
| import math | |
| import numpy as np | |
| import pyaudio | |
| import pyfirmata | |
| import sys | |
| import time | |
| import serial | |
| import wave |
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
| #include <iostream> | |
| #include <cmath> | |
| #include "UTRandom1.h" | |
| #include "UTNormals.h" | |
| using namespace std; | |
| double SimpleMonteCarlo1(double Expiry, | |
| double Strike, | |
| double Spot, |
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
| class Array | |
| def fair_combination | |
| arr = [] | |
| n = length | |
| m = (n / 2).floor | |
| # Divide by interval | |
| (1..m - 1).each do |j| | |
| subarr = (0..n - 1).to_a | |
| sub1 = [] |