From e9f9d457790b87f76af9e8d31ece98d19ebba49e Mon Sep 17 00:00:00 2001 From: gregorylburgess Date: Tue, 23 Feb 2016 12:35:00 -1000 Subject: [PATCH] Added a bunch of .md files for the filesystem. .md files are scraped from the admb-examples webpage. --- admb-tricks/adjoint-code-1/adjoint-code-1.md | 19 + admb-tricks/admb-tricks.md | 31 + admb-tricks/admb-tricks.md~ | 31 + .../covariance-calculations.md | 19 + .../covariance-matrices.md | 37 + .../parameterization/parameterization.md | 13 + admb-tricks/splines-1/splines-1.md | 13 + admb-tricks/splines-1/splines/splines.md | 31 + .../variance-calculations.md | 3 + .../variance-in-re-models.md | 61 + .../by-field-of-application.md | 14 + .../copy_of_medical-biometrics.md | 20 + .../medical-biometrics/medical-biometrics.md | 22 + .../stochastic-volatility-collection.md | 21 + .../sv-models-with-leverage-effect.md | 81 ++ .../modeller.md | 63 + ...-basic-sv-model-and-simple-extensions-1.md | 63 + categorical-data/categorical-data.md | 15 + ...ry-irt-and-the-multilevel-rasch-model-1.md | 88 ++ .../ordered-categorical-responses.md | 29 + copy_of_new-examples.md | 87 ++ copy_of_new-examples3849.md | 37 + copy_of_new-examples51a2.md | 87 ++ copy_of_new-examples8c63.md | 84 ++ copy_of_new-examples9f54.md | 37 + copy_of_new-examplesa891.md | 93 ++ .../differential-equations.md | 15 + .../mineralization-of-terbuthylazine.md | 20 + .../one-compartment-open-model.md | 32 + differential-equations/pk-dk/pk-dk.md | 27 + ...ranov-catch-equation-using-adjoint-code.md | 13 + .../baranov-catch-equation.md | 15 + ...a-fisheries-model-with-random-effects-1.md | 11 + fisheries/fisheries.md | 28 + fisheries/pella-t/pella-t.md | 15 + fisheries/pella/pella.md | 21 + .../function-minimization.md | 13 + .../parameter-scaling/parameter-scaling.md | 44 + ...ete-valued-time-series-model-polio-data.md | 43 + .../a-discrete-valued-time-series-model.md | 43 + .../count-data/citations.md | 50 + .../count-data/count-data.md | 29 + .../flexible-negative-binomial-model.md | 14 + .../flexible-negative-binomial.md | 3 + .../negative-binomial-fir-fecundity-1.md | 23 + ...ive-binomial-serially-correlated-counts.md | 29 + .../count-data/owl-nestling-negotiation.md | 17 + .../gams-as-mixed-models.md | 26 + .../generalized-additive-models.md | 31 + .../mean-and-variance/mean-and-variance.md | 26 + .../wood-2006-parameterization.md | 18 + .../bcb-bowheads/bcb-bowheads.md | 41 + .../gaussian-models/gaussian-models.md | 13 + .../glmm-generalized-linear-mixed-models.md | 27 + .../diet-and-heart-disease.md | 39 + .../mixed-response/mixed-response.md | 13 + .../beta-binomial-model.md | 9 + .../non-gaussian-random-effects.md | 17 + .../wildflowers.md | 21 + growth-models/citations.md | 26 + .../extension-correlated-res.md | 10 + .../extension-crossed-res.md | 16 + growth-models/orange-trees/orange-trees.md | 40 + growth-models/orange-trees/orange/orange.md | 58 + html_files.txt | 211 ++-- html_files.txt~ | 109 +- index.md | 27 + .../cjs-individual-heterogeneity-1.md | 19 + .../cormack-jolly-seber-models.md | 17 + ...-to-capture-recapture-data-using-r2admb.md | 20 + .../mark-recapture-random-effects-model.md | 183 +++ mark-recapture/mark-recapture.md | 14 + markdownify.py | 3 + markdownify.py~ | 9 + miscellaneous/miscellaneous.md | 17 + miscellaneous/nceas-working-group-examples.md | 16 + miscellaneous/otter-reseach-collection.md | 69 ++ new-examples/new-examples.md | 11 + parse_html.py | 49 + parse_html.py~ | 49 + ...neral-r-admb-interface-for-mixed-models.md | 29 + ...ma-distributed-myxomatosis-using-r2admb.md | 22 + r-stuff/glmmadmb.md | 9 + r-stuff/lmer-comparison/lmer-comparison.md | 80 ++ r-stuff/mcmcmc/mcmcmc.md | 40 + r-stuff/r-stuff.md | 23 + .../estimation-of-detection-function.md | 21 + .../line-transect-methods.md | 17 + .../line-transect-methods/random-scale.md | 52 + sampling/sampling.md | 13 + simple-examples/simple-examples.md | 11 + ...tadpole-mortality-as-a-function-of-size.md | 23 + ...scribed-in-terms-of-covariance-function.md | 42 + .../glmm2019s-on-large-spatial-grids.md | 5 + ...-model-for-the-scottish-lip-cancer-data.md | 49 + .../separable-different-implementation.md | 48 + spatial-models/spatial-models.md | 17 + .../the-geostatistical-approach.md | 143 +++ .../a-discrete-valued-time-series-model.md | 27 + state-space-models/citations.md | 34 + .../delta-smelt-life-cycle-model.md | 19 + ...te-mortality-bayesian-state-space-model.md | 25 + state-space-models/state-space-models.md | 27 + ...tility-models-for-financial-time-series.md | 40 + .../theta-logistic-population-growth-model.md | 18 + storage/storage.md | 11 + survival-analysis/survival-analysis.md | 12 + .../weibull-regression-with-censoring.md | 22 + test.txt | 560 +++++++++ test.txt~ | 1079 +++++++++++++++++ ...er-2008-ecological-models-and-data-in-r.md | 16 + ...imation-and-inference-by-russell-millar.md | 8 + text-books/text-books.md | 14 + uploading-examples-to-github.md | 7 + winbugs/occupancy-model.md | 31 + winbugs/winbugs.md | 13 + 116 files changed, 5249 insertions(+), 216 deletions(-) create mode 100644 admb-tricks/adjoint-code-1/adjoint-code-1.md create mode 100644 admb-tricks/admb-tricks.md create mode 100644 admb-tricks/admb-tricks.md~ create mode 100644 admb-tricks/covariance-calculations/covariance-calculations.md create mode 100644 admb-tricks/parameterization/covariance-matrices/covariance-matrices.md create mode 100644 admb-tricks/parameterization/parameterization.md create mode 100644 admb-tricks/splines-1/splines-1.md create mode 100644 admb-tricks/splines-1/splines/splines.md create mode 100644 admb-tricks/variance-calculations/variance-calculations.md create mode 100644 admb-tricks/variance-calculations/variance-in-re-models/variance-in-re-models.md create mode 100644 by-field-of-application/by-field-of-application.md create mode 100644 by-field-of-application/copy_of_medical-biometrics/copy_of_medical-biometrics.md create mode 100644 by-field-of-application/medical-biometrics/medical-biometrics.md create mode 100644 by-field-of-application/stochastic-volatility-collection/stochastic-volatility-collection.md create mode 100644 by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.md create mode 100644 by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.md create mode 100644 by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/the-basic-sv-model-and-simple-extensions-1.md create mode 100644 categorical-data/categorical-data.md create mode 100644 categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1/item-response-theory-irt-and-the-multilevel-rasch-model-1.md create mode 100644 categorical-data/ordered-categorical-responses/ordered-categorical-responses.md create mode 100644 copy_of_new-examples.md create mode 100644 copy_of_new-examples3849.md create mode 100644 copy_of_new-examples51a2.md create mode 100644 copy_of_new-examples8c63.md create mode 100644 copy_of_new-examples9f54.md create mode 100644 copy_of_new-examplesa891.md create mode 100644 differential-equations/differential-equations.md create mode 100644 differential-equations/mineralization-of-terbuthylazine.md create mode 100644 differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model.md create mode 100644 differential-equations/pk-dk/pk-dk.md create mode 100644 fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.md create mode 100644 fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.md create mode 100644 fisheries/a-fisheries-model-with-random-effects-1.md create mode 100644 fisheries/fisheries.md create mode 100644 fisheries/pella-t/pella-t.md create mode 100644 fisheries/pella/pella.md create mode 100644 function-minimization/function-minimization.md create mode 100644 function-minimization/parameter-scaling/parameter-scaling.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/citations.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/count-data.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.md create mode 100644 glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.md create mode 100644 glmm-generalized-linear-mixed-models/gams-as-mixed-models/gams-as-mixed-models.md create mode 100644 glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models.md create mode 100644 glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance.md create mode 100644 glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization.md create mode 100644 glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads.md create mode 100644 glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models.md create mode 100644 glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models.md create mode 100644 glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease.md create mode 100644 glmm-generalized-linear-mixed-models/mixed-response/mixed-response.md create mode 100644 glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model.md create mode 100644 glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects.md create mode 100644 glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.md create mode 100644 growth-models/citations.md create mode 100644 growth-models/orange-trees/extension-correlated-res/extension-correlated-res.md create mode 100644 growth-models/orange-trees/extension-crossed-res/extension-crossed-res.md create mode 100644 growth-models/orange-trees/orange-trees.md create mode 100644 growth-models/orange-trees/orange/orange.md create mode 100644 index.md create mode 100644 mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.md create mode 100644 mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models.md create mode 100644 mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.md create mode 100644 mark-recapture/mark-recapture-random-effects-model.md create mode 100644 mark-recapture/mark-recapture.md create mode 100644 markdownify.py create mode 100644 markdownify.py~ create mode 100644 miscellaneous/miscellaneous.md create mode 100644 miscellaneous/nceas-working-group-examples.md create mode 100644 miscellaneous/otter-reseach-collection.md create mode 100644 new-examples/new-examples.md create mode 100644 parse_html.py create mode 100644 parse_html.py~ create mode 100644 r-stuff/a-general-r-admb-interface-for-mixed-models/a-general-r-admb-interface-for-mixed-models.md create mode 100644 r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb.md create mode 100644 r-stuff/glmmadmb.md create mode 100644 r-stuff/lmer-comparison/lmer-comparison.md create mode 100644 r-stuff/mcmcmc/mcmcmc.md create mode 100644 r-stuff/r-stuff.md create mode 100644 sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.md create mode 100644 sampling/line-transect-methods/line-transect-methods.md create mode 100644 sampling/line-transect-methods/random-scale.md create mode 100644 sampling/sampling.md create mode 100644 simple-examples/simple-examples.md create mode 100644 simple-examples/tadpole-mortality-as-a-function-of-size.md create mode 100644 spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function.md create mode 100644 spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids.md create mode 100644 spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data.md create mode 100644 spatial-models/separable-different-implementation/separable-different-implementation.md create mode 100644 spatial-models/spatial-models.md create mode 100644 spatial-models/the-geostatistical-approach/the-geostatistical-approach.md create mode 100644 state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md create mode 100644 state-space-models/citations.md create mode 100644 state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.md create mode 100644 state-space-models/skate-mortality-bayesian-state-space-model.md create mode 100644 state-space-models/state-space-models.md create mode 100644 state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series.md create mode 100644 state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.md create mode 100644 storage/storage.md create mode 100644 survival-analysis/survival-analysis.md create mode 100644 survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring.md create mode 100644 test.txt create mode 100644 test.txt~ create mode 100644 text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r.md create mode 100644 text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.md create mode 100644 text-books/text-books.md create mode 100644 uploading-examples-to-github.md create mode 100644 winbugs/occupancy-model.md create mode 100644 winbugs/winbugs.md diff --git a/admb-tricks/adjoint-code-1/adjoint-code-1.md b/admb-tricks/adjoint-code-1/adjoint-code-1.md new file mode 100644 index 0000000..2d76ecf --- /dev/null +++ b/admb-tricks/adjoint-code-1/adjoint-code-1.md @@ -0,0 +1,19 @@ +

+ Adjoint code +

+

Why to write adjoint code?

+

When you write code for variable objects in ADMB, all the derivatives are calculated for you. To accomplish this, ADMB must save derivative information for variable objects, which can take a lot of memory and be time consuming for functions that are called many times. The purpose of writing adjoint code is to reduce the amount of derivative information that must be calculated and stored in order to speed up the process. 

+

Approach for simple functions

+

Chapter 13 of the ADMB manual describes how to write and debug adjoint code for simple functions that take between 1 and 4 independent variables. The .tpl files are included below.

+

1 independent variable

+

2 independent variables

+

4 independent variables 

+

Structured approach for more complex functions

+

For more complicated functions the previous approach becomes untenable and a more structured approach to calculate the derivatives is taken in the following example. Notice that to calculate the derivatives, every line of code in the function is repeated in the opposite order and the corresponding derivatives are calculated.

+

4 independent variables with structured calculation of derivatives 

+

General adjoint code

+

In the previous examples the adjoint code has been used for a simple function which has from 1 to 4 independent variables. When functions can take any number of independent variables and return any number of dependent variables a more general approach is required. Steve Martell provided an example of writing adjoint code to numerically solve the Baranov catch equation and both its .tpl and its documentation are included below.

+

Baranov example documentation

+

Baranov example

+

 

+
\ No newline at end of file diff --git a/admb-tricks/admb-tricks.md b/admb-tricks/admb-tricks.md new file mode 100644 index 0000000..7d723f8 --- /dev/null +++ b/admb-tricks/admb-tricks.md @@ -0,0 +1,31 @@ +# admb-tricks + +[Math][7] +Various undocumented techniques and tricks useful for developing ADMB programs + +[Adjoint code][1] +: Why to write adjoint code and alternative approaches to do it. + +[Parameterization][2] +: Examples of how to (and not to) parameterize mathematical functions and statistical models + +[Splines][3] +: Different aspects of spline models + +[Variance calculations][4] +: How variance is calculated in ADMB + +[Covariance Calculations][5] +: A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. + +Document Actions + +* [RSS feed][6] + +[1]: admb-tricks/adjoint-code-1 +[2]: admb-tricks/parameterization +[3]: admb-tricks/splines-1 +[4]: admb-tricks/variance-calculations +[5]: admb-tricks/covariance-calculations +[6]: admb-tricks/RSS "" +[7]: admb-tricks/math diff --git a/admb-tricks/admb-tricks.md~ b/admb-tricks/admb-tricks.md~ new file mode 100644 index 0000000..7d723f8 --- /dev/null +++ b/admb-tricks/admb-tricks.md~ @@ -0,0 +1,31 @@ +# admb-tricks + +[Math][7] +Various undocumented techniques and tricks useful for developing ADMB programs + +[Adjoint code][1] +: Why to write adjoint code and alternative approaches to do it. + +[Parameterization][2] +: Examples of how to (and not to) parameterize mathematical functions and statistical models + +[Splines][3] +: Different aspects of spline models + +[Variance calculations][4] +: How variance is calculated in ADMB + +[Covariance Calculations][5] +: A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. + +Document Actions + +* [RSS feed][6] + +[1]: admb-tricks/adjoint-code-1 +[2]: admb-tricks/parameterization +[3]: admb-tricks/splines-1 +[4]: admb-tricks/variance-calculations +[5]: admb-tricks/covariance-calculations +[6]: admb-tricks/RSS "" +[7]: admb-tricks/math diff --git a/admb-tricks/covariance-calculations/covariance-calculations.md b/admb-tricks/covariance-calculations/covariance-calculations.md new file mode 100644 index 0000000..818d562 --- /dev/null +++ b/admb-tricks/covariance-calculations/covariance-calculations.md @@ -0,0 +1,19 @@ +# Covariance Calculations + +A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. + +![File][1] [Covariance Calculations][2] +: A document detailing the calculations used internally for calculating the covariance matrix with bounded parameters. + +![File][3] [R code to interact with admodel.cov][4] +: R code for reproducing the covariance calculations and manipulating the admodel.cov file. + +Document Actions + +* [RSS feed][5] + +[1]: http://www.admb-project.org/pdf.png +[2]: covariance-calculations/covariance-calculations/view.html +[3]: http://www.admb-project.org/application.png +[4]: covariance-calculations/r-code-to-interact-with-admodel.cov/view.html +[5]: covariance-calculations/RSS "" diff --git a/admb-tricks/parameterization/covariance-matrices/covariance-matrices.md b/admb-tricks/parameterization/covariance-matrices/covariance-matrices.md new file mode 100644 index 0000000..c7f36ac --- /dev/null +++ b/admb-tricks/parameterization/covariance-matrices/covariance-matrices.md @@ -0,0 +1,37 @@ +# Covariance matrices + +Parameterization via the Cholesky factor (Incomplete example) + +If you want to estimate the parameters of a covariance matrix S you must ensure that the resulting matrix is 1) symmetric and 2) positive definite. To achieve this you do not parameterize S directly, but rather its Cholesky factor L, i.e. S = LL', see + +  + +  + +The following two step procedure is recommended: + +1) Parameterize the correlation matrix C via the Cholesky factor as explained here + +[Correlation matrix][1] + +2) Scale C with the standard deviations to obtained S. + +  + +Complete example given in C.tpl and C.dat. + +  + +**Constrained covariance matrices** + +Sometimes you want elements in the C (or S) to be zero, say S(1,2) = 0, meaning the element 1 and 2 are uncorrelated. An example of how to achieve this is provided here: + +[constrained_cor.tpl][2] + +[constrained_cor.dat][3] + +  + +[1]: covariance-matrices/correlation matrix.pdf "Correlation matrix" +[2]: covariance-matrices/constrained_cor.tpl "constrained_cor.tpl" +[3]: covariance-matrices/constrained_cor.dat "constrained_cor.dat" diff --git a/admb-tricks/parameterization/parameterization.md b/admb-tricks/parameterization/parameterization.md new file mode 100644 index 0000000..2e64e72 --- /dev/null +++ b/admb-tricks/parameterization/parameterization.md @@ -0,0 +1,13 @@ +# Parameterization + +Examples of how to (and not to) parameterize mathematical functions and statistical models + +[Covariance matrices][1] +: How to parameterize a covariance matrix + +Document Actions + +* [RSS feed][2] + +[1]: parameterization/covariance-matrices.html +[2]: parameterization/RSS "" diff --git a/admb-tricks/splines-1/splines-1.md b/admb-tricks/splines-1/splines-1.md new file mode 100644 index 0000000..b182450 --- /dev/null +++ b/admb-tricks/splines-1/splines-1.md @@ -0,0 +1,13 @@ +# Splines + +Different aspects of spline models + +[Splines I][1] +: notes and examples related to cubic splines + +Document Actions + +* [RSS feed][2] + +[1]: splines-1/splines.html +[2]: splines-1/RSS "" diff --git a/admb-tricks/splines-1/splines/splines.md b/admb-tricks/splines-1/splines/splines.md new file mode 100644 index 0000000..918f915 --- /dev/null +++ b/admb-tricks/splines-1/splines/splines.md @@ -0,0 +1,31 @@ +# Splines I + +Filed under: [Splines][1] + +notes and examples related to cubic splines + +![File text/x-perl][2] [splines.tpl][3] +: ADMB code with a spline (very rough) + +![File PDF document][4] [Example results][5] +: notes: grey lines are from MCMC samples, third derivative looks rough only because of numerical precision + +![File chemical/x-mopac-input][6] [splines.dat][7] +: data file to go with the model in splines.tpl + +![File][2] [R code][8] +: read output from splines model and plot results shown in spline_example.pdf + +Document Actions + +* [RSS feed][9] + +[1]: http://www.admb-project.org/@@search?Subject:list=Splines +[2]: http://www.admb-project.org/application.png +[3]: splines/splines.tpl/view.html +[4]: http://www.admb-project.org/pdf.png +[5]: splines/spline_example.pdf/view.html +[6]: http://www.admb-project.org/unknown.png +[7]: splines/splines.dat/view.html +[8]: splines/splines_code.R/view.html +[9]: splines/RSS "" diff --git a/admb-tricks/variance-calculations/variance-calculations.md b/admb-tricks/variance-calculations/variance-calculations.md new file mode 100644 index 0000000..51480f6 --- /dev/null +++ b/admb-tricks/variance-calculations/variance-calculations.md @@ -0,0 +1,3 @@ +

+ Variance calculations +

None \ No newline at end of file diff --git a/admb-tricks/variance-calculations/variance-in-re-models/variance-in-re-models.md b/admb-tricks/variance-calculations/variance-in-re-models/variance-in-re-models.md new file mode 100644 index 0000000..299bf17 --- /dev/null +++ b/admb-tricks/variance-calculations/variance-in-re-models/variance-in-re-models.md @@ -0,0 +1,61 @@ +

+ Covariance in RE models +

+

In RE (random effects) models there are two types of parameters, x (parameter in the ordinary sense) and u (random effect). This documents tries to shed some light on how the variance of x and u are calculated. The covariance matrix of the x vector is based on the (marginal) likelihood, obtained via the Laplace approximation, and corresponds to the way covariance matrices are calculated in non-RE models in ADMB.

+

 

+

Theory

+

Here is what the user manual says about the variance of u (the manual talks about "theta" instead of "x"): usermanual.pdf A few words can be added to this.

+

 

+

The formula is based on the Law of total variance: http://en.wikipedia.org/wiki/Law_of_total_variance

+

In our context this says: 

