Projects found

Projects for bayesian:

1-4 of 4 shown   (1 visible only to FishBox members, 1 visible only to project members).    

  • 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)

  • DARTER (Diffusion Approximation Tools for Extinction Risk Estimation)

    This program allows one to walk through the steps required to conduct a population viability analysis, or PVA, using a population time time series. The model outputs probabilities of extinction as a function of time steps into the future, and importantly, gives confidence intervals for these probabilities.

    This tool has two major advantages over traditional PVA techniques:

    1) It uses a state-space Kalman filter that allows for both process and non-process error.

    So what's the big deal? --Functionally it filters the data, and allows a more accurate fit for population parameters of interest.2) It uses a Bayesian sampling-importance-resampling algorithm to fully address uncertainty in the parameter estimates given the data.Rather than developing a single function that describes the probability of population extinction through time, we can use the uncertainty in parameter estimates to develop 'probabilities of probabilities', or, the uncertainty surrounding the probability of extinction through time.

  • Gibbs sampler for multiple linear regression

    by brice.semmens, last updated 7/5/08, sharing set to public

    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.
  • Hierarchical linear model of MPA effects

    by brice.semmens, last updated 2/5/08, sharing set to public
    These are a series of Matlab routines to carry out a hierarchical linear model of fish population trajectories that includes a linear adjustment for a "reserve effect" at sites designated as MPAs. %The model is set up as follows: %FIRST LEVEL------------------------------------------------------------------------------------------------------- %MODEL:***** y~ intercept + abundance_index * (S_g + R_t +R_nt) + error *** %where: %S_g is the slope for a given species in a given geographic region (drawn %from a normally distributed species specific hyperparameter) %R_t is a species specific additive adjustment to the slope that is drawn %from a normally distributed hyper parameter representing the reserve effect on harvested species. Activated by a dummy variable. %R_nt is the species specific additive adjustment to the slope that is drawn from a normally distributed hyper parameter %representing the reserve effect on non-harvested species. Activated by a dummy variable. %both intercept and error terms are nuisance parameters and do not need hyperparameters. I suppose you could put in an %error hyper parameter with an informative prior just to keep the model in check. %SECOND LEVEL (hyper parameters all normally distributed)----------------------------------------------------------- %S_g_hat -- These are slopes for a given species from which S_g's are drawn %R_t_hat -- This is the reserve effect for targeted species from which R_t's across targeted species are drawn %R_nt_hat -- This is the reserve effect for non-targed species from which %R_nt's across non-targeted species are drawn %--------------------------------------------------------------------------------------------------------------------------

Projects for bayesian:

1-4 of 4 shown   (1 visible only to FishBox members, 1 visible only to project members).    

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