Home on xslates
/
Recent content in Home on xslatesHugo -- gohugo.ioen-usTue, 15 Sep 2020 00:00:00 +0000Properties Of Definite Integrals
/calculus/properties-of-definite-integrals/
Tue, 15 Sep 2020 00:00:00 +0000/calculus/properties-of-definite-integrals/The Area of a Region Bounded by Two Graphs Life Science Example Average Value of a Continuous Function We’ve seen that the definite integral
\[\int_a^c f(x)dx,\]
can be regarded as the area under the graph of \(y = f(x)\) over the interval [a, c]. If you have a point \(b\) such that \(a < b < c\), the above integral can be expressed as the sum of the integral from \(a\) to \(b\), and the integral from \(b\) to \(c\).Vim Splits & FZF
/notes/vim-splits-fzf/
Tue, 15 Sep 2020 00:00:00 +0000/notes/vim-splits-fzf/I previously wrote about a frictionless way of working with Vim.
Recently, I’ve implemented a new addition to my Vim workflow, fzf.vim.
Now I can open any file from within a Vim buffer with :FZF " (to search within the current folder) or :FZF ~ " (to search within the $HOME directory). Both commands are remapped inside my .vimrc. I can then open the file I want into a horizontal split with Ctrl + X, or a vertical one with Ctrl + V.Applications Of Linear Functions
/calculus/applications-of-linear-functions/
Mon, 14 Sep 2020 00:00:00 +0000/calculus/applications-of-linear-functions/Highway tolls Profit-and-loss analysis Straight-line depreciation import matplotlib.pyplot as plt plt.style.use("classic") In this post, we’ll look at some textbook applications of linear functions. Although these are contrived problems taken from a book, they shed some light on how to think about using linear functions to solve real business problems.
Highway tolls Since heavier vehicles are responsible for more of the wear and tear on highways, drivers should pay tolls in direct proportion to the weight of their vehicles.Applications Of Definite Integrals
/calculus/applications-of-definite-integrals/
Sun, 13 Sep 2020 00:00:00 +0000/calculus/applications-of-definite-integrals/Total Profit Increasing Total Profit Accumulated Sales Total Profit A company finds that the marginal profit, in dollars, from drilling a well that is \(x\) feet deep is given by
\[P^\prime(x) = \sqrt[5]{x}.\]
Find the profit when a well 250 ft deep is drilled.
import sympy as sp from sympy.abc import x import matplotlib.pyplot as plt import numpy as np sp.init_printing() plt.style.use("classic") marginal_profit = sp.root(x, 5) marginal_profit ## 5 ___ ## \/ x profit = sp.FIRE - Extended Toy Model
/trading/fire-extended-toy-model/
Sat, 12 Sep 2020 00:00:00 +0000/trading/fire-extended-toy-model/A while back, I looked into a very simple toy model for living off savings. The main idea was to:
set aside a yearly budget at the end of the year cover all expenses for the upcoming year using the yearly budget invest the lion share of your salary every month refill the budget a little bit every month The first time around, I looked at a single year.Economic Applications Of Derivatives
/calculus/economic-applications-of-derivatives/
Thu, 10 Sep 2020 00:00:00 +0000/calculus/economic-applications-of-derivatives/DVD Rentals Theorems for Elasticity of Demand Some interesting things you can do with derivatives in the context of economics are:
finding the price elasticity of a demand function finding the maximum of a total-revenue function understanding demand in terms of elasticity Retailers and manufacturers often need to know how a small change in price will affect the demand of a product. If a small increase in price produces no change in demand, then the price increase is a reasonable decision to make.Consumer Surplus & Producer Surplus
/calculus/consumer-surplus-producer-surplus/
Wed, 09 Sep 2020 00:00:00 +0000/calculus/consumer-surplus-producer-surplus/You can think of demand and supply (of a product) as quantities that are functions of price. However, it can be convenient to also think of them as prices as functions of quantity, that is \(p = D(x)\) and \(p = S(x)\). Consumer surplus and producer surplus are such quantities.
A consumer’s demand curve is the graph of \(p = D(X)\), which shows the price per unit that the consumer is willing to pay for \(x\) units of a product.Nonlinear Models, Polynomial Functions
/calculus/nonlinear-models-polynomial-functions/
Tue, 08 Sep 2020 00:00:00 +0000/calculus/nonlinear-models-polynomial-functions/import matplotlib.pyplot as plt import numpy as np import math plt.style.use("classic") Linear and quadratic functions are part of a general class of polynomial functions. A polynomial function is given by
\[f(x) = a_nx^n + a_{n-1}x^{n-1}, + \dots + a_2x^2 + a_1x^1 + a_0,\]
where \(n\) is a nonnegative integer and \(a_n, a_{n-1}, \dots, a_1, a_0\) are real numbers, called the coefficients. The number \(a_0\), which is not multiplied by a variable, is called a constant.Mathematical Modeling & Curve Fitting
/calculus/mathematical-modeling-curve-fitting/
Mon, 07 Sep 2020 00:00:00 +0000/calculus/mathematical-modeling-curve-fitting/There are a handful of families of functions that form the basic toolkit that we use to model data. Curve fitting is the process of constructing a curve, or mathematical function, that best fits a series of data points.
The simplest way to decide which, if any, type of function fits a dataset is to examine a scatterplot of the data. If we can spot a general pattern that looks like any of the functions we would like to model with, then we can try to fit the data with it.Business Applications Of Exponential Functions
/calculus/business-applications-of-exponential-functions/
Sun, 06 Sep 2020 00:00:00 +0000/calculus/business-applications-of-exponential-functions/Franchise Expansion Compound Interest Value of Manhattan Island Cost of Hershey Bar Diffusion of Information Hullian Learning Model We go over some textbook exercises for exponential functions.
Franchise Expansion A franchise business is selling franchises for pizza shops throughout the country. The marketing manager estimates that the number of franchises, \(N\), will increase at the rate of 10% per year, that is,
\[\frac{dN}{dt} = 0.10N.\]Max-Min Problems
/calculus/max-min-problems/
Sat, 05 Sep 2020 00:00:00 +0000/calculus/max-min-problems/Example Scipy methods Additional Resources An important use of calculus is the solving of maximum-minimum problems, that is, finding the absolute maximum of minimum value of some varying quantity and that point at which that maximum of minimum occurs.
There’s an extensive treatment of optimization on Scipy’s lecture notes.
The general strategy for solving these problems involves translating the problem into an equation in one variable.Probability Expected Value & Normal Distribution
/calculus/probability-expected-value-normal-distribution/
Sat, 05 Sep 2020 00:00:00 +0000/calculus/probability-expected-value-normal-distribution/The Normal Distribution Percentiles Z-Scores Let \(x\) be a continuous random variable over the interval \([a, b]\) with probability density function \(f\). The expected value of \(x\) is defined by
\[E(x) = \int_a^b x \cdot f(x)dx.\]
The Wikipedia’s definition of expected value is useful in this case.
The expected value of a discrete random variable is the probability-weighted average of all its possible values. In other words, each possible value the random variable can assume is multiplied by its probability of occurring, and the resulting products are summed to produce the expected value.Max-Min Problems With Multiple Variables
/calculus/max-min-problems-with-multiple-variables/
Fri, 04 Sep 2020 00:00:00 +0000/calculus/max-min-problems-with-multiple-variables/Determination The D-Test Example Maximizing Profits A function \(f\) of two variables
has a relative maximum at \((a, b)\) if \[f(x, y) \leq f(a, b)\]
for all points \((a, b)\) in a region containing \((a, b)\)
has a relative minimum at \((a, b)\) if \[f(x, y) \geq f(a, b)\]
for all points \((a, b)\) in a region containing \((a, b)\)
Determination Let’s imagine a function \(f\) has a relative maximum or minimum value at some point \((a, b)\).Living Off Savings & Stocks - A FIRE Toy Model
/trading/living-off-savings-stocks-a-fire-toy-model/
Thu, 03 Sep 2020 00:00:00 +0000/trading/living-off-savings-stocks-a-fire-toy-model/The FIRE (Financial Independence, Retire Early) community is rather interesting. I periodically read threads like this one, or this one, to get an idea of how other people approach this lifestyle.
The goal of FIRE is to ultimately retire early. Yet, the financial independence part (even when you still have a job) is what appeals to me the most. I’m interested in the idea of not living paycheck to paycheck.Growth & Decay Models Integral Applications
/calculus/growth-decay-models-integral-applications/
Wed, 02 Sep 2020 00:00:00 +0000/calculus/growth-decay-models-integral-applications/Accumulated Future Value Future Value Example Accumulated Present Value Present Value Example Let’s consider the applications of integrating exponential growth and decay models.
The exponential growth integral is
\[\int_0^T P_0e^{kt}dt = \frac{P_0}{k}(e^{kt} - 1).\]
The exponential decay integral is
\[\int_0^T P_0e^{-kt}dt = \frac{P_0}{k}(1 - e^{-kt}).\]
Accumulated Future Value In financial applications, you can substitute \(P_0\) with \(R(t)\) (a function representing the rate, per year, of a continuous income stream).Differentiation Using Limits Of Difference Quotients
/calculus/differentiation-using-limits-of-difference-quotients/
Tue, 01 Sep 2020 00:00:00 +0000/calculus/differentiation-using-limits-of-difference-quotients/A tangent line touches a curve at a single point only. For a function \(y = f(x)\), its derivative at \(x\) is the function \(f^{\prime}\) defined by
\[f^{\prime}(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h},\]
provided that the limit exists. If \(f^{\prime}(x)\) exists, then we say that \(f\) is differentiable at \(x\).
The key concept here is that we’re taking the difference quotient between any two points of a function and reducing that difference \(f(x + h) - f(x)\) until it approaches \(0\).Derivatives Of Exponential And Logarithmic Functions
/calculus/derivatives-of-exponential-and-logarithmic-functions/
Sat, 29 Aug 2020 00:00:00 +0000/calculus/derivatives-of-exponential-and-logarithmic-functions/ The derivative of an exponential function of the form \(a^x\) is
\[\frac{d}{dx}a^x = (\ln a)a^x\]
from sympy import * from sympy.abc import x init_printing() expr = 2**x expr2 = 3**(2*x) diff(expr) ## x ## 2 *log(2) diff(expr2) ## 2*x ## 2*3 *log(3) The derivative of a function of the form \(\log_ax\) is
\[\frac{d}{dx}\log_a x = \frac{1}{\ln a} \cdot \frac{1}{x}\]
expr3 = log(x, 8) expr4 = log((x**2 + 1), 3) diff(expr3) ## 1 ## -------- ## x*log(8) diff(expr4) ## 2*x ## --------------- ## / 2 \ ## \x + 1/*log(3) Business Applications Of Marginals And Differentials
/calculus/business-applications-of-marginals-and-differentials/
Fri, 28 Aug 2020 00:00:00 +0000/calculus/business-applications-of-marginals-and-differentials/Marginal Revenue, Cost, and Profit Sales Major League Ticket Prices Marginal Productivity In this post, we look at some business applications of marginals and differentials. To begin with, let’s make a recap of the topic.
If \(C(x)\) represents the cost of producing \(x\) items, then marginal cost \(C^\prime(x)\) is its derivative, and \(C^\prime(x) \approx C(x + 1) - C(x)\). Thus, the cost to produce the \((x + 1)\)st item can be approximated by \(C(x + 1) \approx C(x) + C^\prime(x)\).Definite Integrals & Areas
/calculus/definite-integrals-areas/
Thu, 27 Aug 2020 00:00:00 +0000/calculus/definite-integrals-areas/The Fundamental Theorem of Calculus Examples Total Profit from Marginal Profit The process of integration is about making the logical connection that the antiderivative of a function \(f\) does in fact lead to the exact area under the graph of \(f\). That’s what’s called the fundamental theorem of calculus
The Fundamental Theorem of Calculus The area under the graph of a nonnegative continuous function \(f\) over an interval \([a, b]\) is determined as an area function \(A\), which is an antiderivative of \(f\); that is, \(\frac{d}{dx}A(x) = f(x)\).Programming Sucks
/notes/programming-sucks/
Thu, 27 Aug 2020 00:00:00 +0000/notes/programming-sucks/Disclaimer! I’m writing this while in a very bad mood.
This article is about programming for analytics, that is the scientific stack (programs like Python and R).
On this website, I try to retrace my understanding of mathematical topics by using code. I never liked rote calculations and memorization in school. I expected to be able to quickly program solutions to most problem, so that I could focus on grasping the insights in the material I’m reading.Second Derivatives To Find Maximum And Minimum Values
/calculus/second-derivatives-to-find-maximum-and-minimum-values/
Thu, 27 Aug 2020 00:00:00 +0000/calculus/second-derivatives-to-find-maximum-and-minimum-values/The “turning” behavior of a graph is called its concavity. The second derivative plays a pivotal role in analyzing a function’s concavity.
Suppose that \(f\) is a function whose derivative \(f^\prime\) exists at every point in an open interval \(I\). Then \(f\) is concave up on \(I\) if \(f^\prime\) is increasing (and therefore \(f^{\prime\prime}\) is positive) over \(I\). \(f\) is concave down on \(I\) if \(f^\prime\) is decreasing (and therefore \(f^{\prime\prime}\) is negative) over \(I\).First Derivatives To Find Maximum & Minimum Values Of Functions
/calculus/first-derivatives-to-find-maximum-minimum-values-of-functions/
Wed, 26 Aug 2020 00:00:00 +0000/calculus/first-derivatives-to-find-maximum-minimum-values-of-functions/If the graph of a function rises from the left to the right over an interval \(I\), the function is increasing on, or over, \(I\). If the graph drops from left to right, the function is decreasing on, or over, \(I\).
Mathematically speaking, a function is increasing over an interval if, for every input \(a\) and \(b\) in the interval, the input \(a\) is less than the input \(b\), and the output \(f(a) < f(b)\).SQL Crash Course
/notes/sql-crash-course/
Wed, 26 Aug 2020 00:00:00 +0000/notes/sql-crash-course/Clauses Common Queries View Columns Filter (Match Rows Based on Conditions) Aggregate Columns Grouping & Filtering Subqueries In this article, we go through some basic SQL syntax.
Clauses Clauses are the distinct parts of an SQL statement. You put each clause on its own line and capitalize them for legibility. Here are the most important ones.
SELECT column, column lists the columns you want to show.The Internet Is Demoralizing
/notes/the-internet-is-demoralizing/
Wed, 26 Aug 2020 00:00:00 +0000/notes/the-internet-is-demoralizing/The Internet is getting more difficult to use every day.
I have to open an app like Notion twice on my laptop because the first time it just loads and doesn’t start.
Google will arbitrarily choose to omit search terms that I explicitly type in my search (Missing: The Term I Need, Must Include: The Other Term I Need).
Google Data Studio (if you work with this sort of stuff) will eat all of my CPU, make my fan spin out of control, and crawl to a halt.Business Applications Of Growth & Decay Models
/calculus/business-applications-of-growth-decay-models/
Tue, 25 Aug 2020 00:00:00 +0000/calculus/business-applications-of-growth-decay-models/Present Value of a Trust Salary Value Early Retirement In this article, we look at some textbook problems relating to applications of growth and decay models.
from math import e def pv(p, k, t): k = k / 100 return p * e**(-k*t) def fv(p, k, t): k = k / 100 return p * e**(k*t) def apv(r, k, t): k = k / 100 return (r / k) * (1 - e**(-k*t)) def afv(r, k, t): k = k / 100 return (r / k) * (e**(k*t) - 1) Present Value of a Trust In 18 years, Maggie Oaks is to receive $200,000 under the terms of a trust established by her grandparents.Applications Of Exponential Functions
/calculus/applications-of-exponential-functions/
Mon, 24 Aug 2020 00:00:00 +0000/calculus/applications-of-exponential-functions/Uninhibited Population Growth Investing Example Growth Rate & Doubling Time Business Example The Rule of 70 World Population Models of Limited Growth Business Subscriptions Another Limited Growth Model If you have a function like \(f(x) = ce^{kx}\), where \(c\) is a constant then its derivative is \(f^\prime (x) = k \cdot f(x)\), where \(k\) is also a constant.
For example, the general form of a function like \(\frac{dA}{dt} = 5A\) is \(A(t) = ce^{5t}\).Peter Principle & Obstacles
/notes/peter-principle-obstacles/
Mon, 24 Aug 2020 00:00:00 +0000/notes/peter-principle-obstacles/The Peter Principle states that a person who is competent at a job will be promoted up until their level of incompetence. This poses a handful of issues if you’re an employee in a technical position, and under the management of someone who went through the principle.
If your manager is just as technical as you are, and got promoted through the ranks, there might be less concern for issues.The Autocovariance Function
/statistics/the-autocovariance-function/
Mon, 24 Aug 2020 00:00:00 +0000/statistics/the-autocovariance-function/Autocovariance of White Noise Autocovariance of a Moving Average Autocovariance of a Random Walk The autocovariance function is defined as the following product,
\[ \gamma_x(s, t) = \text{cov}(x_s, x_t) = E[(x_s - \mu_s)(x_t - \mu_t)], \tag{1} \]
where \(s\) and \(t\) are two moments in time. The autocovariance measures the linear dependence between two points on the same series observed at different times. For \(s = t\), we haveThe Mean Function
/statistics/the-mean-function/
Sat, 22 Aug 2020 00:00:00 +0000/statistics/the-mean-function/Mean Function of a Moving Average Series Mean Function of a Random Walk with Drift Mean Function of Signal Plus Noise In this article, we discuss the mean function, and we build on a previous article on time series statistical models
The mean function can be defined as
\[ \mu_{xt} = E(x_t) = \int_{-\infty}^{\infty} xf_t(x) dx \tag{1} \]
where \(E\) denotes the expected value operator of a random variable.Periodic Compounding
/trading/periodic-compounding/
Fri, 21 Aug 2020 00:00:00 +0000/trading/periodic-compounding/Suppose that an amount \(P\) is attracting interest at a rate \(r > 0\). Assume the interest earned is added to the principal periodically (annually, monthly, daily, and so on). Interest will be attracted not just by the original deposit, but also by all the interest earned so far. In this cases, we’re dealing with discrete or periodic compounding.
Let’s take the case of monthly compounding. In this case, we divide the interest by the periods (12 months in a year).Functions
/calculus/functions/
Tue, 11 Aug 2020 00:00:00 +0000/calculus/functions/Basic introduction of functions.
Given two sets \(A\) and \(B\), a function is a special type of relation in which each element of the first set is related to exactly one element of the second set. Elements of the first set are denoted as inputs or the domain of the function, and elements of the second set are denoted as outputs or the range of the function. For any function, when we know the input, the output is deterministic and unique.Describing Time Series Mathematically
/statistics/describing-time-series-mathematically/
Sat, 08 Aug 2020 00:00:00 +0000/statistics/describing-time-series-mathematically/In this article, we discuss the mathematical description of time series.
The joint probability function fully describes a time series as a collection of \(n\) random variables at time points \(t_1, t_2, \cdots, t_n\). This function is the probability that the values of the series are jointly (i.e., together) less than the \(n\) constants \(c_1, c_2, \cdots, c_3\); that is,
\[ F(c_1, c_2, \cdots, c_n) = P(x_{t_1} \leq c_1,x_{t_2} \leq c_2, \cdots, x_{t_n} \leq c_n).Simple Interest
/trading/simple-interest/
Fri, 07 Aug 2020 00:00:00 +0000/trading/simple-interest/In this article we discuss simple interest.
Suppose that an amount is paid into an account where it’s going to earn interest. The future value of the amount consists of the initial deposit, called the principal (\(P\)), plus the interest earned since the money was deposited in the account.
Let’s consider the case when interest is only dependent on the principal, which remains unchanged during the investment period. After one year the interest earned will be \(rP\), where \(r > 0\) is the interest rate (often a percentage).Trade Risk
/trading/trade-risk/
Wed, 05 Aug 2020 00:00:00 +0000/trading/trade-risk/In trading circles, it’s common knowledge that most traders lose money. It’s also generally accepted that that’s because they lack good risk management practices. In this article we look at a basic trade risk profile calculation.
For an introduction on risk, read more here, and here. We’ll just dive in.
What we want to do is to calculate the risk profile of entering a trade. To do this, we need a handful of parameters.Time Value of Money
/trading/time-value-of-money/
Tue, 04 Aug 2020 00:00:00 +0000/trading/time-value-of-money/We look at the basics of concept of the time value of money.
An amount of money to be received in the future is worth less than the same amount today. That is because of the presumption that money due in the future or locked in a fixed term account cannot be spent immediately. Therefore, you would expect to be compensated for postponed consumption.
The way this theory works out in practice is that, because of other seemingly arbitrary financial frolics, prices may rise (inflation) as you wait for your money, making it less valuable.Arithmetic Returns vs Logarithmic Returns
/trading/arithmetic-returns-vs-logarithmic-returns/
Mon, 03 Aug 2020 00:00:00 +0000/trading/arithmetic-returns-vs-logarithmic-returns/Percentage Change Approximation Compounding Frequency Independence Time-Additivity Asset-Additivity In finance, logarithmic returns are often preferred to arithmetic returns. We quickly explore why that is.
Logarithmic functions play an important role in finance. Let’s see how that works.
We start with some fake price data.
import matplotlib.pyplot as plt import numpy as np import pandas as pd plt.style.use("classic") # hypothetical price action prices = pd.Series([50, 55, 51, 49, 52, 56, 60, 63, 61, 64, 67, 71]) plt.Installing Packages From AUR
/notes/installing-packages-from-aur/
Sun, 02 Aug 2020 00:00:00 +0000/notes/installing-packages-from-aur/All you need to do to install packages from the AUR (Arch User Repository) is to:
Get the Git Clone URL for the package. Clone it on your machine with git clone <url>. cd into the directory. Run makepkg -si to install it. You can then remove the package repository. You can remove AUR packages using pacman -R <package>.No-Arbitrage Principle
/trading/no-arbitrage-principle/
Sat, 01 Aug 2020 00:00:00 +0000/trading/no-arbitrage-principle/One of the fundamental assumptions about the market is that it should not allow for risk-free profits with no initial investment. That’s called the No-Arbitrage Principle.
Arbitrage opportunities arise when there are mistakes in the market place. Say that a currency exchange broker \(A\) offers to buy British pounds at \(d_A = 1.62\) dollars per pound, while another broker \(B\) offers to sell them at \(d_B = 1.60\) dollars per pound.Basic Notions & Assumptions About Simple Markets
/trading/basic-notions-assumptions-about-simple-markets/
Thu, 30 Jul 2020 00:00:00 +0000/trading/basic-notions-assumptions-about-simple-markets/In this article we look at a simple market model and its underlying assumptions.
Imagine that we’re trading two assets: one is risk-free (oftentimes taken to be a bank deposit or a government-issued bond) and one is a risky security (typically a stock, or any asset whose future price is unknown). Let’s assume we’re only interested in two instants, today (\(t = 0\)), and some time in the future, say one year from now, \(t = 1\).Understanding Others
/notes/understanding-others/
Wed, 29 Jul 2020 00:00:00 +0000/notes/understanding-others/Found this insightful thread on Hacker News.
One comment that stuck out for me, on the topic of understanding other people.
… I’m certainly not perfect. I sometimes find myself thinking, “why would you do that!?” and that’s when I realize that what that really means is I’m the one who’s not understanding something. I should be asking myself, “why would they do that?”Installing Local Python Packages
/notes/installing-local-python-packages/
Tue, 28 Jul 2020 00:00:00 +0000/notes/installing-local-python-packages/You might not want or have your Python packages and modules hosted online. If your packages are still under development, or you just want to keep them on your local machine, you can still use pip to install them.
pip install /path/to/package will look inside the directory you input for a setup.py file to install the package. This is equivalent to the pip install command you’d use to download from the Internet.Vim Frictionless Window Manager Workflow
/notes/frictionless-window-manager-workflow/
Sun, 26 Jul 2020 00:00:00 +0000/notes/frictionless-window-manager-workflow/Beware of advice on the Internet, especially when it comes to programming practices and workflows.
It took me a while to find a workflow simple enough to not get in the way of actual work. When I switched to Arch Linux, I decided to use the Suckless utilities. I opted for dwm and st. I also chose to learn Vim.
Any of these tools contains enough functionality to keep you learning for months.Statistical Time Series Models
/statistics/statistical-time-series-models/
Thu, 23 Jul 2020 00:00:00 +0000/statistics/statistical-time-series-models/White Noise Moving Averages Autoregression Random Walk with Drift Signal in Noise The objective of time series analysis is to develop models that describe sample data.
A time series is a collection of random variables indexed according to the order they’re obtained in time. A sequence \(x_1, x_2, x_3, \cdots\) is a time series if we denote \(x_1\) as the value taken by the series at the first time point, and so on.Characteristics Of Time Series
/statistics/characteristics-of-time-series/
Wed, 22 Jul 2020 00:00:00 +0000/statistics/characteristics-of-time-series/Time series are series of data points indexed in time order. They’re sequences of discrete-time data taken at successive equally spaced points in time.
library(astsa) This time domain (i.e., time is on the \(x\)-axis) approach is justified by the presumption that correlation between adjacent points in time can be explained in terms of a dependence of the current value on past values. That is, we can model some future values of a time series as a parametric function of the current and past values.Version Control Independence
/notes/version-control-independence/
Tue, 21 Jul 2020 00:00:00 +0000/notes/version-control-independence/There’s been a lot of heat around GitHub’s new redesign. A handful discussions can be found here, here, and here.
People were not happy about Microsoft acquiring the company either, given their reputation for EEE-ing the technologies they adopt.
I’m not a developer, nor do I care much about that world. However, I code from time to time, and I use the tools of the trade. Being at the mercy of corporations is not an appealing thought.Pragmatic Job Search Rationale
/notes/pragmatic-job-search-rationale/
Mon, 20 Jul 2020 00:00:00 +0000/notes/pragmatic-job-search-rationale/Loving your job is a laudable ambition. This article is not about that. This article is about the rational choices you can make when searching for a job that you’re not meant to love.
You should consider giving up the idea of a career. It’s more likely that you’ll string a collection of occupations within the same sector.
If having a career stops being a goal, you can see a job as a way to earn an income for tax and societal obligations that is separate from other aspirations you might have.Git - An Introduction
/notes/git-an-introduction/
Thu, 16 Jul 2020 00:00:00 +0000/notes/git-an-introduction/What is Git? Configuring Git Git Basics Creating Git Repositories Making Changes to Git Repositories Viewing the Commit History Undoing Things Working With Remotes Tagging Branching This article is heavily influenced by Git’s official documentation, and assumes that you’ve installed Git on your system. This is not a comprehensive tutorial on Git. It’s a summary of common valuable operations and workflows.
Version control is a system that keeps track of changes to files over time so that you can retrieve specific versions of these files at any time.Patching Suckless Software
/notes/patching-suckless-software/
Wed, 13 May 2020 00:00:00 +0000/notes/patching-suckless-software/If you use suckless software, chances are you might want to patch it. However, doing it using the patch Linux utility might not be the best alternative.
most patches are poorly maintained patches tend to apply to vanilla (unedited) versions of the software many patches fail and require manual intervention using patch can lead to maintenance hell It turns out that there are better alternatives to extend suckless software.Trading Risk Management: The 1% Rule
/trading/trading-risk-management-the-1-rule/
Sun, 09 Feb 2020 00:00:00 +0000/trading/trading-risk-management-the-1-rule/The 1% rule is a trading risk management technique that instructs the trader to never risk more than 1% of their account on any given trade.
This article from the Balance gives some examples but lost me at “By risking 1 percent of your account on a single trade, you can make a trade which gives you a 2 percent return on your account, even though the market only moved a fraction of a percent.How To Annualize Returns
/trading/how-to-annualize-returns/
Thu, 02 Jan 2020 00:00:00 +0000/trading/how-to-annualize-returns/Usually, we look at investment returns in terms of annual returns. However, you might have returns expressed as daily, weekly, or monthly returns. Here’s how to convert them.
The idea is to use the general formula for returns and compound it to an annualized period.
\[ r_a = (1 + r)^n - 1, \tag{1} \]
where \(r_a\) is the annual return, \(r\) is the return (in decimals) and \(n\) is the number of periods in a year.Interview with Erik Bernhardsson
/notes/interview-with-erik-bernhardsson/
Mon, 30 Dec 2019 00:00:00 +0000/notes/interview-with-erik-bernhardsson/I found out about Erik Bernhardsson’s Twitter profile by chance a few years back and was immediately fascinated by his experience and achievements. His website is one of the few that I read on a regular basis.
I contacted Erik because I wanted to know more about who he is and his story. He was extremely generous to give me the time of day, given his many responsibilities. I hope you enjoy reading this interview.Coding Practices To Keep Your Sanity
/notes/coding-practices-to-keep-your-sanity/
Sat, 23 Nov 2019 00:00:00 +0000/notes/coding-practices-to-keep-your-sanity/Some thoughts on programming from a non-programmer.
Beware of tools that are too recent. Sometimes change is good. Often, it is not.
Developers like shiny new tools. These tend to be of lesser quality than older, more robust ones.
Whenever someone calls their library “simple” or “easy”, beware.
Ugly and functioning is better than flashy and buggy.
No matter how many stars a repo has on GitHub, check the kind of issues its users are raising.A Cautionary Tale
/notes/a-cautionary-tale/
Tue, 17 Sep 2019 00:00:00 +0000/notes/a-cautionary-tale/While I was reading a thread on HN about the downsides of working at successful startups, and this comment stood out to me:
Successful companies also attract gold diggers. When the company is small, unless everybody is going above and beyond the call of duty, it’s likely going to fail. As the company gets bigger, there is more and more latitude for failure. At some point it is successful enough that it can survive having people whose only goal is to direct a large amount of money into their pockets.Trading Technical Analysis - A Refreshing Take
/trading/trading-technical-analysis-a-refreshing-take/
Fri, 06 Sep 2019 00:00:00 +0000/trading/trading-technical-analysis-a-refreshing-take/ There’s some controversy on whether technical analysis and chart reading are better than fundamental analysis and intrinsic valuation. I personally don’t have a dog in the fight. However, scanning reddit, my favorite source of unfiltered opinions, I found a couple of interesting answers to a thread called “Change my mind: Technical Analysis is a complete nonsense” on r/CryptoCurrency
Card And the original post on r/Bitcoin
Card Cumulative & Annualized Returns
/trading/cumulative-annualized-returns/
Tue, 06 Aug 2019 00:00:00 +0000/trading/cumulative-annualized-returns/The cumulative return of an investment is the aggregate return that an investment has gained or lost over time (it can be both positive or negative).
If you have Open-High-Low-Close stock data, you can compute cumulative returns on its adjusted price, rather than its close price alone. That’s because dividends and stock splits might lead to incorrect results. We then have
\[R_c = \frac{P_c}{P_i} - 1,\]
where \(R_c\) is the cumulative return, \(P_c\) is the current price, and \(P_i\) is the initial price.Fundamental Trading Tenets
/trading/fundamental-trading-tenets/
Mon, 05 Aug 2019 00:00:00 +0000/trading/fundamental-trading-tenets/Over the past few months, I have been listening to a podcast called Chat with Traders on which professional traders share how they work. The most useful episode, by far, is Episode 178: The Blueprint: Create a simple trend following system w/ Nick Radge. I will discuss more of the technical details of that episode another time.
Here are some lessons I have picked up from the podcast so far.Stop Loss & Take Profit: A Toy Model
/trading/stop-loss-take-profit-a-toy-model/
Tue, 30 Jul 2019 00:00:00 +0000/trading/stop-loss-take-profit-a-toy-model/Stopping Losses & Taking Profits Risk Reward Ratio Having Stop-Loss Orders (S/L) and Take-Profit Orders (T/P) allows you to compute a Risk/Reward Ratio for you trades. Let’s look into this.
Stopping Losses & Taking Profits If you’re trading at the weekly level, S/L and T/P orders might let you ride upward trends more reliably than if you did it intraday. Volatile assets might hit a T/P target way earlier than you’d hope, which might be a good thing if you want to dip in and out.The Unforgiving Math Of Stock Value Loss
/trading/the-unforgiving-math-of-stock-value-loss/
Sun, 21 Jul 2019 00:00:00 +0000/trading/the-unforgiving-math-of-stock-value-loss/Percentage Calculations Account Balance Example In this article we discuss why losing money can be worse than making it.
You buy a product for $25.00. The store has a sale and drops the price by 30%. Then, they raise the price again by 30%, so now the product costs $23.43. What happened? This is a common case of misleading percentages. The store applied the price increase to the discounted price.Writing Better Documentation
/notes/writing-better-documentation/
Sun, 14 Jul 2019 00:00:00 +0000/notes/writing-better-documentation/Lack of Stage-Setting Lack of Interpretation Guidelines Outdated Code Documentation Conclusion I’ve been trying to understand Backtrader, and I was taken aback by its poor documentation. It made me reflect on how one should not document projects. Although I did not explore the whole documentation, these problems were thorny enough to turn me off to the project entirely.
Lack of Stage-Setting The project assumes that you understand finance, trading, and programming fairly well.Thoughts On Working In The Tech Industry
/notes/thoughts-on-working-in-the-tech-industry/
Thu, 23 May 2019 00:00:00 +0000/notes/thoughts-on-working-in-the-tech-industry/Here are some assorted thoughts on my experience working in the tech industry (as an analyst).
You can’t manufacture team culture. It is the result of spontaneous habits and behaviors that a group of people develops over time; that is also the reason why workshops and top-down “change management initiatives” meet so much resistance.
Don’t have a meeting if you don’t have an agenda.
If you can end a meeting early, do it.About
/about/
Tue, 01 Jan 2019 00:00:00 +0000/about/On this site you can find articles related to programming, investing, business, analytics, and mathematics, as well as a variety of other topics that interest me.
My name is Will, and I make my living as an analyst. I use this website as a notebook of interesting (to me) subjects that I’m learning and experimenting with. The technical material on this site is sourced and adapted from academic books and online references.