+

  Var(u) = Ex[var(u|x)] + varx(E(u|theta)

+

The expectation "Ex" is obtained simply by inserting the point estimate of x into "var(u|x)". The second term is based on the "delta method" which is used elsewhere in ADMB, in combination with the covariance matrix of x (described above). Everything in these calculations are conditional on "data".

+

 

+

 

+

 

+

Example: simple hierarchical model

+

Consider the following simple Gaussian hierarchical model:

+
 Prior on x: x = e1
+   u|x: u = x + e2
+   y|u: y = u + e3
+				// where e1, e2, e3 are all distributed N(0,1)
+

R code for the covariance matrix

+
S = matrix(0,3,3,row=c("x","u","y"),col=c("x","u","y"))
+S[,]=1
+S[2:3,2:3]=2
+S[3,3]=3
+S12_3 = S[1:2,1:2] - S[1:2,3]%*%solve(S[3,3])%*%S[3,1:2]
+
We are interested in the conditional variance of x and u given data (y).
+
> sqrt(diag(S12_3))
+        x         u 
+0.8164966 0.8164966 
+> cov2cor(S12_3)
+    x   u
+x 1.0 0.5
+u 0.5 1.0
+
 
+
Corresponding quantities in ADMB
+
An implementation of this model in ADMB is:
+
 DATA_SECTION
+   number y
+   !! y=10.0;
+PARAMETER_SECTION
+   init_number x
+   random_effects_vector u(1,1)
+   objective_function_value f
+PROCEDURE_SECTION
+   f = 0.0;
+   f -= -0.5*square(x);	 	// Prior on x: x = e1
+   f -= -0.5*square(u(1)-x);    // u|x: u = x + e2
+   f -= -0.5*square(y-u(1));    // y|u: y = u + e3
+				// where e1, e2, e3 are all distributed N(0,1); standard normal
+GLOBALS_SECTION
+  #include "getbigs.cpp"
+

NOTE: as of Nov 29 2012 you need to include "getbigs.cpp" due to a recently discovered bug in ADMB.

+

The result you get when you run ADMB matches those from R:

+
D:\tmp\tmp>more simple_variance.cor
+ The logarithm of the determinant of the hessian = 0.405465
+ index   name    value      std dev       1
+     1   x 3.3335e+000 8.1650e-001   1.0000
+     2   u 6.6668e+000 8.1650e-001   0.5000  1.0000
+
\ No newline at end of file diff --git a/by-field-of-application/by-field-of-application.md b/by-field-of-application/by-field-of-application.md new file mode 100644 index 0000000..52bf382 --- /dev/null +++ b/by-field-of-application/by-field-of-application.md @@ -0,0 +1,14 @@ +# By field of application + +[Medical/Biometrics][1] +[Stochastic volatility collection][2] +[Ecology][3] + +Document Actions + +* [RSS feed][4] + +[1]: by-field-of-application/medical-biometrics.html +[2]: by-field-of-application/stochastic-volatility-collection.html +[3]: by-field-of-application/copy_of_medical-biometrics.html +[4]: by-field-of-application/RSS "" diff --git a/by-field-of-application/copy_of_medical-biometrics/copy_of_medical-biometrics.md b/by-field-of-application/copy_of_medical-biometrics/copy_of_medical-biometrics.md new file mode 100644 index 0000000..cfd7c3c --- /dev/null +++ b/by-field-of-application/copy_of_medical-biometrics/copy_of_medical-biometrics.md @@ -0,0 +1,20 @@ +# Ecology + +[Mark-Recapture random effects model][1] +[Estimation of detection function ][2] +: Illustrates the likelihood based estimation of the detection function (perpendicular distance) in line transect surveys + +[Delta smelt life cycle model ][3] +: A state-space multistage model to evaluate population impacts in the presence of density dependence + +[Theta-logistic population growth model][4] + +Document Actions + +* [RSS feed][5] + +[1]: ../mark-recapture/mark-recapture-random-effects-model.html +[2]: ../sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.html +[3]: ../state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.html +[4]: ../state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.html +[5]: copy_of_medical-biometrics/RSS "" diff --git a/by-field-of-application/medical-biometrics/medical-biometrics.md b/by-field-of-application/medical-biometrics/medical-biometrics.md new file mode 100644 index 0000000..2380d34 --- /dev/null +++ b/by-field-of-application/medical-biometrics/medical-biometrics.md @@ -0,0 +1,22 @@ +# Medical/Biometrics + +[A discrete valued time series model; Polio data][1] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A time series of Poisson counts; Polio data][2] +: A serially correlated time series of Poisson counts using a GLMM framework + +[A discrete valued time series model; Polio data][3] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[Weibull regression with censoring][4] + +Document Actions + +* [RSS feed][5] + +[1]: ../state-space-models/a-discrete-valued-time-series-model.html +[2]: ../glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.html +[3]: ../glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model.html +[4]: ../survival-analysis/weibull-regression-with-censoring.html +[5]: medical-biometrics/RSS "" diff --git a/by-field-of-application/stochastic-volatility-collection/stochastic-volatility-collection.md b/by-field-of-application/stochastic-volatility-collection/stochastic-volatility-collection.md new file mode 100644 index 0000000..1bdbe07 --- /dev/null +++ b/by-field-of-application/stochastic-volatility-collection/stochastic-volatility-collection.md @@ -0,0 +1,21 @@ +# Stochastic volatility models + +Stochastic volatility models are used to model financial time series with time-varying volatility. + +An important property of financial time series is that volatility, defined as the standard deviation of log-returns, is time-varying. There are two types of models used for analyzing time series with varying volatility: GARCH models and stochastic volatility (SV) models. In GARCH models the conditional volatility is a deterministic function of previous returns and volatilities, while in SV-models volatility is assumed to follow a latent stochastic process. Although SV-models have favorable properties compared to GARCH, they are less used in practice. The reason for this is that they are much harder to fit. The problem is that due to non-linear dependence between returns and latent volatilities, it is not possible to find a closed form expression for the likelihood function for SV models. Much work has been done to overcome this problem, but most approaches are either inefficient or hard to implement. Here it is shown how several SV-models can be easily fit to financial returns using ADMB-RE. + +1. [**The basic SV-model and simple extensions**.][1] In this section the basic SV-model is introduced, and it is shown how simple modifications can produce models that also can capture skewness and higher kurtosis than the basic model.  +2. [**SV-models with leverage effect**. ][2]We often see an increase in volatility after a drop in returns. This phenomenon is called leverage effect and seems to be particularly important for stocks. Leverage effect can be modeled by correlated noise terms in the retun and the volatility equations. Models with correlated noise terms have a more complicated structure, and are therefore treated in a separate section. + +  + +  + +  + +  + +  + +[1]: stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.html "The basic SV model and simple extensions" +[2]: stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.html "SV models with leverage effect" diff --git a/by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.md b/by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.md new file mode 100644 index 0000000..25d9bc7 --- /dev/null +++ b/by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.md @@ -0,0 +1,81 @@ +# SV models with leverage effect + +The leverage effect is the phenomenon that volatility tends to rise following a drop in returns. In SV models the leverage effect is modeled by letting the noise terms in the two equations be correlated. SV models with leverage effect can be written as:  + + +Xt = σX exp(ht/2)εt,      (1)   +ht 1 = ϕht σηt,          (2) + + +where the pairs (εt, ηt) are iid with E(εt) = E(ηt) = 0, Var(εt) = Var(ηt) = 1 and          corr(εt, ηt) = ρ. + +If ρ < 0, which is the standard case, a drop in returns at time t then tends to give increased volatility at time t 1. +Due to correlated noise terms, the structure in SV models with leverage effect is (slightly) more complicated than in the models without leverage effect. It is therefore also more difficult to find an expression for the joint density function, p(**X**, **h**|θ), in this case. +SV models on the form (1-2) can be represented graphically as: + + +![Fig_1][1] + +All paths to  Xt and ht 1 goes via/through ht, so the pair (Xt, ht 1) is conditionally independent of previous variables given ht. + +  + +This leads to the following expression for the joint density: + +p(X,h|θ) = p(h1|θ) Πp(Xt, ht 1|ht, θ) +This expression may be further simplified by factorizing p(Xt, ht 1|ht, θ). This can be done in two ways: +a. We can use that p(Xt, ht 1|ht, θ) = p(Xt|ht 1, ht, θ)p(ht 1|ht, θ) and write the joint density as p(X,h|θ) = p(h1|θ) Πp(Xt|ht 1, ht, θ)p(ht 1|ht, θ) +This is represented in the folowing graph  + + +![Fig_2][2] + +b. Alternatively we can use p(Xt, ht 1|ht, θ) = p(Xt|ht, θ)p(ht 1|Xt, ht, θ), which gives the following expression p(X,h|θ) = p(h1|θ) Πp(Xt|ht, θ)p(ht 1|Xt, ht, θ). The graphical representation for this form is given by + +![Fig_3][3] + + +The two forms should be equivalent, so it should in principle be possible to use both. However, as we shall see, it might be reasons to prefer one over the other. + + + +### **The Gaussian leverage model** + +In the Gaussian leverage model it is assumed that the pairs (εt, ηt) are iid bi-variate normally distributed, with standard normal marginals. This is the most popular leverage model and it is a discrete time version of models used in option pricing. + +Then  εt|ηt ̴ N(ρηt, 1-ρ2) and we can write εt =  ρηt sqrt(1-ρ2)wt  where wt is standard normal and ηt and wt are independent. Noting that ηt = (ht 1 – ϕht)/σ, the model can be written as: +Xt = σX exp(ht/2)ρ(ht 1 – ϕht)/σ σX exp(ht/2) sqrt(1-ρ2)wt, +ht 1 = ϕht σηt, +where wt and ηt are iid N(0,1). + +On this form we may use the formulation a) for the joint density function, and we see that +h1 ̴ N(0,σ2/(1-ϕ2)), ht 1|ht ̴ N(ϕht, σ2) and +Xt|ht 1, ht ̴ N(σXρ exp(ht/2) (ht 1 – ϕht)/σ, σX2 exp(ht) (1-ρ2)). Thus it is easy to find an expression for log p(**X**, **h**|θ) here. See [**sdv_lev_1.tpl][4]** for how this can be done. + +Alternatively we may use the other version. Noting that ηt|εt ̴ N(ρεt, 1-ρ2), we may write ηt =  ρεt sqrt(1-ρ2) vt, where vt ̴ N(0,1) and vt is independent of εt. Then, using that   εt = Xt exp(-ht/2)/σX, the model may be written as: +Xt = σX exp(ht/2)εt , +ht 1 = ϕht σρXt exp(-ht/2)/σX σ sqrt(1-ρ2) vt , +where εt and vt are iid N(0,1) by assumption. +Here it is seen that ht 1|(Xt, ht, θ) ̴ N(ϕht σρXt exp(-ht/2)/σX, σ2(1 - ρ2)) and +Xt|(ht,θ) ̴ N(0, σX2 exp(ht)), so we can easily find an expression for log p(**X**, **h**|θ), see [**sdv_lev_2.tpl][5]** for how this can be done. + +The two specifications for the Gaussian leverage model should give the same results. Comparing the par files [**sdv_lev_1.par][6]** and [**sdv_lev_2.par][7]**, we see that the results are practically identical, as they should. However, it seems that sdv_lev_1 runs somewhat faster and that the difference in run time is increasing in the size of the data set. This suggests that it might be preferable to use the parametrization given in sdv_lev_1, at least for large data sets. This version may be less intuitive than the other and is less commonly used, but it might actually be preferable because of the run time issue. + +**Leverage models with heavier tails and/or skewness** +The moments of returns in the Gaussian leverage model are the same as in the basic SV model. In order to model both leverage effect and heavier tails and/or skewness, the following specification is used: +Xt = σX exp(ht/2)εt , +ht 1 = ϕht σρXt exp(-ht/2)/σX σ sqrt(1-ρ2) vt, + +where vt ̴ N(0, 1)and εt has some standardized continuous distribution. This looks like the formulation used to set up sdv_lev2, but here εt is not necessarily normally distributed. In the SV_lev_t model a standardized t-distribution is used for εt. This not only gives heavier tails in the returns, but also some tail thickness in the volatility process. This might actually be a favorable property. In SV_lev_st  εt follows a skewed t-distribution, which captures skewness in returns, but also gives skewness in the volatility process. If εt has negative skewness and ρ also is negative, which is the usual case, then there is positive skewness in the volatility process. This seems like a reasonable property, since big positive "jumps" in volatility are more likely to occur than large negative ones. + +For models on this form ht 1|(Xt, ht, θ) ̴ N(ϕht σρXt exp(-ht/2)/σX, σ2(1 – ρ2)) no matter which distribution we choose for εt. When εt  is not normally distributed, the distribution of h1|θ is unknown, so strictly speaking we cannot find an exact expression for p(**X**,**h**|θ) here. However it is still the case that E[h1] = 0 and Var(h1) = σ2/(1-ϕ2), and by assuming that h1|θ ̴ N(0,σ2/(1-ϕ2)), we find an approximate expression for the joint density. Since p(h1|θ) is only a minor contributor to p(**X**,**h**|θ), the error is small. The distribution of Xt|ht depends on the distribution used for εt, as can be seen in the tpl-files, [**sdv_t_lev.tpl][8]** and [**sdv_st_lev.tpl][9]**. + +[1]: sv-models-with-leverage-effect/Figur_2.jpg/image_preview.jpg "Fig_1" +[2]: sv-models-with-leverage-effect/Figur_3.jpg/image_preview.jpg "Fig_2" +[3]: sv-models-with-leverage-effect/Figur_4.jpg/image_preview.jpg "Fig_3" +[4]: sv-models-with-leverage-effect/sdv_lev_1.tpl "sdv_lev_1.tpl" +[5]: sv-models-with-leverage-effect/sdv_lev_2.tpl "sdv_lev_2.tpl" +[6]: sv-models-with-leverage-effect/sdv_lev_1.par "sdv_lev_1.par" +[7]: sv-models-with-leverage-effect/sdv_lev_2.par "sdv_lev_2.par" +[8]: sv-models-with-leverage-effect/sdv_t_lev.tpl "sdv_t_lev.tpl" +[9]: sv-models-with-leverage-effect/sdv_st_lev.tpl "sdv_st_lev.tpl" diff --git a/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.md b/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.md new file mode 100644 index 0000000..e65bf44 --- /dev/null +++ b/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.md @@ -0,0 +1,63 @@ +# The basic SV model and simple extensions + +The basic SV model can be written as (alternative versions are also used): + +Xt = σX exp(ht/2) εt ,      (1) + +ht 1 = φht σηt ,          (2) + +where εt and ηt are iid standard normal, Xt is return and ht log-variance, both centralized, at time t.  + +  + +The model captures important properties of financial returns like volatility clustering and heavy tailed distribution of returns. Still, the basic model is not always able to fully capture the high kurtosis often found in practice. In the SV-t model a standardized t-distribution (with ν > 2 degrees of freedom), rather than a normal distribution, is used for  epsilon in (1). This allows for heavier tails in returns. In order to also model skewness, a skewed distribution can be chosen for epsilon. In the SV-st model a skewed t-distribution is used. This distribution has an extra parameter, lambda, compared to the t-distribution. When lambda is negative, the distribution is negatively skewed. + +  + +In order to fit the models to data using ADMB-RE we have to find an expression for the log of the joint density function for returns and latent variables, p(**X**,**h**|θ), where θ is a parameter vector. It is then useful to find a graphical representation for the models. This makes it easier to uncover the dependence structure in the models so that we may find simple expessions for the joint density functions. The SV models considered so far can be represented graphically as:  + +![Fig_1][1] + + +Note that: +\- Xt is separated from the other variables by ht. This implies that Xt is conditionally independent of all other variables given ht. +\- The only path to ht goes via ht-1. Then ht is conditionally independent og all previous variables given ht-1. + +These considerations leads to the folowing expression for the joint density: +p(**X**,**h**|θ) = p(h1|θ)prod p(ht 1|ht,θ) prod p(Xt|ht,θ). + +hT 1 is not strictly needed here, but will be needed in later models and is for consistency also included here. + +For the models considered so far h1~N(0,σ2/(1-ϕ2)) and ht 1|ht~N(ϕht, σ2), while the distribution of Xt|ht depends on the distribution used for εt.  + +It is then easy to specify log p(**X**, **h**|θ), see tpl files for how this can be done for the three models: + +> [sdv_plain.tpl][2] +> +> [sdv_t.tpl][3] +> +> [sdv_t_skw.tpl][4] + + +The par-files contain estimated parameters and volatilities. (Comments...) + +> [sdv_plain.par][5] +> +> [sdv_t.par][6] +> +> [sdv_t_skw.par][7] + +  + +  + + + + +[1]: Figur_1.jpg/image_preview.jpg "Fig_1" +[2]: sdv_plain.tpl "sdv_plain.tpl" +[3]: sdv_t.tpl "sdv_t.tpl" +[4]: sdv_t_skw.tpl "sdv_t_skw.tpl" +[5]: sdv_plain.par "sdv_plain.par" +[6]: sdv_t.par "sdv_t.par" +[7]: sdv_t_skw.par "sdv_t_skw.par" diff --git a/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/the-basic-sv-model-and-simple-extensions-1.md b/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/the-basic-sv-model-and-simple-extensions-1.md new file mode 100644 index 0000000..30ee8b1 --- /dev/null +++ b/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/the-basic-sv-model-and-simple-extensions-1.md @@ -0,0 +1,63 @@ +# The basic SV model and simple extensions + +The basic SV model can be written as (alternative versions are also used): + +Xt = σX exp(ht/2) εt ,      (1) + +ht 1 = φht σηt ,          (2) + +where εt and ηt are iid standard normal, Xt is return and ht log-variance, both centralized, at time t.  + +  + +The model captures important properties of financial returns like volatility clustering and heavy tailed distribution of returns. Still, the basic model is not always able to fully capture the high kurtosis often found in practice. In the SV-t model a standardized t-distribution (with ν > 2 degrees of freedom), rather than a normal distribution, is used for  epsilon in (1). This allows for heavier tails in returns. In order to also model skewness, a skewed distribution can be chosen for epsilon. In the SV-st model a skewed t-distribution is used. This distribution has an extra parameter, lambda, compared to the t-distribution. When lambda is negative, the distribution is negatively skewed. + +  + +In order to fit the models to data using ADMB-RE we have to find an expression for the log of the joint density function for returns and latent variables, p(**X**,**h**|θ), where θ is a parameter vector. It is then useful to find a graphical representation for the models. This makes it easier to uncover the dependence structure in the models so that we may find simple expessions for the joint density functions. The SV models considered so far can be represented graphically as:  + +![Fig_1][1] + + +Note that: +\- Xt is separated from the other variables by ht. This implies that Xt is conditionally independent of all other variables given ht. +\- The only path to ht goes via ht-1. Then ht is conditionally independent og all previous variables given ht-1. + +These considerations leads to the folowing expression for the joint density: +p(**X**,**h**|θ) = p(h1|θ)prod p(ht 1|ht,θ) prod p(Xt|ht,θ). + +hT 1 is not strictly needed here, but will be needed in later models and is for consistency also included here. + +For the models considered so far h1~N(0,σ2/(1-ϕ2)) and ht 1|ht~N(ϕht, σ2), while the distribution of Xt|ht depends on the distribution used for εt.  + +It is then easy to specify log p(**X**, **h**|θ), see tpl files for how this can be done for the three models: + +> [sdv_plain.tpl][2] +> +> [sdv_t.tpl][3] +> +> [sdv_t_skw.tpl][4] + + +The par-files contain estimated parameters and volatilities. (Comments...) + +> [sdv_plain.par][5] +> +> [sdv_t.par][6] +> +> [sdv_t_skw.par][7] + +  + +  + + + + +[1]: the-basic-sv-model-and-simple-extensions-1/Figur_1.jpg/image_preview.jpg "Fig_1" +[2]: the-basic-sv-model-and-simple-extensions-1/sdv_plain.tpl "sdv_plain.tpl" +[3]: the-basic-sv-model-and-simple-extensions-1/sdv_t.tpl "sdv_t.tpl" +[4]: the-basic-sv-model-and-simple-extensions-1/sdv_t_skw.tpl "sdv_t_skw.tpl" +[5]: the-basic-sv-model-and-simple-extensions-1/sdv_plain.par "sdv_plain.par" +[6]: the-basic-sv-model-and-simple-extensions-1/sdv_t.par "sdv_t.par" +[7]: the-basic-sv-model-and-simple-extensions-1/sdv_t_skw.par "sdv_t_skw.par" diff --git a/categorical-data/categorical-data.md b/categorical-data/categorical-data.md new file mode 100644 index 0000000..7685e74 --- /dev/null +++ b/categorical-data/categorical-data.md @@ -0,0 +1,15 @@ +# Categorical data + +[Item response theory][1] +: The multilevel Rasch model can be implented using random effects in ADMB. As an example we use data on the responses of 2042 soldiers to a total of 19 items (questions), taken from Doran et al (2007). This illustrates the use of crossed random effects in ADMB. Further, it is shown how the model easily can be generalized in ADMB. These more general models cannot be fitted with standard GLMM software such as "lmer" in R. + +[Ordered categorical responses][2] +: Ordered categorical responses with application to SOCATT data + +Document Actions + +* [RSS feed][3] + +[1]: categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1.html +[2]: categorical-data/ordered-categorical-responses.html +[3]: categorical-data/RSS "" diff --git a/categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1/item-response-theory-irt-and-the-multilevel-rasch-model-1.md b/categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1/item-response-theory-irt-and-the-multilevel-rasch-model-1.md new file mode 100644 index 0000000..015e261 --- /dev/null +++ b/categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1/item-response-theory-irt-and-the-multilevel-rasch-model-1.md @@ -0,0 +1,88 @@ +# Item response theory + +## Original model formulation + +Item response theory (IRT) refers to statistical models for data from questionnaires and tests as a basis for measuring abilities, attitudes, or other variables in psychometrics (). Doran et al (2007) fitted multilevel Rasch model, which is a special instance of an IRT, using the R function "lmer". This example shows how the model from Doran et al (2007) can simply be implemented using random effects in ADMB. It also shows how the model can easily can be expanded in ways not possible in other other sofwtare package than ADMB.  + + +### Data and Model + +2042 soldiers responded to a total of 19 items, all of which with a dichotomous outcome (0 or 1). The 19 items were grouped into 3 categories, which were modelled as fixed effects (variable "itcoff" in irt_doran.tpl). Further, the soldiers were grouped into 49 companies, which taken to be random effects (v). Similarly, there was a random effect associated with each individual soldier (u) and one with each item (w). + +A logistic regression with + +_       Prob(x=0) = 1/(1 exp(bx)) , Prob(x=1) = 1-Prob(x=0)_ + +(the Rasch model) and the linear predictor + +_       bx = itcoff sigma1*u sigma2*v sigma3*w;_ + +was used. The sigma's are standard deviations of the random effects. + +  + +### Running the model + +All files needed to run the model are available in a zip file in the box to the left. In order for the model to run efficiently, use the command line + +      irt_doran -shess -ndi 45000 + +However, for a data set of this size some of the default settings of the software can be modified to obtain maximum speed of execution: + +      irt_doran -iprint 1 -mno 50000 -ams 3000000 -gbs 50000000 -cbs 25000000 -noinit -shess -ndi 45000 + +This yields the following result (.par) file, which matches the results from "lmer" exactly (but differs somewhat from what was reported in Doran et al, 2007).  + + # Number of parameters = 6 Objective function value = 20354.9 Maximum gradient component = 6.12735e-005 + # itcoff: + -1.67737 0.492791 0.135192 + # sigma1: + 1.51846121232 + # sigma2: + 0.504141856912 + # sigma3: + 0.612277839339 + +The ADMB program runs much slower than "lmer" for this model, because the structure of the model is hard-coded into lmer. ADMB on the other hand targets a much larger class of models, and is thus not as efficient. However, the benefit of using ADMB is that you can change the model in the way you like, as is exemplified next. This is not currently possible in any other model package. + +## Extention: changing the asymptotes + +  + +Given that we think that Pr(x=0) can never be exactly 0 or 1, the following extention of the logistic regression is useful:  + +  _     Prob(x=0) =a (b-a)/(1 exp(bx)),_ + +where _a_ and _b _are parameters to be estimated. Two special cases are considered + +1. irt1_doran: only a is estimated (b=0). +2. irt1_doran: both a and b are estimated. + +Files for both these models are provided in boxes to the left. + +  + +### Comparison of results + +A comparison of (log) likelihood values are given in the following table + +| Name | log-like | Comment | # pars | AIC | +| ---------- | -------- | --------------------- | ------ | ------- | +| irt_doran | -20354.9 | Doran et al. | 6 | 40721.8 | +| irt1_doran | -20326.0 | _a_ estimated | 9 | 40670 | +| irt2_doran | -20320.0 | _a_ and _b_ estimated | 12 | 40664 | + +  + +Note that the are 3 parameters associated with each of _a_ and _b_: one of each level of the fixed effect "itcoff". According to the AIC criterion, both _a_ and _b _are significant parameters for these data. + +### + +## Conclusion + +Allthough  + +## References + + +Doran, H., Bates, D., Bliese, P., Dowling, M. Estimating the Multilevel Rasch Model: With the lme4 Package. _Journal of Statistical Software_, 20, 2007. () \ No newline at end of file diff --git a/categorical-data/ordered-categorical-responses/ordered-categorical-responses.md b/categorical-data/ordered-categorical-responses/ordered-categorical-responses.md new file mode 100644 index 0000000..d6d523b --- /dev/null +++ b/categorical-data/ordered-categorical-responses/ordered-categorical-responses.md @@ -0,0 +1,29 @@ +# Ordered categorical responses + +Filed under: [Social science][1] + +The SOCATT data set is used in the comparison of different software packages for multilevel modelling, conducted by the [Centre for Multilevel Modelling][2]. The SOCATT data consist of the responses to a set of dichotomous items on a woman's right to have an abortion. The outcome variable (_yij_) is a score constructed from these items ranging from 1 to 7, with a higher score corresponding to stronger support for abortion. Each of 264 respondents was asked the same set of questions on four occasions, 1983-1986, and _yij_ denotes the response from individual _i_ in year _j_ + +. We consider one categorical covariate (religion) with 4 categories. A random intercept ordered logit model was fitted: + +  + +logit[ P(_yij < s_) ] = _ks b1xi1 b2*xi2 b3*xi3_ _ui_, + +_ui_ ~ N(0,_s2_) + +where _x1i_, _x2i_ and _x3i_ are dummy variables coding for the different levels of the categorical covariates, and _ks_ are threshold parameters. A full description of the model can be found here: [socatt.pdf][3] + +  + +  + +  + +  + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=Social science +[2]: http://multilevel.ioe.ac.uk/softrev/index.html +[3]: ordered-categorical-responses/socatt.pdf "socatt.pdf" diff --git a/copy_of_new-examples.md b/copy_of_new-examples.md new file mode 100644 index 0000000..9ce7470 --- /dev/null +++ b/copy_of_new-examples.md @@ -0,0 +1,87 @@ +# All examples + +All examples currently available in the website + +["Maximum likelihood estimation and inference" by Russell Millar][1] +[A discrete valued time series model; Polio data][2] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A discrete valued time series model; Polio data][3] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A fisheries model with random effects][4] +: Catch-age model from Schnute and Richards (1995) with annual recruitments as random effects. + +[A standard CJS model][5] +: Fitting Cormack-Jolly-Seber (CJS) Models to Capture-Recapture Data using R2admb + +[Adjoint code][6] +: Why to write adjoint code and alternative approaches to do it. + +[Baranov catch equation][7] +: Example by Steven Martell of writing adjoint code in ADMB to numerically solve the Baranov catch equation. A simple simulation model is used to generate simulated catch and relative abundance data with observation error only. The assessment model is then conditioned on the simulated catch data. + +[BCB bowheads][8] +: Abundance estimation of BCB bowhead whales + +[Beta-binomial model][9] +: Binomial response with random effects having beta distribution. Comparison to Winbugs and h-GLM + +[By field of application][10] +[Categorical data][11] +[CJS Individual Heterogeneity ][12] +: Mixed Effects Cormack-Jolly-Seber Models for Analysis of Capture-Recapture Data + +[ CJS Models][13] +: Cormack-Jolly-Seber (CJS) models in different variations + +[Comparison of approaches][14] +: Three different implementations of the same model with separable spatial covariance function in a fully Gaussian situation: i) Plain ADMB (non-random effect) ii) Geostatistical formulation iii) Hybrid approach. + +[Count data][15] +: Poisson, negative binomial counts in various variants + +[Covariance Calculations][16] +: A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. + +[Covariance in RE models][17] +[Covariance matrices][18] +: How to parameterize a covariance matrix + +[Delta smelt life cycle model ][19] +: A state-space multistage model to evaluate population impacts in the presence of density dependence. + +[Diet and heart disease][20] +: Continuous and discrete observation sharing being influenced by a latent random variable + +[ Next 20 items » ][21] [1] [2][21] [3][22] [4][23] [5][24] + +Document Actions + +* [RSS feed][25] + +[1]: text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.html +[2]: glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model.html +[3]: state-space-models/a-discrete-valued-time-series-model.html +[4]: fisheries/a-fisheries-model-with-random-effects-1.html +[5]: mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.html +[6]: admb-tricks/adjoint-code-1.html +[7]: fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.html +[8]: glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads.html +[9]: glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model.html +[10]: by-field-of-application.html +[11]: categorical-data.html +[12]: mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.html +[13]: mark-recapture/cormack-jolly-seber-models.html +[14]: spatial-models/separable-different-implementation.html +[15]: glmm-generalized-linear-mixed-models/count-data.html +[16]: admb-tricks/covariance-calculations.html +[17]: admb-tricks/variance-calculations/variance-in-re-models.html +[18]: admb-tricks/parameterization/covariance-matrices.html +[19]: state-space-models/delta-smelt-life-cycle-model.html +[20]: glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease.html +[21]: copy_of_new-examples8c63.html?b_start:int=20 +[22]: copy_of_new-examplesa891.html?b_start:int=40 +[23]: copy_of_new-examples3849.html?b_start:int=60 +[24]: copy_of_new-examples9f54.html?b_start:int=80 +[25]: copy_of_new-examples/RSS "" diff --git a/copy_of_new-examples3849.md b/copy_of_new-examples3849.md new file mode 100644 index 0000000..f5b36bd --- /dev/null +++ b/copy_of_new-examples3849.md @@ -0,0 +1,37 @@ +

+ All examples +

\ No newline at end of file diff --git a/copy_of_new-examples51a2.md b/copy_of_new-examples51a2.md new file mode 100644 index 0000000..9ce7470 --- /dev/null +++ b/copy_of_new-examples51a2.md @@ -0,0 +1,87 @@ +# All examples + +All examples currently available in the website + +["Maximum likelihood estimation and inference" by Russell Millar][1] +[A discrete valued time series model; Polio data][2] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A discrete valued time series model; Polio data][3] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A fisheries model with random effects][4] +: Catch-age model from Schnute and Richards (1995) with annual recruitments as random effects. + +[A standard CJS model][5] +: Fitting Cormack-Jolly-Seber (CJS) Models to Capture-Recapture Data using R2admb + +[Adjoint code][6] +: Why to write adjoint code and alternative approaches to do it. + +[Baranov catch equation][7] +: Example by Steven Martell of writing adjoint code in ADMB to numerically solve the Baranov catch equation. A simple simulation model is used to generate simulated catch and relative abundance data with observation error only. The assessment model is then conditioned on the simulated catch data. + +[BCB bowheads][8] +: Abundance estimation of BCB bowhead whales + +[Beta-binomial model][9] +: Binomial response with random effects having beta distribution. Comparison to Winbugs and h-GLM + +[By field of application][10] +[Categorical data][11] +[CJS Individual Heterogeneity ][12] +: Mixed Effects Cormack-Jolly-Seber Models for Analysis of Capture-Recapture Data + +[ CJS Models][13] +: Cormack-Jolly-Seber (CJS) models in different variations + +[Comparison of approaches][14] +: Three different implementations of the same model with separable spatial covariance function in a fully Gaussian situation: i) Plain ADMB (non-random effect) ii) Geostatistical formulation iii) Hybrid approach. + +[Count data][15] +: Poisson, negative binomial counts in various variants + +[Covariance Calculations][16] +: A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. + +[Covariance in RE models][17] +[Covariance matrices][18] +: How to parameterize a covariance matrix + +[Delta smelt life cycle model ][19] +: A state-space multistage model to evaluate population impacts in the presence of density dependence. + +[Diet and heart disease][20] +: Continuous and discrete observation sharing being influenced by a latent random variable + +[ Next 20 items » ][21] [1] [2][21] [3][22] [4][23] [5][24] + +Document Actions + +* [RSS feed][25] + +[1]: text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.html +[2]: glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model.html +[3]: state-space-models/a-discrete-valued-time-series-model.html +[4]: fisheries/a-fisheries-model-with-random-effects-1.html +[5]: mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.html +[6]: admb-tricks/adjoint-code-1.html +[7]: fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.html +[8]: glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads.html +[9]: glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model.html +[10]: by-field-of-application.html +[11]: categorical-data.html +[12]: mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.html +[13]: mark-recapture/cormack-jolly-seber-models.html +[14]: spatial-models/separable-different-implementation.html +[15]: glmm-generalized-linear-mixed-models/count-data.html +[16]: admb-tricks/covariance-calculations.html +[17]: admb-tricks/variance-calculations/variance-in-re-models.html +[18]: admb-tricks/parameterization/covariance-matrices.html +[19]: state-space-models/delta-smelt-life-cycle-model.html +[20]: glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease.html +[21]: copy_of_new-examples8c63.html?b_start:int=20 +[22]: copy_of_new-examplesa891.html?b_start:int=40 +[23]: copy_of_new-examples3849.html?b_start:int=60 +[24]: copy_of_new-examples9f54.html?b_start:int=80 +[25]: copy_of_new-examples/RSS "" diff --git a/copy_of_new-examples8c63.md b/copy_of_new-examples8c63.md new file mode 100644 index 0000000..66cc96c --- /dev/null +++ b/copy_of_new-examples8c63.md @@ -0,0 +1,84 @@ +# All examples + +All examples currently available in the website + +[Differential equations][1] +[Eilers & Marx parameterization][2] +: Parameterization of the spline from Eilers & Marx (1996) + +[Estimation of detection function ][3] +: Illustrates the likelihood based estimation of the detection function (perpendicular distance) + +[Examples][4] +: Under construction + +[Extension: correlated RE's][5] +: Add random effects to all 3 phi's, and attempt to estimate correlations + +[Extension: crossed RE's][6] +: Adds a "day effect" following Millar (2004, Aust NZ J. Stat, 46, p. 543-554) + +[Fisheries][7] +: Different uses of ADMB in fisheries stock assessments or other fisheries work + +[Flexible negative binomial][8] +: Explores non-standard relationships between mean and variance in the NB model + +[Function minimizer][9] +: Various tricks and techniques related to the function minimizer to improve convergence + +[Gamma distributed myxomatosis using R2admb][10] +[GAMs as mixed models][11] +: Generalized Additive Models + +[Gaussian models][12] +: Models where both the response and latent random variable are Gaussian. For such models the covariance matrix of the observations can be worked out analytically, but still the latent variable (random effect) formulation can be beneficial. + +[Geostatistical approach][13] +: The approach to spatial modeling where you explicitly model the covariance function/matrix. First used in geology/mining (hence the name). Can be used with both Gaussian and non-Gaussian response for data. + +[GLM/GLMM/GAM][14] +[glmmADMB][15] +[Growth models][16] +[Item response theory][17] +: The multilevel Rasch model can be implented using random effects in ADMB. As an example we use data on the responses of 2042 soldiers to a total of 19 items (questions), taken from Doran et al (2007). This illustrates the use of crossed random effects in ADMB. Further, it is shown how the model easily can be generalized in ADMB. These more general models cannot be fitted with standard GLMM software such as "lmer" in R. + +[Line transect methods][18] +: Line transect methods are commonly used to estimate animal abundance, and is a special case of distance sampling. + +[lmer() comparison][19] +: Application of ADMB to the simulated datasets in Zhang et al. (2011) with emphasis on comparison to the R function lmer() + +[Mark-recapture][20] + +[ « Previous 20 items ][21] [ Next 20 items » ][22] [1][21] [2] [3][22] [4][23] [5][24] + +Document Actions + +* [RSS feed][25] + +[1]: differential-equations.html +[2]: glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models.html +[3]: sampling/line-transect-methods/estimation-of-detection-function.html +[4]: http://www.admb-project.org/examples +[5]: growth-models/orange-trees/extension-correlated-res.html +[6]: growth-models/orange-trees/extension-crossed-res.html +[7]: fisheries.html +[8]: glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model.html +[9]: function-minimization.html +[10]: r-stuff/gamma-distributed-myxomatosis-using-r2admb.html +[11]: glmm-generalized-linear-mixed-models/gams-as-mixed-models.html +[12]: glmm-generalized-linear-mixed-models/gaussian-models.html +[13]: spatial-models/the-geostatistical-approach.html +[14]: glmm-generalized-linear-mixed-models.html +[15]: r-stuff/glmmadmb.html +[16]: growth-models.html +[17]: categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1.html +[18]: sampling/line-transect-methods.html +[19]: r-stuff/lmer-comparison.html +[20]: mark-recapture.html +[21]: copy_of_new-examples51a2.html?b_start:int=0 +[22]: copy_of_new-examplesa891.html?b_start:int=40 +[23]: copy_of_new-examples3849.html?b_start:int=60 +[24]: copy_of_new-examples9f54.html?b_start:int=80 +[25]: copy_of_new-examples/RSS "" diff --git a/copy_of_new-examples9f54.md b/copy_of_new-examples9f54.md new file mode 100644 index 0000000..0d76dfc --- /dev/null +++ b/copy_of_new-examples9f54.md @@ -0,0 +1,37 @@ +# All examples + +All examples currently available in the website + +[Theta-logistic population growth model][1] +: State-space model from the NCEAS non-linear modelling working group + +[Variance calculations][2] +: How variance is calculated in ADMB + +[Weibull regression with censoring][3] +[Wildflowers][4] +: A binomial generalized linear mixed model example from the NCEAS non-linear modelling working group. + +[WinBUGS][5] +: Comparison with the software package WinBUGS + +[Wood (2006) parameterization][6] +: Parameterization via the eigen vectors of the penalty matrix (Wood 2006, Section 6.6.1). + +[ « Previous 20 items ][7] [1][8] [2][9] [3][10] [4][7] [5] + +Document Actions + +* [RSS feed][11] + +[1]: state-space-models/theta-logistic-population-growth-model.html +[2]: admb-tricks/variance-calculations.html +[3]: survival-analysis/weibull-regression-with-censoring.html +[4]: glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.html +[5]: winbugs.html +[6]: glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization.html +[7]: copy_of_new-examples3849.html?b_start:int=60 +[8]: copy_of_new-examples51a2.html?b_start:int=0 +[9]: copy_of_new-examples8c63.html?b_start:int=20 +[10]: copy_of_new-examplesa891.html?b_start:int=40 +[11]: copy_of_new-examples/RSS "" diff --git a/copy_of_new-examplesa891.md b/copy_of_new-examplesa891.md new file mode 100644 index 0000000..d186698 --- /dev/null +++ b/copy_of_new-examplesa891.md @@ -0,0 +1,93 @@ +# All examples + +All examples currently available in the website + +[Math][1] +: Various undocumented techniques and tricks useful for developing ADMB programs + +[MCMCMC][2] +: This presents generalized code for conducting Metropolis Coupled MCMC using ADMB called within R + +[Mean and variance][3] +: Both mean and variance vary smoothly as functions of a covariate + +[MGRF: simple CAR model][4] +: CAR model for the Scottish Lip Cancer Data + +[Mineralization of terbuthylazine][5] +: A simple nonlinear least-squares problem, with normally distributed residuals and no random effects or latent variables. Example from the NCEAS non-linear modelling working group. + +[Miscellaneous][6] +: Stuff that is hard to categorize, but still is useful + +[Mixed response][7] +: Models with responses of different types + +[Negative Binomial Fir Fecundity][8] +: + +[Negative binomial serially correlated counts][9] +: Compares a negative binomial response to Poisson responses for the polio data + +[Non Gaussian random effects][10] +: ADMB allows non-Gaussian random effects via transformation of a normal variate + +[Occupancy model][11] +: Comparison of ADMB and WinBUGS modelling approach for simple occupancy model. This is also a comparison of Bayesian and frequentist modelling. + +[One-compartment open model][12] +: Fit mixed effects model to the classical "phenopharbital" model + +[Orange trees][13] +[Ordered categorical responses][14] +: Ordered categorical responses with application to SOCATT data + +[Owl nestling negotiation][15] +: Zero-inflated generalized linear mixed model example from the NCEAS non-linear modelling working group. + +[Parameter scaling][16] +: Shows how to scale parameters so that they become of the same magnitude + +[Parameterization][17] +: Examples of how to (and not to) parameterize mathematical functions and statistical models + +[Pella-Tomlinson basic model][18] +: Pella-Tomlinson by Arni Magnusson with user interface and formatted MCMC output. Repeats and extends the analysis of Polacheck et al. (1993). + +[Pella-Tomlinson from ADMB manual][19] +: Pella-Tomlinson example by Dave Fournier from the ADMB manual. Demonstrates several innovative modelling approaches: 6 month time step, time-varying K and q. + +[PK/DK ][20] +: Pharmacokinetics (PK) & Pharmacodynamics(DK) + +[ « Previous 20 items ][21] [ Next 20 items » ][22] [1][23] [2][21] [3] [4][22] [5][24] + +Document Actions + +* [RSS feed][25] + +[1]: admb-tricks.html +[2]: r-stuff/mcmcmc.html +[3]: glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance.html +[4]: spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data.html +[5]: differential-equations/mineralization-of-terbuthylazine.html +[6]: miscellaneous.html +[7]: glmm-generalized-linear-mixed-models/mixed-response.html +[8]: glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1.html +[9]: glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts.html +[10]: glmm-generalized-linear-mixed-models/non-gaussian-random-effects.html +[11]: winbugs/occupancy-model.html +[12]: differential-equations/pk-dk/one-compartment-open-model.html +[13]: growth-models/orange-trees.html +[14]: categorical-data/ordered-categorical-responses.html +[15]: glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.html +[16]: function-minimization/parameter-scaling.html +[17]: admb-tricks/parameterization.html +[18]: fisheries/pella.html +[19]: fisheries/pella-t.html +[20]: differential-equations/pk-dk.html +[21]: copy_of_new-examples8c63.html?b_start:int=20 +[22]: copy_of_new-examples3849.html?b_start:int=60 +[23]: copy_of_new-examples51a2.html?b_start:int=0 +[24]: copy_of_new-examples9f54.html?b_start:int=80 +[25]: copy_of_new-examples/RSS "" diff --git a/differential-equations/differential-equations.md b/differential-equations/differential-equations.md new file mode 100644 index 0000000..2e7a2ad --- /dev/null +++ b/differential-equations/differential-equations.md @@ -0,0 +1,15 @@ +# Differential equations + +[PK/DK ][1] +: Pharmacokinetics (PK) & Pharmacodynamics(DK) + +[Mineralization of terbuthylazine][2] +: A simple nonlinear least-squares problem, with normally distributed residuals and no random effects or latent variables. Example from the NCEAS non-linear modelling working group. + +Document Actions + +* [RSS feed][3] + +[1]: differential-equations/pk-dk.html +[2]: differential-equations/mineralization-of-terbuthylazine.html +[3]: differential-equations/RSS "" diff --git a/differential-equations/mineralization-of-terbuthylazine.md b/differential-equations/mineralization-of-terbuthylazine.md new file mode 100644 index 0000000..cf2ff05 --- /dev/null +++ b/differential-equations/mineralization-of-terbuthylazine.md @@ -0,0 +1,20 @@ +# Mineralization of terbuthylazine + +**This example is part of the [NCEAS non-linear modelling project][1]** + +**By Anders Nielsen** + +Terbuthylazine is a herbicide used in agriculture. It is a so-called s-triazin like atrazine, which has been banned in Denmark after suspicion of causing cancer. +Terbuthylazine can be bound to the soil, but free terbuthylazine can be washed into the drinking water. Some bacteria can mineralize it. This data is part of a larger experiment to determine the ability of certain bacteria to mineralize terbuthylazine, and to estimate the mineralization rate. + +This is a fairly straightforward nonlinear least-squares problem, with normally distributed residuals and no random effects or latent variables. The deterministic part of the model is the solution to a set of coupled ordinary differential equations (ODEs) for the concentrations in different compartments. Because the ODEs are linear, the deterministic solution can be found directly in terms of a matrix exponential, for which functions exist in all three of ADMB, BUGS, and R. From there it is simply a matter of defining a normal likelihood, or equivalently a least-squares expression, and minimizing it. The main differences appear in the speed and robustness of the matrix exponential formulations in different software tools. + +[Documentation][2] + +[Source code][3] + +  + +[1]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[2]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/min/WRITEUP/min.pdf +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/min diff --git a/differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model.md b/differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model.md new file mode 100644 index 0000000..c2ced26 --- /dev/null +++ b/differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model.md @@ -0,0 +1,32 @@ +# One-compartment open model + +Filed under: [Differential equations][1], [PK/DK][2] + +Fit mixed effects model to the classical "phenopharbital" model + +Pinheiro & Bates (2000, Ch. 6.4) fitted a so-called 'one-compartment open model' to a dataset known as the 'phenopharbital data'. A patient is given a dose _D_ at time _t_d, giving rise to a phenopharbital concentration _ct_ at a later time _t_: + + + +_ct_ = _D/V_ exp[-_Cl/V_(_t_-_t_d)], + +  + +where _V_ and _Cl_ are parameters (the so-called 'Volume of concentration' and the 'Clearance', respectively). Doses given at different time points contribute additively to _ct_. + + +Pinheiro & Bates (2000) fitted a model with a linear predictor (and a log-link) for each of the paramere _V_ and _Cl_. Each of the linear predictors contained one covariate _Wt_ and one random effect. A full description of the model can be found here [pheno.pdf][3] (quite old, so timing results mentioned are outdated). + +### + +Note: In this model the underlying ODE has an analytical solution, but in more general models it will not. + +  + +### References + +Pinheiro, J., Bates, D.M.  (2000), _Mixed-Effects Models in S and S-PLUS_. Statistics and Computing, Springer. + +[1]: http://www.admb-project.org/@@search?Subject:list=Differential equations +[2]: http://www.admb-project.org/@@search?Subject:list=PK/DK +[3]: one-compartment-open-model/pheno.pdf "pheno.pdf" diff --git a/differential-equations/pk-dk/pk-dk.md b/differential-equations/pk-dk/pk-dk.md new file mode 100644 index 0000000..286a05c --- /dev/null +++ b/differential-equations/pk-dk/pk-dk.md @@ -0,0 +1,27 @@ +# PK/DK + +Ordinary differential equations (ODE) are important in Pharmacokinetics (PK) & Pharmacodynamics(DK) and can be fit in ADMB. + +The difference between PK and DK has been described (Wikipedia) as + +> _"Pharmacokinetics may be simply defined as what the body does to the drug, as opposed to pharmacodynamics which may be defined as what the drug does to the body"_ + +Se more details at  and . + +  + +I nice description of mixed models in PK/DK is provided here:  + +  + +The reason ADMB is useful for such models are: + +1. The flexibility of ADMB allows numerical ODE schemes to be implemented. +2. Robust and fast parameter estimation. +3. Mixed mode functionality + +  + +### Examples + +See subfolders to the left \ No newline at end of file diff --git a/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.md b/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.md new file mode 100644 index 0000000..b927745 --- /dev/null +++ b/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.md @@ -0,0 +1,13 @@ +# Baranov catch equation + +Example by Steven Martell of writing adjoint code in ADMB to numerically solve the Baranov catch equation. A simple simulation model is used to generate simulated catch and relative abundance data with observation error only. The assessment model is then conditioned on the simulated catch data. + +[Baranov catch equation][1] +: Writing adjoint code in ADMB to numerically solve the Baranov catch equation. + +Document Actions + +* [RSS feed][2] + +[1]: a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.html +[2]: a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/RSS "" diff --git a/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.md b/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.md new file mode 100644 index 0000000..790c6a5 --- /dev/null +++ b/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.md @@ -0,0 +1,15 @@ +# Baranov catch equation + +Filed under: [Fisheries][1] + +Writing adjoint code in ADMB to numerically solve the Baranov catch equation. + +A simple simulation model (contributed by Steve Martell) is used to generate simulated catch and relative abundance data with observation error only. The assessment model is then conditioned on the simulated catch data. Documentation and .tpl files are provided below: + +[Baranov example documentation][2] + +[Baranov example][3] + +[1]: http://www.admb-project.org/@@search?Subject:list=Fisheries +[2]: ../../admb-tricks/adjoint-code-1/AdJointCodeBaranov.pdf "AdJointCodeBaranov.pdf" +[3]: ../../admb-tricks/adjoint-code-1/barnov.tpl "barnov.tpl" diff --git a/fisheries/a-fisheries-model-with-random-effects-1.md b/fisheries/a-fisheries-model-with-random-effects-1.md new file mode 100644 index 0000000..8e7a8d6 --- /dev/null +++ b/fisheries/a-fisheries-model-with-random-effects-1.md @@ -0,0 +1,11 @@ +# A fisheries model with random effects + +Filed under: [Fisheries][1], [Random effect][2] + +The catch-age model from Schnute and Richards (1995) with annual recruitments as random effects. + +[Model description and associated files][3]. + +[1]: http://www.admb-project.org/@@search?Subject:list=Fisheries +[2]: http://www.admb-project.org/@@search?Subject:list=Random effect +[3]: http://otter-rsch.com/admbre/examples/caest/caest.html diff --git a/fisheries/fisheries.md b/fisheries/fisheries.md new file mode 100644 index 0000000..2422cd4 --- /dev/null +++ b/fisheries/fisheries.md @@ -0,0 +1,28 @@ +# Fisheries + +Filed under: [Fisheries][1] + +Different uses of ADMB in fisheries stock assessments or other fisheries work + +[A fisheries model with random effects][2] +: Catch-age model from Schnute and Richards (1995) with annual recruitments as random effects. + +[Baranov catch equation][3] +: Example by Steven Martell of writing adjoint code in ADMB to numerically solve the Baranov catch equation. A simple simulation model is used to generate simulated catch and relative abundance data with observation error only. The assessment model is then conditioned on the simulated catch data. + +[Pella-Tomlinson basic model][4] +: Pella-Tomlinson by Arni Magnusson with user interface and formatted MCMC output. Repeats and extends the analysis of Polacheck et al. (1993). + +[Pella-Tomlinson from ADMB manual][5] +: Pella-Tomlinson example by Dave Fournier from the ADMB manual. Demonstrates several innovative modelling approaches: 6 month time step, time-varying K and q. + +Document Actions + +* [RSS feed][6] + +[1]: http://www.admb-project.org/@@search?Subject:list=Fisheries +[2]: fisheries/a-fisheries-model-with-random-effects-1.html +[3]: fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.html +[4]: fisheries/pella.html +[5]: fisheries/pella-t.html +[6]: fisheries/RSS "" diff --git a/fisheries/pella-t/pella-t.md b/fisheries/pella-t/pella-t.md new file mode 100644 index 0000000..8a0115d --- /dev/null +++ b/fisheries/pella-t/pella-t.md @@ -0,0 +1,15 @@ +# Pella-Tomlinson from ADMB manual + +Pella-Tomlinson example by Dave Fournier from the ADMB manual. Demonstrates several innovative modelling approaches: 6 month time step, time-varying K and q. + +![File PDF document][1] [pella-t.pdf][2] +[Model and data files][3] + +Document Actions + +* [RSS feed][4] + +[1]: http://www.admb-project.org/pdf.png +[2]: pella-t/pella-t.pdf/view.html +[3]: http://admb-project.org/svn/trunk/examples/admb/pella-t/ +[4]: pella-t/RSS "" diff --git a/fisheries/pella/pella.md b/fisheries/pella/pella.md new file mode 100644 index 0000000..8d33886 --- /dev/null +++ b/fisheries/pella/pella.md @@ -0,0 +1,21 @@ +# Pella-Tomlinson basic model + +Pella-Tomlinson by Arni Magnusson with user interface and formatted MCMC output. Repeats and extends the analysis of Polacheck et al. (1993). + +[pella.pdf][1] +: Model description and results + +[pella.tpl][2] +: ADMB source code + +[modelruns.zip][3] +: Input data (alb, hake, rocklob) and model output + +Document Actions + +* [RSS feed][4] + +[1]: http://www.hafro.is/~arnima/pella/pella.pdf +[2]: http://www.hafro.is/~arnima/pella/pella.tpl +[3]: http://www.hafro.is/~arnima/pella/modelruns.zip +[4]: pella/RSS "" diff --git a/function-minimization/function-minimization.md b/function-minimization/function-minimization.md new file mode 100644 index 0000000..6b71148 --- /dev/null +++ b/function-minimization/function-minimization.md @@ -0,0 +1,13 @@ +# Function minimizer + +Various tricks and techniques related to the function minimizer to improve convergence + +[Parameter scaling][1] +: Shows how to scale parameters so that they become of the same magnitude + +Document Actions + +* [RSS feed][2] + +[1]: function-minimization/parameter-scaling.html +[2]: function-minimization/RSS "" diff --git a/function-minimization/parameter-scaling/parameter-scaling.md b/function-minimization/parameter-scaling/parameter-scaling.md new file mode 100644 index 0000000..9e629b2 --- /dev/null +++ b/function-minimization/parameter-scaling/parameter-scaling.md @@ -0,0 +1,44 @@ +# Parameter scaling + +Shows how to scale parameters so that they become of the same magnitude, as seen from the perspective of the function minimizer + +Numerical minimizing algorithms are more stable if the parameters are of the same magnitude. A typically printout (when running the program) indicating that scaling is needed is: + + Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient    +   1-114.2917 -1.01971e-03 |  2  0.68496 -1.61913e-03 |  3 19.44854 -8.88731e-03 +   4  7.13834 -1.42007e-03 |  5  2.92391  1.48536e-03 |  6 -3.05878 -8.16281e-03 +   7  0.43921 -8.80460e-03 |  8 -0.71284 -6.23123e 00 | + Function minimizer not making progress ... is minimum attained? + Minimprove criterion =   0.0000e 00 + +We see that variable 8 has a much higher gradient than the other parameters. We need to "scale" that parameter. + +  + +## Example + +In the following we see that the range of  _b_  is 1000 times larger than that of  _a_: + +   init_bounded_number a(-2.,2.) +   init_bounded_number b(-2000.,2000.) + +That could yield convergence problems. To counteract this we can use + +   !! b.set_scalefactor(0.001); + +which makes the function minimizer work internally with b_internal = 0.001*b.  From the user's perspective nothing has happened (b will be correct in .par and .std files). + +  + +### Which parameters to scale? + +  + +1. Make your program converge so that you get the printout on the top of this page where you see which parameters do not have a good gradient. +2. Apply set_scalefactor(10)  to these parameters, and gradually increase until the gradient is reduced. + +  + +### Availablity + +This feature will become available for random effects model (admb -r) from release VERSION to 11.1. \ No newline at end of file diff --git a/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.md b/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.md new file mode 100644 index 0000000..f46b278 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.md @@ -0,0 +1,43 @@ +# A time series of Poisson counts; Polio data + +Filed under: [State space model][1], [Medical/Biometrics][2], [Count data][3] + +A serially correlated time series of Poisson counts using a GLMM framework + +### **Model description** + +As an example of a discrete valued time series we use the 'polio data' considered by [Kuk & Cheng (1999)][4]. It is assumed that _yi_ has a Poisson (lambdai) distribution, where + + +log(lambdai) = _**X**i_**b** _ui_. + +  + +Here, _**X**i_ is a covariate vector, **b** is a vector of regression parameters and _ui_ + +is a first order autoregressive process. + +  + +### Details + +[polio.pdf][5] + +  + +### Files + +See "Navigation" box to the left. + +* .tpl:  Model file +* .dat: Data file +* .pin: Starting values for the numerical optimizer +* .par: Result file (what you get when you compile and run your model) + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=State space model +[2]: http://www.admb-project.org/@@search?Subject:list=Medical/Biometrics +[3]: http://www.admb-project.org/@@search?Subject:list=Count data +[4]: ../citations.html#kuk:chen:1999 +[5]: polio.pdf "polio.pdf" diff --git a/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md b/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md new file mode 100644 index 0000000..f313ad2 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md @@ -0,0 +1,43 @@ +# A time series of Poisson counts; Polio data + +Filed under: [State space model][1], [Medical/Biometrics][2], [Count data][3] + +A serially correlated time series of Poisson counts using a GLMM framework + +### **Model description** + +As an example of a discrete valued time series we use the 'polio data' considered by [Kuk & Cheng (1999)][4]. It is assumed that _yi_ has a Poisson (lambdai) distribution, where + + +log(lambdai) = _**X**i_**b** _ui_. + +  + +Here, _**X**i_ is a covariate vector, **b** is a vector of regression parameters and _ui_ + +is a first order autoregressive process. + +  + +### Details + +[polio.pdf][5] + +  + +### Files + +See "Navigation" box to the left. + +* .tpl:  Model file +* .dat: Data file +* .pin: Starting values for the numerical optimizer +* .par: Result file (what you get when you compile and run your model) + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=State space model +[2]: http://www.admb-project.org/@@search?Subject:list=Medical/Biometrics +[3]: http://www.admb-project.org/@@search?Subject:list=Count data +[4]: citations.html#kuk:chen:1999 +[5]: a-discrete-valued-time-series-model/polio.pdf "polio.pdf" diff --git a/glmm-generalized-linear-mixed-models/count-data/citations.md b/glmm-generalized-linear-mixed-models/count-data/citations.md new file mode 100644 index 0000000..7e79110 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/citations.md @@ -0,0 +1,50 @@ +# This page does not seem to exist… + +We apologize for the inconvenience, but the page you were trying to access is not at this address. You can use the links below to help you find what you are looking for. + +If you are certain you have the correct web address but are encountering an error, please contact the [Site Administration][1]. + +Thank you. + +### You might have been looking for… + +[Count data][2] +: Poisson, negative binomial counts in various variants + +[Count data][2] +: Poisson, negative binomial counts in various variants + +[A discrete valued time series model; Polio data][3] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A discrete valued time series model; Polio data][4] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[A time series of Poisson counts; Polio data][5] +: A serially correlated time series of Poisson counts using a GLMM framework + +[Separable: Method explanation][6] +: It has for a long time been possible to fit GLMMs (Generalized Linear Mixed Models) in ADMB-RE. A typical example is correlated count data with Poisson ... + +[Separable covariance function][7] +: Poisson GLMM on large spatial grid + +[Negative binomial serially correlated counts ][8] +: + +[Otter Research collection][9] +: Links to examples on the Otter Research web site. This collection contains a wide variety of random effects models, chosen from different fields of application. + +[Journal papers and Formal publications][10] +: + +[1]: http://www.admb-project.org/contact-info +[2]: http://www.admb-project.org/examples/glmm-generalized-linear-mixed-models/count-data +[3]: http://www.admb-project.org/examples/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model +[4]: http://www.admb-project.org/examples/state-space-models/a-discrete-valued-time-series-model +[5]: http://www.admb-project.org/examples/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data +[6]: http://www.admb-project.org/examples/spatial-models/glmm2019s-on-large-spatial-grids +[7]: http://www.admb-project.org/examples/spatial-models/glmm2019s-on-large-spatial-grids/separable-covariance-function +[8]: http://www.admb-project.org/examples/glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts +[9]: http://www.admb-project.org/examples/miscellaneous/otter-reseach-collection +[10]: http://www.admb-project.org/users/bibliography/journal-papers-and-formal-publications diff --git a/glmm-generalized-linear-mixed-models/count-data/count-data.md b/glmm-generalized-linear-mixed-models/count-data/count-data.md new file mode 100644 index 0000000..6aa23bd --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/count-data.md @@ -0,0 +1,29 @@ +# Count data + +Poisson, negative binomial counts in various variants + +[A discrete valued time series model; Polio data][1] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[Negative binomial serially correlated counts][2] +: Compares a negative binomial response to Poisson responses for the polio data + +[Negative Binomial Fir Fecundity][3] +: + +[Flexible negative binomial][4] +: Explores non-standard relationships between mean and variance in the NB model + +[Owl nestling negotiation][5] +: Zero-inflated generalized linear mixed model example from the NCEAS non-linear modelling working group. + +Document Actions + +* [RSS feed][6] + +[1]: count-data/a-discrete-valued-time-series-model.html +[2]: count-data/negative-binomial-serially-correlated-counts.html +[3]: count-data/negative-binomial-fir-fecundity-1.html +[4]: count-data/flexible-negative-binomial-model.html +[5]: count-data/owl-nestling-negotiation.html +[6]: count-data/RSS "" diff --git a/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model.md b/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model.md new file mode 100644 index 0000000..e99b86c --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model.md @@ -0,0 +1,14 @@ +# Flexible negative binomial + +Explores non-standard relationships between mean and variance in the NB model + +| Title | Type | +| ------------------------------- | ---- | +| [Flexible negative binomial][1] | Page | + +Document Actions + +* [RSS feed][2] + +[1]: flexible-negative-binomial-model/flexible-negative-binomial.html "Explores non-standard relationships between mean and variance in the NB model" +[2]: flexible-negative-binomial-model/RSS "" diff --git a/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial.md b/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial.md new file mode 100644 index 0000000..fe1c660 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial.md @@ -0,0 +1,3 @@ +# Flexible negative binomial + +Explores non-standard relationships between mean and variance in the NB model \ No newline at end of file diff --git a/glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1.md b/glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1.md new file mode 100644 index 0000000..0ebe693 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1.md @@ -0,0 +1,23 @@ +# Negative Binomial Fir Fecundity + +Filed under: [Bolker (2008)][1] + +![File][2] [fir.R][3] +![File text/x-perl][2] [fir_ab.tpl][4] +![File text/x-perl][2] [fir_abk.tpl][5] +![File text/x-perl][2] [fir0.tpl][6] +![File][7] [fir.pdf][8] + +Document Actions + +* [RSS feed][9] + +[1]: http://www.admb-project.org/@@search?Subject:list=Bolker (2008) +[2]: http://www.admb-project.org/application.png +[3]: negative-binomial-fir-fecundity-1/fir.R/view.html +[4]: negative-binomial-fir-fecundity-1/fir_ab.tpl/view.html +[5]: negative-binomial-fir-fecundity-1/fir_abk.tpl/view.html +[6]: negative-binomial-fir-fecundity-1/fir0.tpl/view.html +[7]: http://www.admb-project.org/pdf.png +[8]: negative-binomial-fir-fecundity-1/description-1/view.html +[9]: negative-binomial-fir-fecundity-1/RSS "" diff --git a/glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.md b/glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.md new file mode 100644 index 0000000..78baaa1 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.md @@ -0,0 +1,29 @@ +# Negative binomial serially correlated counts + +Compares a negative binomial response to Poisson responses for the polio data + +| Title | Type | +| -------------------------------------------------- | ----- | +| ![File chemical/x-mopac-input][1] [polio.dat][2] | File | +| ![File text/x-perl][3] [polio2.tpl][4] | File | +| ![File text/x-perl][3] [polio2s.tpl][5] | File | +| ![File text/x-perl][3] [polio3.tpl][6] | File | +| ![File text/x-perl][3] [polio3s.tpl][7] | File | +| [Negative binomial serially correlated counts ][8] | Page | +| ![Image PNG image][9] [polio_plot.png][10] | Image | + +Document Actions + +* [RSS feed][11] + +[1]: http://www.admb-project.org/unknown.png +[2]: negative-binomial-serially-correlated-counts/polio.dat/view.html "" +[3]: http://www.admb-project.org/application.png +[4]: negative-binomial-serially-correlated-counts/polio2.tpl/view.html "" +[5]: negative-binomial-serially-correlated-counts/polio2s.tpl/view.html "" +[6]: negative-binomial-serially-correlated-counts/polio3.tpl/view.html "" +[7]: negative-binomial-serially-correlated-counts/polio3s.tpl/view.html "" +[8]: negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.html "" +[9]: http://www.admb-project.org/png.png +[10]: negative-binomial-serially-correlated-counts/polio_plot.png/view.html "" +[11]: negative-binomial-serially-correlated-counts/RSS "" diff --git a/glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.md b/glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.md new file mode 100644 index 0000000..62e7f75 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.md @@ -0,0 +1,17 @@ +# Owl nestling negotiation + +**This example is part of the [NCEAS non-linear modelling project][1]** + +**Authors: Ben Bolker, Mollie Brooks, Beth Gardner, Cleridy Lennert, Mihoko Minami** + +The data for this example, taken from Zuur et al. (2009) and ultimately from Roulin and Bersier (2007), quantify the number of vocalizations (sibling negotiations) by owl chicks in different nests as a function of food treatment (deprived or satiated), the sex of the parent, and arrival time of the parent at the nest. + +This problem is basically a zero-inflated generalized linear mixed model, where numbers of negotiations are the response variable, food treatment/arrival time/parental sex are the fixed-effect predictors, and sites are a random effect. The presence of zero-inflation puts the problem beyond standard GLMM implementations. In R, the MCMCglmm package allows for zero-inflation, or one can implement an expectation-maximization function. The problem is relatively straightforward in JAGS, or in ADMB, and one can also use the glmmADMB package in R. + +[Documentation][2] + +[Source code][3] + +[1]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[2]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/owls/WRITEUP/owls.pdf +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/owls diff --git a/glmm-generalized-linear-mixed-models/gams-as-mixed-models/gams-as-mixed-models.md b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/gams-as-mixed-models.md new file mode 100644 index 0000000..74c446c --- /dev/null +++ b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/gams-as-mixed-models.md @@ -0,0 +1,26 @@ +# GAMs as mixed models + +Contents +: + +Generalized additive models (GAMs) refers to the simplifying assumption that the response variable depends additively on a set of covariates, as in linear regression, but each covariate can act nonlinearly. We thus have a model  + +         response = some-transformation[  b1(x1) b2(x2) ... bk(xk)  ] + +where the b(x)'s are taken to be smoothing splines (see ). This "smoothing" aspect is basically that some restriction is put on the flexibility of the spline, controlled by a smoothing parameter which is estimated from data. + +  + +### Spline models as mixed models + +It is widely recognized that spline models can be fit with mixed-model software. In this framework the smoothing parameter is estimated as a "variance". These examples illustrate how ADMB-RE can be used to fit such models. There are different ways of paramerizing the splines. + +  + +Often the penalty is put on the second derivative of the spline (wiggliness), which means that no penalty is put on the linear part. In mixed model terminiology this means that the linear part are "fixed effects" while the higher order terms are "random effects". + +  + +### Examples + +See subfolders to the left \ No newline at end of file diff --git a/glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models.md b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models.md new file mode 100644 index 0000000..d222c00 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models.md @@ -0,0 +1,31 @@ +# Eilers & Marx parameterization + +Parameterization of the spline from Eilers & Marx (1996) + +### **Model description** + +Since their introduction by Hastie & Tibshirani in the late 80ies, GAM's have become very popular. This example shows how to fit a GAM using penalized splines. The reason why GAM's can easily be handled in ADMB-RE is that penalized splines are a special case of random effects. ADMB-RE automatically estimates the degrees of freedom for each spline component, as this only amounts to estimate the variance of the random effects. A more detailed discussion of the model and the estimation approach can be found here: [union.pdf][1] + +  + +The data, which are available from Statlib (lib.stat.cmu.edu/), contain information for each of 534 workers about whether they are members (y=1) of a workers union or not (y=0). The goal is to model the probability of membership as a function of various covariates. + +  + +### Details + +[union.pdf][2] + +  + +### Files + +See "Navigation" box to the left. + +* .tpl:  Model file +* .dat: Data file +* .pin: Starting values for the numerical optimizer +* .par: Result file (what you get when you compile and run your model) + +[1]: generalized-additive-models/union.pdf +[2]: generalized-additive-models/union.pdf "union.pdf" diff --git a/glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance.md b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance.md new file mode 100644 index 0000000..ef25f01 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance.md @@ -0,0 +1,26 @@ +# Mean and variance + +Both mean and variance vary smoothly as a function of a covariate. Example of model with two smoothing splines, each with their own smoothing parameter + +An assumption underlying ordinary regression is that all observations have the same variance. This assumption does not always hold, as for the data shown in the figure below (upper panel). It is clear that the variance increases to the right. It is also clear that the mean of _y_ is not a linear function of _x_. Penalized splines can be used to model the mean and variance of _y_ non-parametrically. In order to ensure that the variance is positive, we model the log-variance by a spline function, rather than the variance itself. A more detailed discussion of the model and the estimation approach can be found here:  + +![Lidar plot][1]  + +  + +The LIDAR data shown in the figure below are taken from the book Ruppert et al. (2003). The file "lidar.s" shows how to create design matrices for B-splines in R (S-Plus). When sourced into R, the file creates the input file for ADMB "lidar.dat". You can use "lidar.s" as a basis for you own spline models. + +  + +### Prediction interval + +It could be interesting to look at a prediction interval for a new observation. The uncertainty in that interval would have to depend on the uncertainty of both splines. +  + +  + +### **References** + +Ruppert, D., Wand, M. & Carroll, R. (2003), _Semiparametric Regression_, Cambridge University Press. + +[1]: mean-and-variance/copy_of_lidar.jpg/image_preview.jpg "Lidar plot" diff --git a/glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization.md b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization.md new file mode 100644 index 0000000..508d431 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization.md @@ -0,0 +1,18 @@ +# Wood (2006) parameterization + +Filed under: [Splines][1] + +The following example shows how the parameterization of the smoothing spline, based on eigen decomposition, can be implemented in ADMB. Comparison is made to R/gmcv. An advantage offered by ADMB is that uncertainty in the smoothing parameter is incorporated into the uncertainty of the GAM fit. + +  + +Model description: [binom_gam_ML_example.pdf][2] + +  + +### Files + +ADMB files, data and R files are given to the left + +[1]: http://www.admb-project.org/@@search?Subject:list=Splines +[2]: wood-2006-parameterization/binom_gam_ML_example.pdf "binom_gam_ML_example.pdf" diff --git a/glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads.md b/glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads.md new file mode 100644 index 0000000..4df53fc --- /dev/null +++ b/glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads.md @@ -0,0 +1,41 @@ +# BCB bowheads + +Filed under: [Abundance estimation][1], [REML][2] + +Zeh & Punt (2005) combined data from two different counting methodologies in order to estimate the rate of increase of BCB bowhead whales. On a log-scale they fitted a linear mixed-effects models using REML estimates for the variance parameters. This example shows how random effects in ADMB can be used to obtain REML estimates. + +  + +Restricted maximum likelihood estimation (REML) is often used to estimate variance parameters in the linear mixed-model: + +_y_ = _X*b_ _Z*u_ _e_ + +_ +_ + +where _X_ and _Z_ are covariate matrices, _b_ are the fixed-effects, _u_ are the random effects and _e_ are the error terms. One way of defining the REML procedure is to: + +* Assign a flat prior to _b._ +* Integrate the likelihood with respect to both _b_ and _u_. +The resulting REML likelihood is then maximized with respect to the variance parameters (variances of _u_ and _e_). + +  + +To implement this in ADMB-RE we declare both _b_ and _u_ as random effects vectors. As a result, the likelihood is integrated with respect to both parameters. But, while there is a contribution to the objective function comming from the random effects distribution of _u_, there should be no such contribution from _b _(i.e. a flat prior). + +  + +Using this procedure you do not have to derive the "REML correction" to the log-likelihood function by hand. It is done automatically for you by ADMB-RE. + +  + +### References + +  + +Zeh, J.E., and A.E. Punt. "Updated 1978-2001 Abundance Estimates and Their Correlations for  the Bering-Chukchi-Beaufort Seas Stock of Bowhead Whales." Journal of Cetacean  + +Research and Management 7, no. 2 (2005): 169-75.  + +[1]: http://www.admb-project.org/@@search?Subject:list=Abundance estimation +[2]: http://www.admb-project.org/@@search?Subject:list=REML diff --git a/glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models.md b/glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models.md new file mode 100644 index 0000000..c752e07 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models.md @@ -0,0 +1,13 @@ +# Gaussian models + +Models where both the response and latent random variable are Gaussian. For such models the covariance matrix of the observations can be worked out analytically, but still the latent variable (random effect) formulation can be beneficial. + +[BCB bowheads][1] +: Abundance estimation of BCB bowhead whales + +Document Actions + +* [RSS feed][2] + +[1]: gaussian-models/bcb-bowheads.html +[2]: gaussian-models/RSS "" diff --git a/glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models.md b/glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models.md new file mode 100644 index 0000000..851ed38 --- /dev/null +++ b/glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models.md @@ -0,0 +1,27 @@ +# GLM/GLMM/GAM + +[GAMs as mixed models][1] +: Generalized Additive Models + +[Non Gaussian random effects][2] +: ADMB allows non-Gaussian random effects via transformation of a normal variate + +[Count data][3] +: Poisson, negative binomial counts in various variants + +[Mixed response][4] +: Models with responses of different types + +[Gaussian models][5] +: Models where both the response and latent random variable are Gaussian. For such models the covariance matrix of the observations can be worked out analytically, but still the latent variable (random effect) formulation can be beneficial. + +Document Actions + +* [RSS feed][6] + +[1]: glmm-generalized-linear-mixed-models/gams-as-mixed-models.html +[2]: glmm-generalized-linear-mixed-models/non-gaussian-random-effects.html +[3]: glmm-generalized-linear-mixed-models/count-data.html +[4]: glmm-generalized-linear-mixed-models/mixed-response.html +[5]: glmm-generalized-linear-mixed-models/gaussian-models.html +[6]: glmm-generalized-linear-mixed-models/RSS "" diff --git a/glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease.md b/glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease.md new file mode 100644 index 0000000..a8d854f --- /dev/null +++ b/glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease.md @@ -0,0 +1,39 @@ +# Diet and heart disease + +Filed under: [-gh (Gauss Hermite integration)][1], [Social science][2], [Transformations of RE][3], [non-gaussian random effect][4], [Skrondal and Rabe-Hesketh (2004)][5] + +Example where the observations are of mixed type: continuous and discrete. Also and example of skewed random effects. + +A description of the model and data is given here: [skewed_re.pdf][6] + +  + +It is customary to assume that random effects are normally distributed. Skrondal and Rabe-Hesketh (2004, Section 14.2) consider a measurement error problem, and compare the following two models: + +1. Random effects normally distributed +2. Non-parametric model for the random effects +A description of the model and data is given here: [skewed_re.pdf][6]. The non-parametric model 2) indicates that the random effects distribution is skewed to the right. + +  + +In this example we show: 1) how to implement the model with normal random effects in ADMB-RE (diet.tpl) and 2) how to modify the the program to obtain skewed random effects (diet_sk.tpl). Only a small number of changes are needed to modify the ADMB-RE code to implement the skewed random effects. + +### Results + +By looking at the result files (diet.par and diet_sk.par) we observe the following: + +1. The estimated parameters under the normal model match very closely the estimates in Table 14.1 of Skrondal and Rabe-Hesketh (2004). +2. The log-likelihood value for the normal model is -1372.35, while the log-likelihood for the model with skewed random effects is -1326.49. Hence, given that the skewed model only contains one extra parameter, it gives a much better fit to data. + +### References + +Skrondal and Rabe-Hesketh (2004), Generalized Latent Variable Modeling: Multilevel, Longitudinal and Structural Equation Models. Chapman & Hall + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=-gh (Gauss Hermite integration) +[2]: http://www.admb-project.org/@@search?Subject:list=Social science +[3]: http://www.admb-project.org/@@search?Subject:list=Transformations of RE +[4]: http://www.admb-project.org/@@search?Subject:list=non-gaussian random effect +[5]: http://www.admb-project.org/@@search?Subject:list=Skrondal and Rabe-Hesketh (2004) +[6]: diet-and-heart-disease/skewed_re.pdf "skewed_re.pdf" diff --git a/glmm-generalized-linear-mixed-models/mixed-response/mixed-response.md b/glmm-generalized-linear-mixed-models/mixed-response/mixed-response.md new file mode 100644 index 0000000..8e9b0ec --- /dev/null +++ b/glmm-generalized-linear-mixed-models/mixed-response/mixed-response.md @@ -0,0 +1,13 @@ +# Mixed response + +Models with responses of different types + +[Diet and heart disease][1] +: Continuous and discrete observation sharing being influenced by a latent random variable + +Document Actions + +* [RSS feed][2] + +[1]: mixed-response/diet-and-heart-disease.html +[2]: mixed-response/RSS "" diff --git a/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model.md b/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model.md new file mode 100644 index 0000000..83a816b --- /dev/null +++ b/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model.md @@ -0,0 +1,9 @@ +# Beta-binomial model + +Comparison of ADMB-RE and h-GLM fits of a binomial-beta model to the seed germination dataset + +### Model and Results + +[binbeta.pdf][1] + +[1]: beta-binomial-model/binbeta.pdf "binbeta.pdf" diff --git a/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects.md b/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects.md new file mode 100644 index 0000000..64ebd8f --- /dev/null +++ b/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects.md @@ -0,0 +1,17 @@ +# Non Gaussian random effects + +ADMB allows non-Gaussian random effects via transformation of a normal variate + +[Beta-binomial model][1] +: Binomial response with random effects having beta distribution. Comparison to Winbugs and h-GLM + +[Wildflowers][2] +: A binomial generalized linear mixed model example from the NCEAS non-linear modelling working group. + +Document Actions + +* [RSS feed][3] + +[1]: non-gaussian-random-effects/beta-binomial-model.html +[2]: non-gaussian-random-effects/wildflowers.html +[3]: non-gaussian-random-effects/RSS "" diff --git a/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.md b/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.md new file mode 100644 index 0000000..d528f6f --- /dev/null +++ b/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.md @@ -0,0 +1,21 @@ +# Wildflowers + +**This example is part of the [NCEAS non-linear modelling project][1]** + +**Authors: Elizabeth Crone, Mollie Brooks, and Perry de Valpine** + +These data are from E. Crone and colleagues' long-term study of stages, flowering, and seed pod production of _Astragulus scaphoides_. The model looks at individual flowering as a function of the previous year's stage and seed production. + +  + +This is a binomial generalized linear mixed model for flowering probability with three random effects: intercept and effect of size across individuals and intercept variation across years. + +[Documentation][2] + +[Source code][3] + +  + +[1]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[2]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/wildflower/WRITEUP/wildflower.pdf +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/wildflower diff --git a/growth-models/citations.md b/growth-models/citations.md new file mode 100644 index 0000000..96598e1 --- /dev/null +++ b/growth-models/citations.md @@ -0,0 +1,26 @@ +# This page does not seem to exist… + +We apologize for the inconvenience, but the page you were trying to access is not at this address. You can use the links below to help you find what you are looking for. + +If you are certain you have the correct web address but are encountering an error, please contact the [Site Administration][1]. + +Thank you. + +### You might have been looking for… + +[Growth models][2] +: + +[Growth models][2] +: + +[Orange trees][3] +: Simple growth curve example with individual effects (random effects) from Pinheiro & Bates (2000) + +[Journal papers and Formal publications][4] +: + +[1]: http://www.admb-project.org/contact-info +[2]: http://www.admb-project.org/examples/growth-models +[3]: http://www.admb-project.org/examples/growth-models/orange-trees/orange-trees +[4]: http://www.admb-project.org/users/bibliography/journal-papers-and-formal-publications diff --git a/growth-models/orange-trees/extension-correlated-res/extension-correlated-res.md b/growth-models/orange-trees/extension-correlated-res/extension-correlated-res.md new file mode 100644 index 0000000..56f3ee4 --- /dev/null +++ b/growth-models/orange-trees/extension-correlated-res/extension-correlated-res.md @@ -0,0 +1,10 @@ +# Extension: correlated RE's + +Filed under: [Correlated RE's][1] + +Add random effects to all 3 phi's, and attempt to estimate correlations + +The purpose of this example is to show one way of implementing correlated random effects. The example is supposed to be a template for building models with correlated random effects, AND THE PROVIDED DATASET IS NOT MEANT TO GIVE ANY MEANINGFUL RESULTS. As a starting point we take the logistic growth-curve model studied the [ orange data ][2] example. In that model there are three parameters (f2, f2, f3), of which only f1 is associated with a random effect. Here, we extend the model by including a random effect for all three parameters, and the random effects are allowed to be correlated as explained in the ADMB-RE. + +[1]: http://www.admb-project.org/@@search?Subject:list=Correlated RE's +[2]: orange/orange.html diff --git a/growth-models/orange-trees/extension-crossed-res/extension-crossed-res.md b/growth-models/orange-trees/extension-crossed-res/extension-crossed-res.md new file mode 100644 index 0000000..6d286db --- /dev/null +++ b/growth-models/orange-trees/extension-crossed-res/extension-crossed-res.md @@ -0,0 +1,16 @@ +# Extension: crossed RE's + +Adds a "day effect" following Millar (2004, Aust NZ J. Stat, 46, p. 543-554) + +The following example was considered by Millar (2004, Aust NZ J. Stat, 46, p. 543-554). A "day effect" (_v_) was added to the original model formulation, yielding + +  + +_yij_ = f1,_ij_ /(1 exp[-(_t_-f2)/f3]) ] e_ij_, + +f1,_ij_ = f1 _ui_ _vj_ + +_ +_ + +where _u_ is a tree-effect and _v_ is a day-effect. This is an example of a model where the random effects _u_ and _v_ are crossed. Millar (2004) used simulated likelihood to evaluate the marginal likelihood.  \ No newline at end of file diff --git a/growth-models/orange-trees/orange-trees.md b/growth-models/orange-trees/orange-trees.md new file mode 100644 index 0000000..b81ff3b --- /dev/null +++ b/growth-models/orange-trees/orange-trees.md @@ -0,0 +1,40 @@ +# Orange trees + +Filed under: [Growth models][1] + +Simple growth curve example with individual effects (random effects) from Pinheiro & Bates (2000) + +A growth curve model fitted to the "orange tree" data by [Pinheiro & Bates (2000, Ch.8.2)][2] as an illustration of the [R][3] (S-Plus) routine nlme(). The logistic growth curve is given as + +  + +_y_ = f1 /(1 exp[-(_t_-f2)/f3]) ] e, + +  + +where _y_ is the response and _t_ is the age of the tree. The regression parameters to be estimated are: f1, f2 and f3, and e is the residual error term. A random effect _u_ is added to the parameter f1. + +  + +### Details + +[orange.pdf][4] + +  + +### Extension of the model + +See subfolders to the left  + +### Files + +See list to the left + +  + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=Growth models +[2]: citations.html#pinh:bate:2000 +[3]: http://www.r-project.org/ +[4]: orange-trees/orange.pdf "orange.pdf" diff --git a/growth-models/orange-trees/orange/orange.md b/growth-models/orange-trees/orange/orange.md new file mode 100644 index 0000000..bc93887 --- /dev/null +++ b/growth-models/orange-trees/orange/orange.md @@ -0,0 +1,58 @@ +# This page does not seem to exist… + +We apologize for the inconvenience, but the page you were trying to access is not at this address. You can use the links below to help you find what you are looking for. + +If you are certain you have the correct web address but are encountering an error, please contact the [Site Administration][1]. + +Thank you. + +### You might have been looking for… + +[Orange trees][2] +: + +[Orange trees][2] +: + +![File][3] [orange.pin][4] +: + +![File chemical/x-mopac-input][5] [orange.dat][6] +: + +![File][3] [orange.par][7] +: + +![File text/x-perl][3] [orange.tpl][8] +: + +![File PDF document][9] [orange.pdf][10] +: + +[ADMB-11.4 released][11] +: Minor release + +[Orange trees][12] +: Simple growth curve example with individual effects (random effects) from Pinheiro & Bates (2000) + +![File ZIP archive][13] [papers.zip][14] +: Fournier et al. (2012) & Bolker et al. (2013, incl. orange example) + +[Extension: correlated RE's][15] +: Add random effects to all 3 phi's, and attempt to estimate correlations + +[1]: http://www.admb-project.org/contact-info +[2]: http://www.admb-project.org/examples/growth-models/orange-trees +[3]: http://www.admb-project.org/application.png +[4]: http://www.admb-project.org/examples/growth-models/orange-trees/orange.pin/view +[5]: http://www.admb-project.org/unknown.png +[6]: http://www.admb-project.org/examples/growth-models/orange-trees/orange.dat/view +[7]: http://www.admb-project.org/examples/growth-models/orange-trees/orange.par/view +[8]: http://www.admb-project.org/examples/growth-models/orange-trees/orange.tpl/view +[9]: http://www.admb-project.org/pdf.png +[10]: http://www.admb-project.org/examples/growth-models/orange-trees/orange.pdf/view +[11]: http://www.admb-project.org/news/admb-11-4-released +[12]: http://www.admb-project.org/examples/growth-models/orange-trees/orange-trees +[13]: http://www.admb-project.org/zip.png +[14]: http://www.admb-project.org/developers/workshop/reykjavik-2013/papers.zip/view +[15]: http://www.admb-project.org/examples/growth-models/orange-trees/extension-correlated-res/extension-correlated-res diff --git a/html_files.txt b/html_files.txt index 459f71e..485e059 100644 --- a/html_files.txt +++ b/html_files.txt @@ -1,108 +1,103 @@ -copy_of_new-examples3849 -admb-tricks/variance-calculations/variance-calculations -admb-tricks/variance-calculations/variance-in-re-models/variance-in-re-models -admb-tricks/adjoint-code-1/adjoint-code-1 -admb-tricks/admb-tricks -admb-tricks/splines-1/splines-1 -admb-tricks/splines-1/splines/splines -admb-tricks/parameterization/parameterization -admb-tricks/parameterization/covariance-matrices/covariance-matrices -admb-tricks/covariance-calculations/covariance-calculations -simple-examples/tadpole-mortality-as-a-function-of-size -simple-examples/simple-examples -growth-models/orange-trees/orange/orange -growth-models/orange-trees/orange-trees -growth-models/orange-trees/extension-crossed-res/extension-crossed-res -growth-models/orange-trees/extension-correlated-res/extension-correlated-res -growth-models/citations -by-field-of-application/stochastic-volatility-collection -by-field-of-application/copy_of_medical-biometrics -by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1 -by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller -by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect -by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect -by-field-of-application/by-field-of-application -by-field-of-application/medical-biometrics -copy_of_new-examplesa891 -copy_of_new-examples8c63 -text-books/maximum-likelihood-estimation-and-inference-by-russell-millar -text-books/text-books -text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r -glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models -glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models -glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads -glmm-generalized-linear-mixed-models/gams-as-mixed-models -glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models -glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance -glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization -glmm-generalized-linear-mixed-models/mixed-response/mixed-response -glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease -glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers -glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects -glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model -glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model -glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial -glmm-generalized-linear-mixed-models/count-data/count-data -glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data -glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model -glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1 -glmm-generalized-linear-mixed-models/count-data/citations -glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts -glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation -index -differential-equations/pk-dk -differential-equations/differential-equations -differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model -differential-equations/mineralization-of-terbuthylazine -spatial-models/the-geostatistical-approach/the-geostatistical-approach -spatial-models/separable-different-implementation/separable-different-implementation -spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids -spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data -spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function -spatial-models/spatial-models -state-space-models/skate-mortality-bayesian-state-space-model -state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model -state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series -state-space-models/citations -state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model -state-space-models/state-space-models -state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model -copy_of_new-examples51a2 -copy_of_new-examples9f54 -uploading-examples-to-github -r-stuff/glmmadmb -r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb -r-stuff/mcmcmc/mcmcmc -r-stuff/lmer-comparison/lmer-comparison -r-stuff/a-general-r-admb-interface-for-mixed-models/a-general-r-admb-interface-for-mixed-models -r-stuff/r-stuff -categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1 -categorical-data/categorical-data -categorical-data/ordered-categorical-responses -fisheries/a-fisheries-model-with-random-effects-1 -fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code -fisheries/pella-t/pella-t -fisheries/fisheries -fisheries/pella/pella -fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation -winbugs/winbugs -winbugs/occupancy-model -mark-recapture/mark-recapture -mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb -mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1 -mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models -mark-recapture/mark-recapture-random-effects-model -storage/storage -survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring -survival-analysis/survival-analysis -copy_of_new-examples -new-examples/new-examples -miscellaneous/miscellaneous -miscellaneous/nceas-working-group-examples -miscellaneous/otter-reseach-collection -sampling/sampling -sampling/line-transect-methods/random-scale -sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function -sampling/line-transect-methods/line-transect-methods -function-minimization/function-minimization -function-minimization/parameter-scaling +/home/epy00n/Desktop/admb-examples/admb-tricks/admb-tricks.html +/home/epy00n/Desktop/admb-examples/admb-tricks/splines-1/splines-1.html +/home/epy00n/Desktop/admb-examples/admb-tricks/splines-1/splines/splines.html +/home/epy00n/Desktop/admb-examples/admb-tricks/parameterization/parameterization.html +/home/epy00n/Desktop/admb-examples/admb-tricks/parameterization/covariance-matrices/covariance-matrices.html +/home/epy00n/Desktop/admb-examples/admb-tricks/covariance-calculations/covariance-calculations.html +/home/epy00n/Desktop/admb-examples/simple-examples/tadpole-mortality-as-a-function-of-size.html +/home/epy00n/Desktop/admb-examples/simple-examples/simple-examples.html +/home/epy00n/Desktop/admb-examples/growth-models/orange-trees/orange/orange.html +/home/epy00n/Desktop/admb-examples/growth-models/orange-trees/orange-trees.html +/home/epy00n/Desktop/admb-examples/growth-models/orange-trees/extension-crossed-res/extension-crossed-res.html +/home/epy00n/Desktop/admb-examples/growth-models/orange-trees/extension-correlated-res/extension-correlated-res.html +/home/epy00n/Desktop/admb-examples/growth-models/citations.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/copy_of_medical-biometrics/copy_of_medical-biometrics.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/stochastic-volatility-collection/stochastic-volatility-collection.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/the-basic-sv-model-and-simple-extensions-1.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/by-field-of-application.html +/home/epy00n/Desktop/admb-examples/by-field-of-application/medical-biometrics/medical-biometrics.html +/home/epy00n/Desktop/admb-examples/copy_of_new-examplesa891.html +/home/epy00n/Desktop/admb-examples/copy_of_new-examples8c63.html +/home/epy00n/Desktop/admb-examples/text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.html +/home/epy00n/Desktop/admb-examples/text-books/text-books.html +/home/epy00n/Desktop/admb-examples/text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/gams-as-mixed-models/gams-as-mixed-models.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/mixed-response/mixed-response.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/count-data.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/citations.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.html +/home/epy00n/Desktop/admb-examples/glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.html +/home/epy00n/Desktop/admb-examples/index.html +/home/epy00n/Desktop/admb-examples/differential-equations/differential-equations.html +/home/epy00n/Desktop/admb-examples/differential-equations/pk-dk/pk-dk.html +/home/epy00n/Desktop/admb-examples/differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model.html +/home/epy00n/Desktop/admb-examples/differential-equations/mineralization-of-terbuthylazine.html +/home/epy00n/Desktop/admb-examples/spatial-models/the-geostatistical-approach/the-geostatistical-approach.html +/home/epy00n/Desktop/admb-examples/spatial-models/separable-different-implementation/separable-different-implementation.html +/home/epy00n/Desktop/admb-examples/spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids.html +/home/epy00n/Desktop/admb-examples/spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data.html +/home/epy00n/Desktop/admb-examples/spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function.html +/home/epy00n/Desktop/admb-examples/spatial-models/spatial-models.html +/home/epy00n/Desktop/admb-examples/state-space-models/skate-mortality-bayesian-state-space-model.html +/home/epy00n/Desktop/admb-examples/state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.html +/home/epy00n/Desktop/admb-examples/state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series.html +/home/epy00n/Desktop/admb-examples/state-space-models/citations.html +/home/epy00n/Desktop/admb-examples/state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.html +/home/epy00n/Desktop/admb-examples/state-space-models/state-space-models.html +/home/epy00n/Desktop/admb-examples/state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.html +/home/epy00n/Desktop/admb-examples/copy_of_new-examples51a2.html +/home/epy00n/Desktop/admb-examples/copy_of_new-examples9f54.html +/home/epy00n/Desktop/admb-examples/uploading-examples-to-github.html +/home/epy00n/Desktop/admb-examples/r-stuff/glmmadmb.html +/home/epy00n/Desktop/admb-examples/r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb.html +/home/epy00n/Desktop/admb-examples/r-stuff/mcmcmc/mcmcmc.html +/home/epy00n/Desktop/admb-examples/r-stuff/lmer-comparison/lmer-comparison.html +/home/epy00n/Desktop/admb-examples/r-stuff/a-general-r-admb-interface-for-mixed-models/a-general-r-admb-interface-for-mixed-models.html +/home/epy00n/Desktop/admb-examples/r-stuff/r-stuff.html +/home/epy00n/Desktop/admb-examples/categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1/item-response-theory-irt-and-the-multilevel-rasch-model-1.html +/home/epy00n/Desktop/admb-examples/categorical-data/ordered-categorical-responses/ordered-categorical-responses.html +/home/epy00n/Desktop/admb-examples/categorical-data/categorical-data.html +/home/epy00n/Desktop/admb-examples/fisheries/a-fisheries-model-with-random-effects-1.html +/home/epy00n/Desktop/admb-examples/fisheries/pella-t/pella-t.html +/home/epy00n/Desktop/admb-examples/fisheries/fisheries.html +/home/epy00n/Desktop/admb-examples/fisheries/pella/pella.html +/home/epy00n/Desktop/admb-examples/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.html +/home/epy00n/Desktop/admb-examples/fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.html +/home/epy00n/Desktop/admb-examples/winbugs/winbugs.html +/home/epy00n/Desktop/admb-examples/winbugs/occupancy-model.html +/home/epy00n/Desktop/admb-examples/mark-recapture/mark-recapture.html +/home/epy00n/Desktop/admb-examples/mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.html +/home/epy00n/Desktop/admb-examples/mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.html +/home/epy00n/Desktop/admb-examples/mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models.html +/home/epy00n/Desktop/admb-examples/mark-recapture/mark-recapture-random-effects-model.html +/home/epy00n/Desktop/admb-examples/storage/storage.html +/home/epy00n/Desktop/admb-examples/survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring.html +/home/epy00n/Desktop/admb-examples/survival-analysis/survival-analysis.html +/home/epy00n/Desktop/admb-examples/copy_of_new-examples.html +/home/epy00n/Desktop/admb-examples/new-examples/new-examples.html +/home/epy00n/Desktop/admb-examples/miscellaneous/miscellaneous.html +/home/epy00n/Desktop/admb-examples/miscellaneous/nceas-working-group-examples.html +/home/epy00n/Desktop/admb-examples/miscellaneous/otter-reseach-collection.html +/home/epy00n/Desktop/admb-examples/sampling/sampling.html +/home/epy00n/Desktop/admb-examples/sampling/line-transect-methods/random-scale.html +/home/epy00n/Desktop/admb-examples/sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.html +/home/epy00n/Desktop/admb-examples/sampling/line-transect-methods/line-transect-methods.html +/home/epy00n/Desktop/admb-examples/function-minimization/parameter-scaling/parameter-scaling.html +/home/epy00n/Desktop/admb-examples/function-minimization/function-minimization.html diff --git a/html_files.txt~ b/html_files.txt~ index eeff7ec..47da758 100644 --- a/html_files.txt~ +++ b/html_files.txt~ @@ -1,108 +1 @@ -./copy_of_new-examples3849.html -./admb-tricks/variance-calculations/variance-calculations.html -./admb-tricks/variance-calculations/variance-in-re-models/variance-in-re-models.html -./admb-tricks/adjoint-code-1/adjoint-code-1.html -./admb-tricks/admb-tricks.html -./admb-tricks/splines-1/splines-1.html -./admb-tricks/splines-1/splines/splines.html -./admb-tricks/parameterization/parameterization.html -./admb-tricks/parameterization/covariance-matrices/covariance-matrices.html -./admb-tricks/covariance-calculations/covariance-calculations.html -./simple-examples/tadpole-mortality-as-a-function-of-size.html -./simple-examples/simple-examples.html -./growth-models/orange-trees/orange/orange.html -./growth-models/orange-trees/orange-trees.html -./growth-models/orange-trees/extension-crossed-res/extension-crossed-res.html -./growth-models/orange-trees/extension-correlated-res/extension-correlated-res.html -./growth-models/citations.html -./by-field-of-application/stochastic-volatility-collection.html -./by-field-of-application/copy_of_medical-biometrics.html -./by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1.html -./by-field-of-application/stochastic-volatility-collection/the-basic-sv-model-and-simple-extensions-1/modeller.html -./by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect.html -./by-field-of-application/stochastic-volatility-collection/sv-models-with-leverage-effect/sv-models-with-leverage-effect.html -./by-field-of-application/by-field-of-application.html -./by-field-of-application/medical-biometrics.html -./copy_of_new-examplesa891.html -./copy_of_new-examples8c63.html -./text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.html -./text-books/text-books.html -./text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r.html -./glmm-generalized-linear-mixed-models/glmm-generalized-linear-mixed-models.html -./glmm-generalized-linear-mixed-models/gaussian-models/gaussian-models.html -./glmm-generalized-linear-mixed-models/gaussian-models/bcb-bowheads/bcb-bowheads.html -./glmm-generalized-linear-mixed-models/gams-as-mixed-models.html -./glmm-generalized-linear-mixed-models/gams-as-mixed-models/generalized-additive-models/generalized-additive-models.html -./glmm-generalized-linear-mixed-models/gams-as-mixed-models/mean-and-variance/mean-and-variance.html -./glmm-generalized-linear-mixed-models/gams-as-mixed-models/wood-2006-parameterization/wood-2006-parameterization.html -./glmm-generalized-linear-mixed-models/mixed-response/mixed-response.html -./glmm-generalized-linear-mixed-models/mixed-response/diet-and-heart-disease/diet-and-heart-disease.html -./glmm-generalized-linear-mixed-models/non-gaussian-random-effects/wildflowers.html -./glmm-generalized-linear-mixed-models/non-gaussian-random-effects/non-gaussian-random-effects.html -./glmm-generalized-linear-mixed-models/non-gaussian-random-effects/beta-binomial-model/beta-binomial-model.html -./glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial-model.html -./glmm-generalized-linear-mixed-models/count-data/flexible-negative-binomial-model/flexible-negative-binomial.html -./glmm-generalized-linear-mixed-models/count-data/count-data.html -./glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model-polio-data.html -./glmm-generalized-linear-mixed-models/count-data/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.html -./glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/negative-binomial-fir-fecundity-1.html -./glmm-generalized-linear-mixed-models/count-data/citations.html -./glmm-generalized-linear-mixed-models/count-data/negative-binomial-serially-correlated-counts/negative-binomial-serially-correlated-counts.html -./glmm-generalized-linear-mixed-models/count-data/owl-nestling-negotiation.html -./index.html -./differential-equations/pk-dk.html -./differential-equations/differential-equations.html -./differential-equations/pk-dk/one-compartment-open-model/one-compartment-open-model.html -./differential-equations/mineralization-of-terbuthylazine.html -./spatial-models/the-geostatistical-approach/the-geostatistical-approach.html -./spatial-models/separable-different-implementation/separable-different-implementation.html -./spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids.html -./spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data.html -./spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function.html -./spatial-models/spatial-models.html -./state-space-models/skate-mortality-bayesian-state-space-model.html -./state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.html -./state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series.html -./state-space-models/citations.html -./state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.html -./state-space-models/state-space-models.html -./state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.html -./copy_of_new-examples51a2.html -./copy_of_new-examples9f54.html -./uploading-examples-to-github.html -./r-stuff/glmmadmb.html -./r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb.html -./r-stuff/mcmcmc/mcmcmc.html -./r-stuff/lmer-comparison/lmer-comparison.html -./r-stuff/a-general-r-admb-interface-for-mixed-models/a-general-r-admb-interface-for-mixed-models.html -./r-stuff/r-stuff.html -./categorical-data/item-response-theory-irt-and-the-multilevel-rasch-model-1.html -./categorical-data/categorical-data.html -./categorical-data/ordered-categorical-responses.html -./fisheries/a-fisheries-model-with-random-effects-1.html -./fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code.html -./fisheries/pella-t/pella-t.html -./fisheries/fisheries.html -./fisheries/pella/pella.html -./fisheries/a-fisheries-model-solving-the-baranov-catch-equation-using-adjoint-code/baranov-catch-equation.html -./winbugs/winbugs.html -./winbugs/occupancy-model.html -./mark-recapture/mark-recapture.html -./mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.html -./mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.html -./mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models.html -./mark-recapture/mark-recapture-random-effects-model.html -./storage/storage.html -./survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring.html -./survival-analysis/survival-analysis.html -./copy_of_new-examples.html -./new-examples/new-examples.html -./miscellaneous/miscellaneous.html -./miscellaneous/nceas-working-group-examples.html -./miscellaneous/otter-reseach-collection.html -./sampling/sampling.html -./sampling/line-transect-methods/random-scale.html -./sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.html -./sampling/line-transect-methods/line-transect-methods.html -./function-minimization/function-minimization.html -./function-minimization/parameter-scaling.html +/home/epy00n/Desktop/admb-examples/admb-tricks/admb-tricks.html diff --git a/index.md b/index.md new file mode 100644 index 0000000..9bde7ed --- /dev/null +++ b/index.md @@ -0,0 +1,27 @@ +# Examples + +Good examples are an important part of the ADMB documentation. The examples are categorised (see left) and include the ADMB files needed to run the model. Users are encouraged to contribute their own examples. Warning: currently the hierarchy of examples is under reorganization and hence linking to examples may be risky. (Better to link directly to underlying external material in case that is provided). + +### How to submit your own example + +* Upload the example to **your own **webpage +* There are no style requirements (but .tpl .dat files are encouraged) +* Send an email (Subject  "Example submission") to [users@admb-project.org][1] containing: + + * **Link** (URL) to the example + * **Title** of the example + * **Abstract** + + +The abstract will be uploaded to the ADMB project website. The rest will remain on **your **webpage. In that way you will be able to make changes later on. If you do not have your own webpage you can use [_Uploading examples to github_][2]. + + +Please suggest one of the categories to the left, or feel free to suggest new categories if you do not find the existing ones suitable. + + +See also [NCEAS examples (ADMB/R/BUGS)][3] from [Bolker et al. (2013][4]). + +[1]: mailto:users@admb-project.org +[2]: uploading-examples-to-github.html "Uploading examples to github" +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[4]: http://dx.doi.org/10.1111/2041-210X.12044 diff --git a/mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.md b/mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.md new file mode 100644 index 0000000..1a9b37f --- /dev/null +++ b/mark-recapture/cormack-jolly-seber-models/cjs-individual-heterogeneity-1.md @@ -0,0 +1,19 @@ +# CJS Individual Heterogeneity + +Filed under: [R2admb][1], [CJS model][2], [Mark-recapture][3] + +Mixed Effects Cormack-Jolly-Seber Models for Analysis of Capture-Recapture Data + +### Model description + +  + +  + +### All files + + + +[1]: http://www.admb-project.org/@@search?Subject:list=R2admb +[2]: http://www.admb-project.org/@@search?Subject:list=CJS model +[3]: http://www.admb-project.org/@@search?Subject:list=Mark-recapture diff --git a/mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models.md b/mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models.md new file mode 100644 index 0000000..08cb4c6 --- /dev/null +++ b/mark-recapture/cormack-jolly-seber-models/cormack-jolly-seber-models.md @@ -0,0 +1,17 @@ +# CJS Models + +Cormack-Jolly-Seber (CJS) models in different variations + +[A standard CJS model][1] +: Fitting Cormack-Jolly-Seber (CJS) Models to Capture-Recapture Data using R2admb + +[CJS Individual Heterogeneity ][2] +: Mixed Effects Cormack-Jolly-Seber Models for Analysis of Capture-Recapture Data + +Document Actions + +* [RSS feed][3] + +[1]: cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.html +[2]: cormack-jolly-seber-models/cjs-individual-heterogeneity-1.html +[3]: cormack-jolly-seber-models/RSS "" diff --git a/mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.md b/mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.md new file mode 100644 index 0000000..f354f96 --- /dev/null +++ b/mark-recapture/cormack-jolly-seber-models/fitting-cormack-jolly-seber-models-to-capture-recapture-data-using-r2admb.md @@ -0,0 +1,20 @@ +# Fitting Cormack-Jolly-Seber Models to Capture-Recapture Data using R2admb + +Filed under: [Mark software][1], [CJS model][2], [Mark-recapture][3] + +This example provides a template to fit any fixed effects CJS model to capture-recapture data.  This template and code to create the .DAT file are used in the R package marked (__) when use.admb is TRUE. The pdf shows an example with the dipper data that is also analyzed with MARK (__)  through the RMark package (**cran**.[_r-project.org/web/packages/_][4]**RMark**/index.html) to show that the same results are obtained. + +### Model description + + + +### + +### ADMB Files + + __ + +[1]: http://www.admb-project.org/@@search?Subject:list=Mark software +[2]: http://www.admb-project.org/@@search?Subject:list=CJS model +[3]: http://www.admb-project.org/@@search?Subject:list=Mark-recapture +[4]: http://r-project.org/web/packages/ diff --git a/mark-recapture/mark-recapture-random-effects-model.md b/mark-recapture/mark-recapture-random-effects-model.md new file mode 100644 index 0000000..3d2e677 --- /dev/null +++ b/mark-recapture/mark-recapture-random-effects-model.md @@ -0,0 +1,183 @@ +# Mark-Recapture random effects model + +Filed under: [Random effect][1], [Ecology][2], [Mark-recapture][3] + +**Mark-Recapture random effects model** +From: [Mark N. Maunder][4], [Hans J. Skaug][5], David A. Fournier and Simon D. Hoyle. (2009) Comparison of fixed effect, random effect, and hierarchical Bayes estimators for mark recapture data using AD Model builder. + +The model is compiled using the command line option –re + +admb –re name + +For the penguins and albatross applications, an additional command line option is needed when the model is run to ensure there is enough memory -mno 2000 + +name -mno 2000 + +***.tpl file** + + +DATA_SECTION +init_int NRCperiods +init_vector Releases(1,NRCperiods) +ivector temp(1,NRCperiods) +!!temp.fill_seqadd(1,1); +init_matrix data(1,NRCperiods,temp,NRCperiods) + +PARAMETER_SECTION +init_number meanS(1) +init_number ln_sdS(2) +init_number meanp(1) +init_number ln_sdp(2) + +random_effects_vector Sdev(1,NRCperiods,2) +random_effects_vector pdev(1,NRCperiods,2) + +number sdS +number sdp +vector S(1,NRCperiods) +vector p(1,NRCperiods) + +matrix Scum(1,NRCperiods,1,NRCperiods) +matrix Pcum(1,NRCperiods,1,NRCperiods) + +objective_function_value f + +PROCEDURE_SECTION +sdS=mfexp(ln_sdS); +sdp=mfexp(ln_sdp); +S=elem_div(mfexp(meanS Sdev*sdS), +(1 mfexp(meanS Sdev*sdS))); +p=elem_div(mfexp(meanp pdev*sdp), +(1 mfexp(meanp pdev*sdp))); +for (int i=1;i<=NRCperiods;i ) +{ +Scum(i,i)=S(i); +Pcum(i,i)=1; +for (int j=i 1;j<=NRCperiods;j ) +{ +Scum(i,j)=Scum(i,j-1)*S(j); +Pcum(i,j)=Pcum(i,j-1)*(1.0-p(j-1)); +} + +Pcum(i)=elem_prod(Pcum(i),p); + +for (j=i;j<=NRCperiods;j ) f =-data(i,j)*log(Scum(i,j)*Pcum(i,j)); + +f =-(Releases(i)-sum(data(i)))*log(1-sum(elem_prod(Scum(i),Pcum(i)))); +} + +f =0.5*norm2(Sdev) 0.5*norm2(pdev); + + +REPORT_SECTION +report<<"S "< + +  + +  + +  + +[1]: a-general-r-admb-interface-for-mixed-models/mixed_example.pdf "mixed_example.pdf" diff --git a/r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb.md b/r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb.md new file mode 100644 index 0000000..9a37fd5 --- /dev/null +++ b/r-stuff/gamma-distributed-myxomatosis-using-r2admb/gamma-distributed-myxomatosis-using-r2admb.md @@ -0,0 +1,22 @@ +# Gamma distributed myxomatosis using R2admb + +Filed under: [Bolker (2008)][1] + +![File][2] [Description][3] +![File][4] [myxomatosis.R][5] +![File text/x-perl][4] [myxomatosis.tpl][6] +![File chemical/x-mopac-input][7] [myxomatosis.dat][8] + +Document Actions + +* [RSS feed][9] + +[1]: http://www.admb-project.org/@@search?Subject:list=Bolker (2008) +[2]: http://www.admb-project.org/pdf.png +[3]: gamma-distributed-myxomatosis-using-r2admb/description-1/view.html +[4]: http://www.admb-project.org/application.png +[5]: gamma-distributed-myxomatosis-using-r2admb/myxomatosis.R/view.html +[6]: gamma-distributed-myxomatosis-using-r2admb/myxomatosis.tpl/view.html +[7]: http://www.admb-project.org/unknown.png +[8]: gamma-distributed-myxomatosis-using-r2admb/myxomatosis.dat/view.html +[9]: gamma-distributed-myxomatosis-using-r2admb/RSS "" diff --git a/r-stuff/glmmadmb.md b/r-stuff/glmmadmb.md new file mode 100644 index 0000000..f9590c7 --- /dev/null +++ b/r-stuff/glmmadmb.md @@ -0,0 +1,9 @@ +# glmmADMB + +Mixed models for discrete data, allowing for zero inflation. An R package that calls an ADMB program + +glmmADMB is hosted on [R-Forge][1]. + +  + +[1]: http://glmmadmb.r-forge.r-project.org/ diff --git a/r-stuff/lmer-comparison/lmer-comparison.md b/r-stuff/lmer-comparison/lmer-comparison.md new file mode 100644 index 0000000..480ceaa --- /dev/null +++ b/r-stuff/lmer-comparison/lmer-comparison.md @@ -0,0 +1,80 @@ +# lmer() comparison + +Application of ADMB to the simulated datasets in Zhang et al. (2011) with emphasis on comparison to the R function lmer() + +  + +  + +Comparison by David Fournier: + +  + +A few days ago there was a posting + + + +indicating that a reviewer considered lmer less reliable than SAS NLMIXED. The source of this distrust was pehaps the results of the paper Zhang et al. (2011) + +Zhang et al. simulated data from a simple mixed model and used the Wald statistic to test the hypothesis that the value of one of  the fixed effects parameters was equal to 1.0. (the true value in the simulations.) They claimed that the type 1 error rate for lmer was much higher for lmer than for NLMIXED and much higher than the correct value of 5%. + +Type 1 error is when one incorrectly rejects the hypothesis that the true parameter value is 1.0. + +The test consists of taking the parameter estimate -1 divided by its estimated std dev and looking at this value squared. If the value is too large the hypothesis is rejected.  Zhang et al. concluded that the main source of the large type 1 error for lmer was due to systematic underestimation of the std dev of the parameter estimate in lmer. + +The ensuing discussion raised several issues. + +1. SAS is closed source. (This seems to be a religious problem, but it was taken seriously by some.) +2. Is it due to the Laplace approximation (LA) not being accurate enough so that adaptive Gauss-Hermite quadrature (AGQ) will solve the problem. +3. If 2.) is true since AGQ can only be used for nested models this poses a problem with crossed random effects. + +It was interesting that while there was a lot of discussion, no one seemed to want to simply run the simulation and verify or disprove the results reported in Zhang et al. I  think this is important since  for better or worse a lot of people use the std dev estimate for calculating p values. + +To deal  with 1.) I compared lmer to AD Model Builder's random effects package. This is open source software so it should be free from religious objections. AD Model Builder can do both LA and AGQ so that one can get results comparing the improvement of say 5 point AGQ over LA. + +  + +For the simulations I picked the N=500 case from Zhang et al with the std dev tau=2 (large variance case). + +  + +I simulated 1000 data sets using an R script supplied by Ben Bolker. I used a small bash shell script to run R 1000 times. This approach makes it easy to feed the simulated data either into R or the ADMB program. A random nunber seed was kept in a file named seed to make it easy to replicate the results. Initially seed=1000. + +  + +For the first set of runs the Laplace approximation was used in both lmer and ADMB. The result for R were 24.7% type 1 error.  The mean of b1 was 0.978, the std dev of the estimate for b1 was 0.203 and the mean of the estimated std devs from lmer was 0.118. For ADMB the type 1 error rate was 10.2% the mean of b1 was 0.971. The std dev of the estimates was 0.164 and the mean of the estimated std devs was 0.140.  So ADMB performed better than lmer. There appears to be a slight negative bias in the estimates for b1 and the type 1 error rate is about twice the theoretical value of 5%. This would appear to support the findings of Zhang et al that lmer underestimates the std dev of the parameter estimate in this case. + +  + +Can these results be improved with adaptive Gauss-Hermite quadrature? + +For the second set of 1000 runs 5 point AGQ was used. For lmer the type 1 error rate was larger, 31.7%. The mean of b1 was 0.879 so that there appears to be significant bias. The std dev of the estimates was 0.156 and the mean of the estimated std devs was 0.107.  This seems to indicate that there is some bug in the implementation of  AGQ in lmer. For ADMB the type 1 error rate was 4.7%. The mean of b1 was 0.971. The std dev of the estimates was 0.132 and the mean of the estimated std devs was 0.139. This is close to the estimates reported for NLMIXED in Zhang et al. + +  + +### Code to run lmer() + +This is the bash shell script (found on linux) used to run the R simulations. + + for i in {1..1000} + do +  R CMD BATCH ./bolker-par.r + done + +where the R script [_bolker-par.r_][1] must be located in the current directory. + +  + +### Code to run ADMB + +This is the R script for the simulator modifed to write out the simulated data for analysis by ADMB is given here: [_write2admb.r_][2] The following ADMB must be used to fit the model using ADMB: [_analyzer.tpl_][3] + +  + +### References + +Zhang et al. (2011) On fitting generalized linear mixed-effects models for binary responses using different  statistical packages. _Statistics in Medicine_, 30, p. 1097-0258. + +[1]: lmer-comparison/bolker-par.r "bolker-par.r" +[2]: lmer-comparison/write2admb.r "write2admb.r" +[3]: lmer-comparison/analyzer.tpl "analyzer.tpl" diff --git a/r-stuff/mcmcmc/mcmcmc.md b/r-stuff/mcmcmc/mcmcmc.md new file mode 100644 index 0000000..cb1386f --- /dev/null +++ b/r-stuff/mcmcmc/mcmcmc.md @@ -0,0 +1,40 @@ +# MCMCMC + +This presents generalized code for conducting Metropolis Coupled MCMC using ADMB called within R + +![File][1] [Wrapper][2] +: File to conduct MCMCMC using ADMB within R + +![File][1] [Functions][3] +: Functions used by wrapper + +![File text/x-perl][1] [TPL][4] +: TPL used for example + +![File application/x-msdos-program][5] [EXE][6] +: compiled EXE for example + +![File C source code][7] [ADMB_MCMC][8] +: Plot of samples using MCMC + +![File C source code][7] [MCMCMC][9] +: Plot of samples using Metropolis Coupled MCMC (MCMCMC) + +![File][7] [MCMCMC Trace][10] +: Traceplot for MCMCMC sampling + +Document Actions + +* [RSS feed][11] + +[1]: http://www.admb-project.org/application.png +[2]: mcmcmc/wrapper/view.html +[3]: mcmcmc/functions/view.html +[4]: mcmcmc/tpl/view.html +[5]: http://www.admb-project.org/exe.png +[6]: mcmcmc/exe/view.html +[7]: http://www.admb-project.org/image.png +[8]: mcmcmc/admb_mcmc/view.html +[9]: mcmcmc/mcmcmc/view.html +[10]: mcmcmc/mcmcmc-trace/view.html +[11]: mcmcmc/RSS "" diff --git a/r-stuff/r-stuff.md b/r-stuff/r-stuff.md new file mode 100644 index 0000000..858888a --- /dev/null +++ b/r-stuff/r-stuff.md @@ -0,0 +1,23 @@ +# R stuff + +[glmmADMB][1] +[lmer() comparison][2] +: Application of ADMB to the simulated datasets in Zhang et al. (2011) with emphasis on comparison to the R function lmer() + +[Gamma distributed myxomatosis using R2admb][3] +[MCMCMC][4] +: This presents generalized code for conducting Metropolis Coupled MCMC using ADMB called within R + +[R - ADMB interface for mixed models][5] +: Explains how to set up a general mixed model interface between R and ADMB used for instance in glmmADMB + +Document Actions + +* [RSS feed][6] + +[1]: r-stuff/glmmadmb.html +[2]: r-stuff/lmer-comparison.html +[3]: r-stuff/gamma-distributed-myxomatosis-using-r2admb.html +[4]: r-stuff/mcmcmc.html +[5]: r-stuff/a-general-r-admb-interface-for-mixed-models.html +[6]: r-stuff/RSS "" diff --git a/sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.md b/sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.md new file mode 100644 index 0000000..7b16956 --- /dev/null +++ b/sampling/line-transect-methods/estimation-of-detection-function/estimation-of-detection-function.md @@ -0,0 +1,21 @@ +# Estimation of detection function + +Filed under: [Ecology][1] + +Illustrates the likelihood based estimation of the detection function (perpendicular distance) in line transect surveys + +### Model description + +  + +  + +  + +### ADMB Files  + + + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=Ecology diff --git a/sampling/line-transect-methods/line-transect-methods.md b/sampling/line-transect-methods/line-transect-methods.md new file mode 100644 index 0000000..9746730 --- /dev/null +++ b/sampling/line-transect-methods/line-transect-methods.md @@ -0,0 +1,17 @@ +# Line transect methods + +Line transect methods are commonly used to estimate animal abundance, and is a special case of distance sampling. + +[Estimation of detection function ][1] +: Illustrates the likelihood based estimation of the detection function (perpendicular distance) + +[Random scale][2] +: Distance Sampling with Random Scale Detection Function + +Document Actions + +* [RSS feed][3] + +[1]: line-transect-methods/estimation-of-detection-function.html +[2]: line-transect-methods/random-scale.html +[3]: line-transect-methods/RSS "" diff --git a/sampling/line-transect-methods/random-scale.md b/sampling/line-transect-methods/random-scale.md new file mode 100644 index 0000000..0a9bea3 --- /dev/null +++ b/sampling/line-transect-methods/random-scale.md @@ -0,0 +1,52 @@ +# Random scale + +Filed under: [R2admb][1], [Distance sampling][2] + +Distance Sampling with Random Scale Detection Function + +### Theory + +That code fits detection functions with fixed effects for the scale parameter of  a half-normal function. The model is described here:  + +  + +### Files + +  + +The files constitute an R package. You can use it without R but the mixed effect part will be more challenging because the data file includes a design matrix for the fixed effect portion of the model. On the page for the code link there are links that will take you to the TPL and example DAT files. Other detection functions may follow. + +  + +_How to install the R package_: + +  + +  + +### ADMB techniques: likelihood weighting + +This model uses a feature which currently is not part of ADMB: weighting. The weights are used to form a numerator (weight 1) denominator (weights -1) in the conditional probabilities described in the pdf. The part of the code that relates to the weighting is  + + DATA_SECTION + + vector w(1,2*n 2) + + !! w=1.0; + + !! w(2*n 2)=-n; + +   + + PARAMETER_SECTION + + random_effects_vector u(1,n 1); + + !!set_multinomial_weights(w); + +When these features gets incorporated into ADMB in the future they will get better documented. + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=R2admb +[2]: http://www.admb-project.org/@@search?Subject:list=Distance sampling diff --git a/sampling/sampling.md b/sampling/sampling.md new file mode 100644 index 0000000..be2de89 --- /dev/null +++ b/sampling/sampling.md @@ -0,0 +1,13 @@ +# Sampling + +Survey sampling related examples + +[Line transect methods][1] +: Line transect methods are commonly used to estimate animal abundance, and is a special case of distance sampling. + +Document Actions + +* [RSS feed][2] + +[1]: sampling/line-transect-methods.html +[2]: sampling/RSS "" diff --git a/simple-examples/simple-examples.md b/simple-examples/simple-examples.md new file mode 100644 index 0000000..25a73a4 --- /dev/null +++ b/simple-examples/simple-examples.md @@ -0,0 +1,11 @@ +# Simple examples + +[Tadpole mortality as a function of size][1] +: A maximum likelihood estimation problem with a binomial response variable, example from the NCEAS non-linear modelling working group. + +Document Actions + +* [RSS feed][2] + +[1]: simple-examples/tadpole-mortality-as-a-function-of-size.html +[2]: simple-examples/RSS "" diff --git a/simple-examples/tadpole-mortality-as-a-function-of-size.md b/simple-examples/tadpole-mortality-as-a-function-of-size.md new file mode 100644 index 0000000..8554e5a --- /dev/null +++ b/simple-examples/tadpole-mortality-as-a-function-of-size.md @@ -0,0 +1,23 @@ +# Tadpole mortality as a function of size + +**This example is part of the [NCEAS non-linear modelling project][1]** + +**Author: Ben Bolker** + +  + +The data are originally from Vonesh and Bolker (2005), describing the numbers of reed frog (_Hyperolius spinigularis_) tadpoles killed by predators as a function of size in a small-scale field trial. Our main interest is in a quantitative description of the "window of vulnerability", defined as the unimodal pattern of proportion killed as a function of size. In various contexts, we can use this description either to describe and test differences among treatments (e.g., does the window of vulnerability differ by predator size, or with tadpoles exposed to different predator cues?) or to project the effects of growth and mortality rates through a life stage. See the reference above and McCoy et al. (2011) for more details and examples. + +This basic example is essentially a maximum likelihood estimation problem with a binomial response variable. The data set is small, there are no random effects or latent variables, and the problem is low-dimensional, with only a single predictor and a single response variable and only three parameters in the statistical model used. + +  + +[Documentation][2] + +[Source code][3] + +  + +[1]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[2]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/tadpole/WRITEUP/tadpole.pdf +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/tadpole diff --git a/spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function.md b/spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function.md new file mode 100644 index 0000000..ece514d --- /dev/null +++ b/spatial-models/glmm-with-spatial-structure-described-in-terms-of-covariance-function/glmm-with-spatial-structure-described-in-terms-of-covariance-function.md @@ -0,0 +1,42 @@ +# Poisson GLMM + +GLMM with spatial correlation, where the locations do not lie on a grid. Illustrates how you can parameterize a large correlation matrix in terms of an isotropic correlation function r(d), where "d" is the distiance between two locations. + +### **Model description** + +Our data are 100 Poisson counts (y), each with parameter lambda. The datapoints are index by i and j (_i,j_=1,...,10). It is assumed that  + +  + +log(lambdai,j) = X_i,j_b e_i,j_. + +  + +where  _Xi,j_b is a linear predictor and ei,j are Gaussian random variables with covariance + + +cov(e_i1,j1_,e_i2,j2_) = s2 exp(a-1 _d_), + +  + +Here _d_ is the Euclidean distance between the two positions. + +  + +### Orthogonalization + +This example shows a mathematical trick that is useful in all sorts of regression analysis: make the columns of the design matrix X orthogonal. This makes the model more stable, but when you later shall interpret the output (b vector) you must "transform back". + + DATA_SECTION + matrix dd(1,n,1,n); // Distance matrix + LOC_CALCS + int i, j; + dmatrix tX=trans(X); + ncol1=norm(tX(1)); + tX(1)/=ncol1; + tX(2)-= tX(1)*tX(2)*tX(1); + cout << tX(1)*tX(2) << endl; + ncol2=norm(tX(2)); + tX(2)/=ncol2; + X=trans(tX); + END_CALCS diff --git a/spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids.md b/spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids.md new file mode 100644 index 0000000..6c37682 --- /dev/null +++ b/spatial-models/glmm2019s-on-large-spatial-grids/glmm2019s-on-large-spatial-grids.md @@ -0,0 +1,5 @@ +# Separable covariance function + +Poisson GLMM on large spatial grid + +It has for a long time been possible to fit GLMMs (Generalized Linear Mixed Models) in ADMB-RE. A typical example is correlated count data with Poisson distribution. However, when the observation are located on a spatial grid the number of latent variables (random effects in the ADMB-RE terminology) grows quadratically in the number of grid points in each geographical direction. The large number of random effects causes a computational challenge. \ No newline at end of file diff --git a/spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data.md b/spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data.md new file mode 100644 index 0000000..6a3c95c --- /dev/null +++ b/spatial-models/mgrf-car-model-for-the-scottish-lip-cancer-data/mgrf-car-model-for-the-scottish-lip-cancer-data.md @@ -0,0 +1,49 @@ +# GMRF: CAR model for the Scottish Lip Cancer Data + +Example of conditionally autoregressive (CAR) model applied to 56 geographical Scottish regions. + +If you google "Scottish Lip Cancer Data" you will find that these data are used in many textbooks on spatial modelling, also as examples for statistical software (e.g. Winbugs). We use the notation from + +  + +The main ingredients of the model are: + +1. Counts are Poisson distributed +2. A spatially smooth term (phi) affects the expected number of counts. This is the CAR part of the model. "phi" for one particular region is normally distributed (mean,sigma^2/m), where mean is the average of the neighbouring phi's, and m is the number of neighbour for this region. The specification of such a distribution for each region collectively constitute the CAR prior. +3. There is a heterogeneity effect  theta  associate with each region, assumed to be independent between regions. + +  + +## Specifying the CAR prior + +In this example the neighbourhood structure is specified in a separate file (_scotlandgraph.dat_ + +). The first part of this file looks as: + + 1 3 5 9 19 + 2 2 7 10 + 3 1 12 + 4 3 18 20 28 + 5 3 1 12 19 + 6 + +The first line means: for region "1", the neighbours are: 3,5,9,19. Region "6" (an island) has no neighbours, and no CAR prior can be assigned to it. + +  + +In the tpl file the rugged array W holds the neighboorhood information. In a loop over all regions, the CAR prior for the i'th region is calculated by the call + + car_prior(phi(W(i)),i) + +which invokes the code + + dvariable mean = sum(phi(1,m(i)))/m(i); + g -= -0.5*square(phi(0)-mean)*m(i); + + where "mean" is the average of the neighbouring values. The variance is set to be 1/m (m=number of neighboors),  which phi is scaled by "sigma" in the Poisson likelihood. + +##  Running the program + +CAR models should be run with the -shess" command line option. For this small example the run time is anyway small, but for large datasets this is crucial. + +  \ No newline at end of file diff --git a/spatial-models/separable-different-implementation/separable-different-implementation.md b/spatial-models/separable-different-implementation/separable-different-implementation.md new file mode 100644 index 0000000..2d93852 --- /dev/null +++ b/spatial-models/separable-different-implementation/separable-different-implementation.md @@ -0,0 +1,48 @@ +# Comparison of spatial approaches in ADMB + +Three different implementations of the same model with separable spatial covariance function in a fully Gaussian situation: i) Plain ADMB (non-random effect) ii) Geostatistical formulation iii) Hybrid approach. The example helps the user understand the different spatial approaches available in ADMB. + +The separable covariance function requires that observations are made on a two-dimensional spatial grid (x- and y-directions). The separable assumption is: for locations separated by distances  _dx_  and  _dy_ the correlation is on a product form: + +  + +_r(dx,dy)  = rx(dx) * ry(dy),_ + +  + +_rx(dx) = (phi1)dx _and _ry(dy) = (phi2)dy_. You need to work through the example _Separable: Method explanation_ to fully understand separability and its relation to Kronecker products. + +  + +The example we shall use is in an agricultural setting where the response variable "yield" is allowed to vary spatially and with "variety" as an explanatory variable. A simple Gaussian model is assumed (in R-notation for the linear predictor) + +  + +_yield  =  variety u(x,y) error_ + +_ +_ + +where  _u(x,y)_  is the spatially varying random field. Both  _u(x,y)_  and _error_  are taken to be Gaussian, so the full model is Gaussian. Hence it is possible to write down the full covariance matrix of the vector  _yield_. This is what is done in  "ar1ar1_dense.tpl"  which do not require random effects at all. In "ar1ar1_prior.tpl" the same is implemented using random effects and the Gaussian prior feature (in this particular example random effects does not really make the world easier). The main part of both programs is to set up the joint correlation matrix. + +  + +The formulation "ar1ar1_sparse.tpl" exploits sparseness of the precission matrix and looks very different from the other two programs. (This harder to understand and you must read!). It gives identical results, and runs much faster in larger examples when run with the "-shess" command line option. + +  + +### Running the programs + +  + + ar1ar1_dense -ind ar1ar1.dat + ar1ar1_prior -ind ar1ar1.dat + ar1ar1_sparse -shess -ind ar1ar1.dat + +  + +  + +### A note on missing values + +There need not be observations at every grid point, but the latent GMRF needs nevertheless to be represented in \ No newline at end of file diff --git a/spatial-models/spatial-models.md b/spatial-models/spatial-models.md new file mode 100644 index 0000000..77283d6 --- /dev/null +++ b/spatial-models/spatial-models.md @@ -0,0 +1,17 @@ +# Spatial models + +Spatial + +There are two traditions (and a hybrid approach) in spatial modeling, both of which are supported in ADMB:  + +1. The geostatistical approach where you specify the spatial covariance matrix (or equivalently the covariogram). This is your only option if you have data that are not on a grid/lattice, or if your spatial locations do not naturally form a "neighbourhood" structure. If you are not familiar with spatial modelling you should start with "Geostatistical approach" which takes you through a lot of features. + +2. GMRF (Gaussian Markov random field) models for data on grids, or where at least there is some way of defining the "neighbours" of each observational position. The most prominent example is the conditionally autoregressive (CAR) model for the random field where you specify the distribution of each spatial point as a function of the neighbouring values.   GMRF are computationally efficient when used in combination with the sparse matrix functionality in ADMB ("-shess" command line option). _Your first example_: MGRF: simple CAR model + +3. Separable: Hybrid between 1) and 2) with _separable covariance function _where you specify the model in terms of the covariance function, similar to 1). However, it turns out that using a  separable covariance function_ _is equivalent to specifying a neighbourhood structure. Hence, you get the best of two worlds at the cost of accepting separability (which imply non-isotropy of the covariance function). + +The example "Comparison of approaches" illustrates the differences between these approaches in a simple Gaussian situation. + +## A note on modeling philosophy + +All the methods discussed here view the spatial surface as a Gaussian random field. This field is implemented using the random effects module ADMB-RE. \ No newline at end of file diff --git a/spatial-models/the-geostatistical-approach/the-geostatistical-approach.md b/spatial-models/the-geostatistical-approach/the-geostatistical-approach.md new file mode 100644 index 0000000..7923618 --- /dev/null +++ b/spatial-models/the-geostatistical-approach/the-geostatistical-approach.md @@ -0,0 +1,143 @@ +# Geostatistical approach + +This is what most people think of when you say "spatial statistics". You explicitly model the correlation matrix/function. Observations do not need to be on a grid; their correlation is typically determined by distance. This example takes you from simple examples with Gaussian observation noise to non-Gaussian response (GLMMs). + +## Model description + +The key model component is a latent Gaussian random field u(x,y), where x and y are the spatial coordinates. We assume that the field is isotropic, i.e. that cor[u(x1,y1),u(x2,y2)] = ρ(r), where r = sqrt( (x1-x2)2 (y1-y2)2) is the Euclidean distance. + +### + +### Gaussian measurement error + +The random field is typically observed with measurement error (e). The observations (Y) are: + +  + +      Yi = β σ*u(xi,yi) ei,            i = 1,...,n, + +  + +where β is the expectation value. Marginally (at each point) u(x,y) ~ N(0,1), but note that we scale the field by a standard deviation σ. Further, we assume that ei ~ N(0,σe2), where σe is often called the "nugget" effect, so that in total Y ~ N(β,σ2 σe2) + +  + +### Specification of the covariance matrix + +The correlation matrix is denoted by _M_, and is defined elementwise as Mij = ρ(dij), where _d_ij is the distance between observation i and j. In this example we use an exponential correlation function ρ(_d_) = exp(-_a*d_), where a is a parameter (to be estimated) that controls how quickly the correlation drops off. + +  + +There is a special setup in ADMB that makes computations in geostatistical models efficient + + PARAMETER_SECTION + random_effects_vector u(1,n,2) + normal_prior M(u); + + NORMAL_PRIOR_FUNCTION void get_M(const dvariable& _a) + // Function descript goes here .... + + FUNCTION void evaluate_M(void) + get_M(a); + +In the beginning it is easiest if you use this templates, but the advanced user may change the names according to the following rules: + +* The "normal_prior" associates _M_ with the vector _u_ of random effects + + * You are free to name the correlation matrix anything you want; we use _M_ + * The only use of _M_ you should make is to assign a value to it inside NORMAL_PRIOR_FUNCTION (see examples). +* NORMAL_PRIOR_FUNCTION + * Purpose: + + * Evaluate _M_ + * Add contribution from u to objective function : -0.5*logdet(_M_) -0.5*_u_*inv(_M_)*_u_ + + * Define exactly 1 function of this type; called "get_M" in our case, but you can change the name + * get_M() should end with an assignment to _M_ + * get_M() can take more than more parameter, yielding more flexible correlation functions +* evaluate_M() + * There must **always** be a function with this name, i.e. you can not change its name even if you change the name of _M_ + * It should contain a call to get_M (or whatever you have called it). + +  + +### Phases + +Each parameter to be estimated has an associated "phase" in ADMB. In latent variable models you should first estimate fixed effects (β) and measurement error (σ). In the second phase you estimate parameters associated with the latent random field (σe and a). In the first phase σe and a will be fixed to their initial values (whatever you set that to be). + +  + +## Exercises: Modify the model + +The code for the above model is given in "spatial_simple.tpl". You should try the following: + +* **Plot variograms **of Y. You can use the R library "geoR" (if you have this package install in R) using the command + + plot(variog(geodata=list(coords=Z,data=Y))) + +    Run the ADMB program (so that "spatial_simple.rep" containing residuals gets + +    produced) and then use the R commands + + r=scan("spatial_simple.rep") + plot(variog(geodata=list(coords=Z,data=r))) + +     The residuals r should be close to uncorrelated, while the correlation in Y should + +     correspond to the correlation function (exponential) you have used to generate data. + +* **Generating other datasets  **The R script "spatial_simple.R" generates the dat-file. Modify the script and run it using source("spatial_simple.R"), and see if the ADMB output changes accordingly. You also need to download "ADMButils.R"). +* **Implement non-RE version.** Because this is a fully Gaussian model it is possible to implement the likelihood directly without using the random effects features of ADMB. The key point is to notice that the (marginal) covariance matrix of Y is σ2M σe2I, where I is the identity matrix (1's on the diagonal; 0's everywhere else). Either write your own tpl, or use "spatial_nonre.tpl". Compare results and run times. +* **Flexible correlation function** Use a half-normal correlation function ρ(d) = a1exp{-(d/a2)2}, where -a1 and a2 are parameters that you estimate. + + tmpM(i,j)=a1*exp(-square(d(i,j)/a2)); + +* **Experiment with phases **and see if the use of phases affects run times. Go back to "spatial_simple.tpl" and use the command "time" in your operating system to measure the run time. + * Try to activate all parameters in phase 1 + * Try to activate "a" in phase 3 + + time -est spatial_simple + +* **Linear predictor **As in ordinary multiple regression we let X be a design matrix (that is constructed externally, using for instance "design.matrix()" in R) + + * Let β be a vector; read in covariate (design) matrix X + + * Insert linear predictor in expectation value μ = X*beta σ*u + * Modify "spatial_simple.R" so that X is generated and written to the .dat file. + + DATA_SECTION + init_int p // Number of fixed effects (b's) + init_matrix X(1,n,1,p) // Covariate matrix + + SEPARABLE_FUNCTION void normal_loglik() + dvariable mu = X(u)*beta sigma*u_i; + +* **Negative binomial response **Go back to "spatial_simple.tpl" and replace the Gaussian response with a negative binomial distribution. We now longer have an additive measurement error, but instead a GLMM, where it is natural to write the model in an hierarchical form + +        Y | u = Neg. bin (μ,κ) + +        log(μ) = β σ*u(x,y) + +     where Y|u denotes conditional probability (conditionally on u). + +* The expectation μ must be positive, so we use a log-link, i.e.  μ = exp{β σ*u(xi,yi)} +* τ = Var(Y)/E(Y) > 1 is the over dispersion. + + * For τ=1 the negative binomial distribution collapses to the Poisson distribution and τ=10 is a large deviation from Poisson (try to plot the probability function for τ=10). + * τ should be given phase 2, while parameters governing the latent field (σ and a) should be postponed to phase 3 + + PARAMETER_SECTION + init_bounded_number tau(1.0,10,2) // Over dispersion + + SEPARABLE_FUNCTION void negbin_loglik(...,const dvariable& tau) + dvariable sigma = exp(log_sigma); + dvariable mu = exp(beta sigma*u_i); // Mean of Y + l -= log_negbinomial_density(Y(i),mu,tau); + +* **Code **ADMB (spatial_negbin.tpl) and R code for (spatial_negbin.R) are provided. + +  + + + +Α α Β β Γ γ Δ δ Ε ε Ζ ζ Η η Θ θ Ι ι Κ κ Λ λ Μ μ Ν ν Ξ ξ Ο ο Π π Ρ ρ Σ σ ς Τ τ Υ υ Φ φ Χ χ Ψ ψ Ω ω \ No newline at end of file diff --git a/state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md b/state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md new file mode 100644 index 0000000..d26be9e --- /dev/null +++ b/state-space-models/a-discrete-valued-time-series-model/a-discrete-valued-time-series-model.md @@ -0,0 +1,27 @@ +# A discrete valued time series model; Polio data + +Filed under: [Random effect][1], [Medical/Biometrics][2] + +Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +![File text/x-perl][3] [polio.tpl][4] +![File chemical/x-mopac-input][5] [polio.dat][6] +![File][3] [polio.pin][7] +![File][3] [polio.par][8] +![File PDF document][9] [polio.pdf][10] + +Document Actions + +* [RSS feed][11] + +[1]: http://www.admb-project.org/@@search?Subject:list=Random effect +[2]: http://www.admb-project.org/@@search?Subject:list=Medical/Biometrics +[3]: http://www.admb-project.org/application.png +[4]: a-discrete-valued-time-series-model/polio.tpl/view.html +[5]: http://www.admb-project.org/unknown.png +[6]: a-discrete-valued-time-series-model/polio.dat/view.html +[7]: a-discrete-valued-time-series-model/polio.pin/view.html +[8]: a-discrete-valued-time-series-model/polio.par/view.html +[9]: http://www.admb-project.org/pdf.png +[10]: a-discrete-valued-time-series-model/polio.pdf/view.html +[11]: a-discrete-valued-time-series-model/RSS "" diff --git a/state-space-models/citations.md b/state-space-models/citations.md new file mode 100644 index 0000000..7c2421d --- /dev/null +++ b/state-space-models/citations.md @@ -0,0 +1,34 @@ +# This page does not seem to exist… + +We apologize for the inconvenience, but the page you were trying to access is not at this address. You can use the links below to help you find what you are looking for. + +If you are certain you have the correct web address but are encountering an error, please contact the [Site Administration][1]. + +Thank you. + +### You might have been looking for… + +[State-space models][2] +: + +[State-space models][2] +: + +[ADMB/TMB training course][3] +: 2-6 November 2015 (ICES, Copenhagen, Denmark) + +[Journal papers and Formal publications][4] +: + +[User Base][5] +: + +[ADMB User Base][6] +: + +[1]: http://www.admb-project.org/contact-info +[2]: http://www.admb-project.org/examples/state-space-models +[3]: http://www.admb-project.org/courses/ices-course-in-admb-tmb +[4]: http://www.admb-project.org/users/bibliography/journal-papers-and-formal-publications +[5]: http://www.admb-project.org/users/user-base/user-base +[6]: http://www.admb-project.org/Members/admb-user-base diff --git a/state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.md b/state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.md new file mode 100644 index 0000000..712e305 --- /dev/null +++ b/state-space-models/delta-smelt-life-cycle-model/delta-smelt-life-cycle-model.md @@ -0,0 +1,19 @@ +# Delta smelt life cycle model + +Filed under: [State space model][1], [Fisheries][2], [Ecology][3], [Random effect][4] + +A state-space multistage model to evaluate population impacts in the presence of density dependence + +This is the state-space approach reported in [Maunder and Deriso (2011)][5] to evaluate delta smelt population impacts in the presence of density dependence. Mark Maunder's notes on the implementation of the model in ADMB-RE along with an example .tpl are included below. + +[Notes on model implementation][6] + +[DeltaSmelt.tpl][7] + +[1]: http://www.admb-project.org/@@search?Subject:list=State space model +[2]: http://www.admb-project.org/@@search?Subject:list=Fisheries +[3]: http://www.admb-project.org/@@search?Subject:list=Ecology +[4]: http://www.admb-project.org/@@search?Subject:list=Random effect +[5]: http://www.nrcresearchpress.com/doi/pdf/10.1139/f2011-071 +[6]: delta-smelt-life-cycle-model/DeltaSmeltPopModel.pdf "DeltaSmeltPopModel.pdf" +[7]: delta-smelt-life-cycle-model/DeltaSmelt.tpl "DeltaSmelt.tpl" diff --git a/state-space-models/skate-mortality-bayesian-state-space-model.md b/state-space-models/skate-mortality-bayesian-state-space-model.md new file mode 100644 index 0000000..5087a11 --- /dev/null +++ b/state-space-models/skate-mortality-bayesian-state-space-model.md @@ -0,0 +1,25 @@ +# Skate mortality: Bayesian state-space model + +Filed under: [Fisheries][1], [State space model][2] + +**This example is part of the [NCEAS non-linear modelling project][3]** + +**Authors: Trevor Davies and Steve Martell** + +The goal of the model was to obtain decadal mortality estimates of three different size classes of winter skates (_Leucoraja ocellata_) on the eastern Scotian Shelf. The time series are largely non-informative for several of the model parameters (catchability, recruitment rate, and stage transition probability), so informative Bayesian priors are used. + +The model described here is a Bayesian state-space model implemented in both JAGS and AD Model Builder. The model description and alternative model formulations are fully described in Swain et al. (2009). + +[Documentation][4] + +[Source code][5] + +  + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=Fisheries +[2]: http://www.admb-project.org/@@search?Subject:list=State space model +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[4]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/skate/WRITEUP/skate.pdf +[5]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/skate diff --git a/state-space-models/state-space-models.md b/state-space-models/state-space-models.md new file mode 100644 index 0000000..17a1648 --- /dev/null +++ b/state-space-models/state-space-models.md @@ -0,0 +1,27 @@ +# State-space models + +[A discrete valued time series model; Polio data][1] +: Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response + +[Stochastic volatility models for financial time series][2] +: Stochastic volatility models are used in mathematical finance to describe the evolution of asset returns, which typically exhibit changing variances over time. + +[Delta smelt life cycle model ][3] +: A state-space multistage model to evaluate population impacts in the presence of density dependence. + +[Skate mortality: Bayesian state-space model][4] +: Bayesian state-space model example from the NCEAS non-linear modelling working group + +[Theta-logistic population growth model][5] +: State-space model from the NCEAS non-linear modelling working group + +Document Actions + +* [RSS feed][6] + +[1]: state-space-models/a-discrete-valued-time-series-model.html +[2]: state-space-models/stochastic-volatility-models-for-financial-time-series.html +[3]: state-space-models/delta-smelt-life-cycle-model.html +[4]: state-space-models/skate-mortality-bayesian-state-space-model.html +[5]: state-space-models/theta-logistic-population-growth-model.html +[6]: state-space-models/RSS "" diff --git a/state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series.md b/state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series.md new file mode 100644 index 0000000..92f40af --- /dev/null +++ b/state-space-models/stochastic-volatility-models-for-financial-time-series/stochastic-volatility-models-for-financial-time-series.md @@ -0,0 +1,40 @@ +# Stochastic volatility models for financial time series + +Filed under: [Finance][1] + +Stochastic volatility models are used in mathematical finance to describe the evolution of asset returns, which typically exhibit changing variances over time. + +### Model description + +  + +The dataset is  previously analyzed by [Harvey et al. (1994)][2], and later by several other authors. The data consist of a time series of daily pound/dollar exchange rates {_zt_} from the period 01/10/81 to 28/6/85. The series of interest are the daily mean-corrected returns {_yt_}, given by the transformation + +  + +_yt_ = log(_zt_)-log(_zt-1_) \- average[log_zi_-log_zi-1_]. + +  + +The stochastic volatility model allows the variance of _yt_ to vary smoothly with time. This is achieved by assuming that _yt_ ~ N(0,_st_), where _st_ = exp{-0.5(_mx_ _xt_)}. Here, the smoothly varying component _xt_ is assumed to be an autoregression. + +  + +### Details + + [sdv.pdf][3] + +### Files + +See "Navigation" box to the left. + +* .tpl:  Model file +* .dat: Data file +* .pin: Starting values for the numerical optimizer +* .par: Result file (what you get when you compile and run your model) + +  + +[1]: http://www.admb-project.org/@@search?Subject:list=Finance +[2]: citations.html#harv:ruiz:shep:1994 +[3]: stochastic-volatility-models-for-financial-time-series/sdv.pdf "sdv.pdf" diff --git a/state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.md b/state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.md new file mode 100644 index 0000000..18f214d --- /dev/null +++ b/state-space-models/theta-logistic-population-growth-model/theta-logistic-population-growth-model.md @@ -0,0 +1,18 @@ +# Theta-logistic population growth model + +Filed under: [Ecology][1] + +**This example is part of the [NCEAS non-linear modelling project][2]** + +**Author: Casper W. Berg** + +The example is a theta-logistic nonlinear state-space population model. The population size is modelled as a nonlinear function of its previous size, with a discrete-time theta-logistic process model: N(t 1)=theta-logistic(N(t)) plus a normally distributed process error, and the observation error is also normally distributed. This example uses simulated data from the same model to test it. More details are available in Pedersen et al. (2011). + +[Documentation][3] + +[Source code][4] + +[1]: http://www.admb-project.org/@@search?Subject:list=Ecology +[2]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects +[3]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/theta/WRITEUP/theta.pdf +[4]: https://groups.nceas.ucsb.edu/non-linear-modeling/projects/theta diff --git a/storage/storage.md b/storage/storage.md new file mode 100644 index 0000000..e07bf30 --- /dev/null +++ b/storage/storage.md @@ -0,0 +1,11 @@ +# Storage + +Physical storage of individual examples with guarantied permanent URL + +There are currently no items in this folder. + +Document Actions + +* [RSS feed][1] + +[1]: storage/RSS "" diff --git a/survival-analysis/survival-analysis.md b/survival-analysis/survival-analysis.md new file mode 100644 index 0000000..ca7d3fa --- /dev/null +++ b/survival-analysis/survival-analysis.md @@ -0,0 +1,12 @@ +# Survival analysis + +Lifetime data and survival analysis + +[Weibull regression with censoring][1] + +Document Actions + +* [RSS feed][2] + +[1]: survival-analysis/weibull-regression-with-censoring.html +[2]: survival-analysis/RSS "" diff --git a/survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring.md b/survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring.md new file mode 100644 index 0000000..c41a6cd --- /dev/null +++ b/survival-analysis/weibull-regression-with-censoring/weibull-regression-with-censoring.md @@ -0,0 +1,22 @@ +# Weibull regression with censoring + +Cox's proportional hazard model with random effects + +### Details + +  + +[kidney.pdf][1]  + +  + +### Files + +See "Navigation" box to the left. + +* .tpl:  Model file +* .dat: Data file +* .pin: Starting values for the numerical optimizer +* .par: Result file (what you get when you compile and run your model) + +[1]: weibull-regression-with-censoring/kidney.pdf "kidney.pdf" diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..9eb3c7f --- /dev/null +++ b/test.txt @@ -0,0 +1,560 @@ +# Math — ADMB Project + +[Skip to content.][1] | [Skip to navigation][2] + +* [Site Map][3] +* [Accessibility][4] +* [Contact][5] + +Search ADMB + +[ Advanced Search… ][6] + +[ ![ADMB Project][7]][8] + +Navigation + +* [Home][9] +* [Downloads][10] +* [Documentation][11] +* [Examples][12] +* [Courses][13] +* [Tools][14] +* [Developers][15] +* [Users][16] + +##### Personal tools + +* [Log in][17] + +You are here: [Home][8] › [Examples][18] › Math + +| ----- | +| + +[Navigation][19] +: + +* [ New examples ][20] +* [ All examples ][21] +* [ By field of application ][22] +* [ Differential equations ][23] +* [ Categorical data ][24] +* [ Fisheries ][25] +* [ Growth models ][26] +* [ GLM/GLMM/GAM ][27] +* [ Function minimizer ][28] +* [ Math ][29] + * [ Adjoint code ][30] + * [ Parameterization ][31] + * [ Splines ][32] + * [ Variance calculations ][33] + * [ Covariance Calculations ][34] +* [ Mark-recapture ][35] +* [ R stuff ][36] +* [ Simple examples ][37] +* [ Sampling ][38] +* [ Spatial models ][39] +* [ State-space models ][40] +* [ Survival analysis ][41] +* [ Text books ][42] +* [ WinBUGS ][43] +* [ Miscellaneous ][44] +* [ Storage ][45] + +  + + | + +Info +: + +# Math + +Various undocumented techniques and tricks useful for developing ADMB programs + +[Adjoint code][46] +: Why to write adjoint code and alternative approaches to do it. + +[Parameterization][47] +: Examples of how to (and not to) parameterize mathematical functions and statistical models + +[Splines][48] +: Different aspects of spline models + +[Variance calculations][49] +: How variance is calculated in ADMB + +[Covariance Calculations][50] +: A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. + +Document Actions + +* [RSS feed][51] + + | + +The ADMB Project is supported by the [**ADMB Foundation**][52], and a grant from ![logo graphic][53][ **NOAA Fisheries**][54] to ![logo graphic][55][**JIMAR**][56]. + +| ----- | +| ![Fusion Creative logo graphic][57] Graphic design by [Fusion Creative][58]. | ![white spacer gif][59]This web site is powered by [Plone][60] and hosted by ![logo graphic][61][**NCEAS**][62]. | + +[ADMB Foundation][52] © 2007–2013  •  [Log in][63] ")); try { var pageTracker = _gat._getTracker("UA-5850320-4"); pageTracker._trackPageview(); } catch(err) {}var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape(" + + + + +Math — ADMB Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+

+ Skip to content. | + + Skip to navigation +

+ + + + + + +

Navigation

+ + + + +
+ +
+ +
Personal tools
+ + +
+ + + +
+ + You +are here: + + Home + + › + + + + + + Examples + + › + + + + + + + + + + Math + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+ +
+ + Navigation + +
+ +
+ + + +
+
+ +
+ + + + + +   +
+
+ +
+ + +
+ + + + + + + + + + + + + +
+ + + + + + + + + +

+ Math +

+ + + + + + + + + + + + + +
+ Various undocumented techniques and tricks useful for developing ADMB programs +
+ + + + + + +
+ + + + + + + + + +
+ + + +
+ + + + Adjoint code + + + + + + + + + + +
+ +
+ Why to write adjoint code and alternative approaches to do it. +
+ + + + + + +
+ + + + Parameterization + + + + + + + + + + +
+ +
+ Examples of how to (and not to) parameterize mathematical functions and statistical models +
+ + + + + + +
+ + + + Splines + + + + + + + + + + +
+ +
+ Different aspects of spline models + +
+ + + + + + +
+ + + + Variance calculations + + + + + + + + + + +
+ +
+ How variance is calculated in ADMB +
+ + + + + + +
+ + + + Covariance Calculations + + + + + + + + + + +
+ +
+ A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain. +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ + +

+ Document Actions +

+ + + + + + +
+ + + + + +
+ + + + + + + +
+ + +
+ + + +
+ +
+ + + + + + + + + + + + + + +
+
+ + + + + + diff --git a/text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r.md b/text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r.md new file mode 100644 index 0000000..95a7fc1 --- /dev/null +++ b/text-books/bolker-2008-ecological-models-and-data-in-r/bolker-2008-ecological-models-and-data-in-r.md @@ -0,0 +1,16 @@ +# Bolker (2008) Ecological Models and Data in R + +![File][1] [fir.pdf][2] +[Gamma distributed myxomatosis using R2admb][3] +[Negative Binomial Fir Fecundity][4] +: + +Document Actions + +* [RSS feed][5] + +[1]: http://www.admb-project.org/pdf.png +[2]: ../glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1/description-1/view.html +[3]: ../r-stuff/gamma-distributed-myxomatosis-using-r2admb.html +[4]: ../glmm-generalized-linear-mixed-models/count-data/negative-binomial-fir-fecundity-1.html +[5]: bolker-2008-ecological-models-and-data-in-r/RSS "" diff --git a/text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.md b/text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.md new file mode 100644 index 0000000..b914bf0 --- /dev/null +++ b/text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.md @@ -0,0 +1,8 @@ +# "Maximum likelihood estimation and inference" by Russell Millar + +Book with examples in R, SAS and ADMB + +See details at [Book homepage][1]. ADMB examples are provided [here][2]. + +[1]: https://www.stat.auckland.ac.nz/~millar/ +[2]: https://www.stat.auckland.ac.nz/~millar/MLEI/Code/ADMB/ diff --git a/text-books/text-books.md b/text-books/text-books.md new file mode 100644 index 0000000..555b947 --- /dev/null +++ b/text-books/text-books.md @@ -0,0 +1,14 @@ +# Text books + +Collections of examples taken from text books + +[Bolker (2008) Ecological Models and Data in R][1] +["Maximum likelihood estimation and inference" by Russell Millar][2] + +Document Actions + +* [RSS feed][3] + +[1]: text-books/bolker-2008-ecological-models-and-data-in-r.html +[2]: text-books/maximum-likelihood-estimation-and-inference-by-russell-millar.html +[3]: text-books/RSS "" diff --git a/uploading-examples-to-github.md b/uploading-examples-to-github.md new file mode 100644 index 0000000..877f818 --- /dev/null +++ b/uploading-examples-to-github.md @@ -0,0 +1,7 @@ +# Uploading examples to github + +__ is a good (free for our purpose) option for uploading your ADMB examples to the web. A link from the ADMB webpage will than direct users to your github stuff. This allows you to easily to modify your example without having write access to the ADMB web page. + +**Note **Files like pdf's should be put in the download section and only text files like tpl and dat as repository files.  The reason is that if you include a non-text file in repository any changes cause the file to be re-copied entirely if it is changed.  In the download section, you delete it and upload again.  + +  \ No newline at end of file diff --git a/winbugs/occupancy-model.md b/winbugs/occupancy-model.md new file mode 100644 index 0000000..9650993 --- /dev/null +++ b/winbugs/occupancy-model.md @@ -0,0 +1,31 @@ +# Occupancy model + +Comparison of ADMB and WinBUGS modelling approach for simple occupancy model. This is also a comparison of Bayesian and frequentist modelling. + +![bugs-admb code][1] + +  + +The presence of animals (or some other object) at a site is determined by a  latent indicator variable z: + +  z = 1 presence of animlas + +  z = 0 absence + +Conditioinally on z = 1, the number of animals y follows a binomial distribution + +  + +The following annotated code show how such a model is implemented in WinBUGS and ADMB, and highlights differences.   + +  + +  + +  + +  + +  + +[1]: occupancy-model/occupancy.jpg/image_preview.jpg "bugs-admb code" diff --git a/winbugs/winbugs.md b/winbugs/winbugs.md new file mode 100644 index 0000000..6ad46a7 --- /dev/null +++ b/winbugs/winbugs.md @@ -0,0 +1,13 @@ +# WinBUGS + +Comparison with the software package WinBUGS + +[Occupancy model][1] +: Comparison of ADMB and WinBUGS modelling approach for simple occupancy model. This is also a comparison of Bayesian and frequentist modelling. + +Document Actions + +* [RSS feed][2] + +[1]: winbugs/occupancy-model.html +[2]: winbugs/RSS ""