member eric.ward image

eric.ward

Real Name
Eric Ward

Bio
I currently work at the Northwest Fisheries Science Center (NOAA) in Seattle. I'm a quantitative ecologist, and am interested in a range of problems (population dynamics, extinction risk, conservation genetics, reproductive success). My recent modeling specific interests have been pursuing applications of mixture distributions, state-space models, hierarchical models, multilevel random effects models, and Bayesian model selection techniques. I'm particularly interested in using hierarchical models with variation at multiple levels (individuals, groups).


Projects


  • Bayes Factors (R)

    by eric.ward, last updated 6/5/07, sharing set to Public
    These routines allow you to take a matrix of MCMC samples and calculate the Bayes factor based on the harmonic mean algorithm proposed by Gelfand and Dey (1994). Caution: Bayes factors tend to be numerically unstable!
  • Bayesian MAR(1) model

    This set of Matlab scripts conducts a first order MAR(1) model to estimate interactive effects, and covariate effects, on a time series of data from a community.

    It uses a Gibbs sampler to estimate parameters, and currently is set up with diffuse priors on all parameters for the model. It is pretty basic at this point, but it works.

    Note on the Gamma distribution:

    Going back and forth between Matlab/R/WinBUGS can be confusing, because of the different parameterizations of the gamma pdf. Here's the Matlab/BUGS forms and the R equivalents:

    Matlab: X ~ g(a,b) E[X] = ab

    R equivalent: X ~ g(shape=a,scale=b)

    BUGS: X ~ g(a,b) E[X] = a/b

    R equivalent: X ~ g(shape=a,rate=b) OR

    X ~ g(shape=a,scale=1/b)

  • Catastrophes (WinBugs - OpenBugs - R)

    by eric.ward, last updated 6/6/07, sharing set to Public
    This is project involves estimating catastrophes in the presence of observation and process error. It was later expanded into a paper on fur seals (Ward et al. 2007, CJFAS). The model may be run in WinBugs / OpenBugs, or through R. The example has been made to be generic and includes some dummy data. The priors included have been simplified for demonstration purposes.
  • Data Cloning I: univariate

    by eric.ward, last updated 5/26/08, sharing set to Public
    This script writes and runs the data cloning procedure described by Lele et al. (2007, Ecology Letters). The routine is in R, and requires the user to install OpenBUGS before running. The number of clones can (and should) be modified. For this simple example, 100 clones takes ~ 2 minutes on my 2.5 year old laptop (1.66Ghz, 1GB RAM). More details and diagnostics can be found in the multivariate cloning project.
  • Estimating the number of species in a community

    This project is a simple example of how to estimate the number of species using the sequential broken stick (lognormal) model. References include MacArthur (1957), MacArthur and Wilson (1967), Sugihara (1980), Solow (1994). This method that a sample of individuals (m) is drawn from a community. The observed species in the sample (Nm) represent a sample of the true number of species (N). N may be estimated using ML or Bayesian techniques by integrating out uncertainty in the array of relative abundances (p).
  • Gibbs sampler for multiple linear regression

    by brice.semmens, last updated 7/5/08, sharing set to Public
    THE FOLLOWING FUNCTION CONDUCTS MULTIPLE LINEAR REGRESSION PARAMETER ESTIMATION VIA MCMC USING GIBBS SAMPLING.



    The point of this code is to show how to do it with a conjugate distribution such that the method can easily be plugged into LAMBDA.



    The function assumes that:

    1)the B coefficients are normally distributed ~N(prior_mean,prior_s2)and thus have a normal distribution prior. Large prior variances produce suitably "diffuse" priors

    2) the model variance is gamma distributed Ga(alpha, beta), with an associated prior. Small values of alpha and beta (<.001) produce a suitably "diffuse" prior. Note that Matlab's parameterization of their gamma function is a bit wonky compared to the standard. Basically, Matlab uses Ga(alpha,1/beta)-- ie. inverse of the standard scale parameter.

    The R code contains 2 versions of Bayesian linear regression. The first (univariate.all) uses the multivariate normal distribution to sample regression coefficients; the second (univariate.vat) does variable at a time sampling. Both R versions are nearly identical, allow a flexible range of priors for B, and allow the prior variance to be specified either as the shape-scale (e.g. gamma, scaled inv chi sq) or in terms of the mean-variance. Output includes saved parameter draws, which can be fed into CODA, and the calculation of the log(Bayes Factor) to be used for model selection.
  • MARSS Dev Site

    This is the DEVELOPMENT site for the MARSS.  For the current MARSS  release go to CRAN or download straight from the R GUI using "Install Packages" menu.

    MARSS fits mulitvariate autoregressive state-space (MARSS) models with Gaussian errors to multivariate time series data.  A MARSS model is:

    x(t) = B(t) x(t-1) + u(t) + C(t)c(t) + v(t), v(t)~MVN(0,Q)

    y(t) = Z(t) x(t) + a(t) + D(t)d(t) + w(t), w(t)~MVN(0,R)

    Project news (Feb 26, 2013): MARSS 3.4 uploaded to CRAN.  I fixed MARSSkfas to work with the new KFAS package in order to use the Koopman/Durbin filter/smoother algorithms. I also coded up a lag-one covariance smoother using an augmented state-space model that you can then run through the smoother to get the lag-one covariances.  I added a coef() and residuals() method to improve output.

    Developers: Eli Holmes, Eric Ward, Mark Scheuerell and Kellie Wills

    Current known issues:

    • When variance is "unconstrained", the covariances can be set to 0 in the degen.test() and this leads to not pos-def matrix and error.  Need to block setting to 0 when this happens, or block covariances set to zero?  Currently, deal with this by setting allow.degen=FALSE when covariances are estimated.
    • demean.states=TRUE is causing the EM algorithm to give drops in logLik. This is not really a bug but perhaps a property of demean.states.  Removed the demean.states option in vrs 3.3.

    MARSS 4.0 in progress:

    • 4.0 involves a substantial change in the model object structure---however the user should not notice the difference.  The change allows the developers to more easily code up new model structures. 
    • Progress continues on writing functions for standard output, e.g. predict function added. 
    • Integration with LateX begun so that output can be sent to a tex or pdf file instead of just the console.

     

  • MixBUGS

    by eric.ward, last updated 8/17/08, sharing set to Public
    This code is written to match the MCMC package SIAR in R. Two versions are included, 1 with no residual error, and 1 that models the variation as a mixture of residual + source variance.
  • MixBUGS

    by eric.ward, last updated 8/17/08, sharing set to Public
    This code is written to match the MCMC package SIAR in R. Two versions are included, 1 with no residual error, and 1 that models the variation as a mixture of residual + source variance.
  • Random Library (Java)

    by eric.ward, last updated 6/6/07, sharing set to Public
    These files are a collection of Java functions I've written to calculate PDFs/log likelihoods, and to do a variety of random number generator. You can use the built in Java random number generator, but I chose to link these files to the free RngPack library.

Collaborators


Sculpin 0.2 | xhtml | problems or comments? | report bugs