### Arps Decline Analysis in R

Here’s a quick example to show how to use R to fit a best-fit line to the most linear portion of a data series. This example fits two common Arps models to well production data in order to estimate ultimate recovery.

If you haven’t already done so, download R from http://www.r-project.org/ and install it.

# MCMC for Econometrics Students – III

Posted by on Apr 21, 2014 | No Comments

This is taken directly from David Giles blog (MCMC for Econometrics Students – III)…

As its title suggests, this post is the third in a sequence of posts designed to introduce econometrics students to the use of Markov Chain Monte Carlo (MCMC, or MC2) methods for Bayesian inference. The first two posts can be found here and here, and I’ll assume that you’ve read both of them already.

We’re going to look at another example involving the use of the Gibbs sampler. Specifically, we’re going to use it to extract the marginal posterior distributions from the joint posterior distribution, in a simple two-parameter problem. The problem – which we’ll come to shortly – is one in which we actually know the answer in advance. That’s to say, the marginalizing can be done analytically with some not-too-difficult integration. This means that we have a “bench mark” against which to judge the results generated by the Gibbs sampler.

# MCMC for Econometrics Students – II

Posted by on Apr 21, 2014 | No Comments

This is taken directly from David Giles blog (MCMC for Econometrics Students – II)…

This is the second in a set of posts about Monte Carlo Markov Chain (MCMC, or MC2) methods in Bayesian econometrics. The background was provided in this first post, where the Gibbs sampler was introduced.

The main objective of the present post is to convince you that this MCMC stuff actually works!

To achieve this, what we’re going to do is work through a simple example – one for which we actually know the answer in advance. That way, we’ll be able to check our results from applying the Gibbs sampler with the facts. Hopefully, we’ll then be able to see that this technique works – at least for this example!

# MCMC for Econometrics Students – I

Posted by on Apr 21, 2014 | No Comments

This is taken directly from David Giles blog (MCMC for Econometrics Students – I)…

This is the first of a short sequence of posts that discuss some material that I use when teaching Bayesian methods in my graduate econometrics courses.

This material focuses on Markov Chain Monte Carlo (MCMC) methods – especially the use of the Gibbs sampler to obtain marginal posterior densities. This first post discusses some of the computational issues associated with Bayesian econometrics, and introduces the Gibbs sampler. The follow-up posts will illustrate this technique with some specific examples.

So, what’s the computational issue here?

To begin with, what do we mean by MCMC, and what is the Gibbs sampler?

# Variable Exponent Decline Models

Posted by on Apr 19, 2014 | No Comments

Many empirical models have be proposed to describe the rate declines observed for wells on primary or late-life production.

These models often start with simple analytic relations for the “Loss Ratio” and “Loss Ratio Derivative”, which are defined as…

Loss Ratio
$$\frac{1}{D} = -\frac{q_g}{\left(\frac{dq_g}{dt}\right)}$$

Loss Ratio Derivative
$$b = \frac{d}{dt} \left[ \frac{1}{D} \right] = -\frac{d}{dt} \left[ \frac{q_g}{\left(\frac{dq_g}{dt}\right)} \right]$$

# Granger Testing

Posted by on Jul 19, 2013 | No Comments

From

“$$X$$ is said to Granger-cause $$Y$$ if $$Y$$ can be better predicted using the histories of both $$X$$ and $$Y$$ than it can by using the history of $$Y$$ alone.”

We can test for the absence of Granger causality by estimating the following VAR model:

$$Y_t = a_0 + a_1Y_{t-1} + \ldots + a_pY_{t-p} + b_1X_{t-1} + \ldots + b_pX_{t-p} + u_t$$
$$X_t = c_0 + c_1X_{t-1} + \ldots + c_pX_{t-p} + d_1Y_{t-1} + \ldots + d_pY_{t-p} + v_t$$

Then, testing $$H_0: b_1 = b_2 = \ldots = b_p = 0$$, against $$H_A: \text{Not } H_0$$, is a test that $$X$$ does not Granger-cause $$Y$$.

Similarly, testing $$H_0: d_1 = d_2 = \ldots = d_p = 0$$, against $$H_A: \text{Not } H_0$$, is a test that $$Y$$ does not Granger-cause $$X$$.

In each case, a rejection of the null implies there is Granger causality.

# Risk-Adjusted Discount Rates

Posted by on May 10, 2012 | No Comments

As given by Cassano and Sick in their 2009 paper titled “Valuation of a Spark Spread: an LM6000 Power Plant”, from which this post is almost directly copied, the Capital Asset Pricing Model (CAPM) defines the present value, $$\text{PV}$$, of a risky investment as

$$\text{PV} = e^{-(r+\lambda)T}\mathbb{E}\left[{\text{CF}_T}\right]$$

# Arps Decline Analysis in R – Minimum Decline Rates

Posted by on Mar 31, 2012 | No Comments

In the previous example, I showed how to use R to fit a best-fit line to the most linear portion of a data series. This is a great starting point, but a few tweaks may be needed when processing real data. One of most egregious problems occurs when the best fit line shows an increasing rate with time. As a simple fix, we can override any declines less than a specified minimum.

# Arps Decline Analysis in R

Posted by on Mar 13, 2011 | 4 Comments

Here’s a quick example to show how to use R to fit a best-fit line to the most linear portion of a data series. This example fits two common Arps models to well production data in order to estimate ultimate recovery.

If you haven’t already done so, download R from http://www.r-project.org/ and install it.

# Aggregating a Daily Time Series to a Weekly Series

Posted by on Feb 14, 2011 | No Comments

Let’s say you have a daily series that you want to compare against a weekly series.  R provides a simply method to aggregate time series.  You will first need to load in the timeSeries package (after installing it).

 library("timeSeries") 

# Granger Causality Tests of Alberta Spot Electricity

Posted by on Feb 14, 2011 | No Comments

As given in “Quantitative and Empirical Analysis of Energy Markets” by Apostolos Serletis (page 108), a Granger Causality test can be run on a linear model as follows…