wwblog

Willie Wheeler's personal blog. Mostly tech.

Nonlinear regression in R
Jul 7, 2016

Yesterday I wrote about how to do polynomial regression in R, and noted that it's really a form of linear regression.

This post shows how to do nonlinear regression in R using the nlsLM function from the minpack.lm package. See A better 'nls' (?)

Polynomial regression in R
Jul 6, 2016

At first glance, polynomial fits would appear to involve nonlinear regression. In fact, polynomial fits are just linear fits involving predictors of the form x1, x2, …, xd.

Example 1: Polynomial fit

First, let's generate a data set:

set.seed(16

quantmod fun
May 11, 2016

Playing with the quandmod package in R. It's been around for a while but for me it's shiny and new.

library("quantmod")
getSymbols("EXPE", src="google")

Then

barChart(tail(EXPE, 200))

EXPE bar chart

For candlesticks:

candleChart(tail(EXPE, 200), multi.col

Java/Fortran Integration Using JNI
Mar 6, 2016

While Java/Fortran integration isn't something I expect to have to do very often, I recently needed to do this, and so I figured I'd write it up in case somebody else finds it helpful.

Also, please see Calling FORTRAN and C from Java for additional...

Anomaly Detection Using STL
Mar 3, 2016

This post describes a way to model the midpoint of a time series involving seasonal and trend components. We'll take a high-level look at an algorithm called STL, which stands for "Seasonal-Trend decomposition using Loess", and how to apply it to anomaly...

Python Turtle Graphics
Feb 22, 2016

These are just some simple Python turtle graphics programs for my kids to goof around with. I may add more programs to this post over time.

Squarish.py

Squarish.py

import turtle

colors = ["red", "yellow", "green", "blue"]
numColors = len(colors)

turtle.

Monitoring Bookings and the Law of Large Numbers
May 16, 2015

When monitoring bookings, one common approach is to use historical levels as a baseline, and then alert if the current level is x% lower than the historical, where x is a static value that tries to strike a balance between capturing as many problems...

Basic Time Series Analysis in R
May 14, 2015

This is really just a set of personal notes for working with time series in R. But if it's useful to you, great.

I'm using the xts package for time series data.

For now I'm just going to do the simple stuff (summary stats, plots, moving averages...

Diagnosing Bookings Drops with Drools
Apr 11, 2015

I've been thinking of using a rules engine to help diagnose unexpected bookings drops. Rules are a good way to simplify reasoning about complex domains, and there are lots of different things that can lead to bookings drops. Examples include:

Folding in Haskell
Mar 28, 2015

In Four Flavors of Functional Programming with Map and Filter we looked at map and filter, two higher-order functions for list processing. This time around we'll look at folding, which has two main varieties. The first is called foldl, or left fold...