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
Y_i \sim \left\{ \begin{array}{l} | |
0, \text{with probability } (1-\psi) \\ | |
\text{Poisson}(\mu), \text{with probability } \psi | |
\end{array} \right. |
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 numpy as np | |
import pymc | |
import pdb | |
def unconditionalProbability(Ptrans): | |
"""Compute the unconditional probability for the states of a | |
Markov chain.""" | |
m = Ptrans.shape[0] |
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
=CONCATENATE(YEAR(F2), "-", IF(LEN(MONTH(F2))<2, "0",), MONTH(F2), "-", IF(LEN(DAY(F2))<2, "0",), DAY(F2)) |
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
\,{\buildrel d \over =}\, |
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
rtpois <- function(N, lambda, k) qpois(runif(N, ppois(k, lambda), 1), lambda) |
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
as.numeric(levels(f))[f] |
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 hierarchical linear model of price as a function of age. | |
""" | |
from pymc import * | |
from numpy import array | |
# Data | |
age = array([13, 14, 14,12, 9, 15, 10, 14, 9, 14, 13, 12, 9, 10, 15, 11, 15, 11, 7, 13, 13, 10, 9, 6, 11, 15, 13, 10, 9, 9, 15, 14, 14, 10, 14, 11, 13, 14, 10]) | |
price = array([2950, 2300, 3900, 2800, 5000, 2999, 3950, 2995, 4500, 2800, 1990, 3500, 5100, 3900, 2900, 4950, 2000, 3400, 8999, 4000, 2950, 3250, 3950, 4600, 4500, 1600, 3900, 4200, 6500, 3500, 2999, 2600, 3250, 2500, 2400, 3990, 4600, 450,4700])/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
Title: MultiMarkdown Document | |
Subtitle: Adventures in MultiMarkdown | |
Author: ${TM_FULLNAME} | |
Affiliation: ${TM_ORGANIZATION_NAME} | |
Email: ${TM_EMAIL} | |
Web: ${TM_URL} | |
Date: ${TM_DATE} | |
Copyright: ${TM_YEAR} ${TM_ORGANIZATION_NAME} | |
This work is licensed under a Creative Commons License. | |
http://creativecommons.org/licenses/by-nc-sa/3.0/ |
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
missing = -999 | |
filled_data = [(x, missing)[x is ''] for x in raw_data] |
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
#!/usr/bin/env python | |
""" | |
zip.py | |
Zero-inflated Poisson example using simulated data. | |
Created by Chris Fonnesbeck on 2008-06-06. | |
Distributed under the MIT license: http://www.opensource.org/licenses/mit-license.php | |
""" |
OlderNewer