Permalink
e17d6c8 Oct 5, 2016
183 lines (173 sloc) 8.8 KB

README

This folder contains TMB examples. If "examp.cpp" and "examp.R" both exists then "examp" is a valid example. Test automation is provided by the files "Makefile" and "unittest.R". The purpose of the test is to verify correctness of results and to verify that the timings are reasonable. Each example is associated with a file "examp.expected.RData" with correct output from a reference test machine (For new examples this file is automatically generated, and correctness must be manually verified). Perform a full test by running

make clean
make

A file "REPORT.md" (see below) will be generated with test results and timings.

REPORT.md

Example overview:

Examples in '.':

"adaptive_integration": Adaptive integration using
                        'tiny_ad'
"ar1_4D":               Separable covariance on 4D lattice
                        with AR1 structure in each
                        direction.
"hmm":                  Inference in a 'double-well'
                        stochastic differential equation
                        using HMM filter.
"laplace":              Laplace approximation from scratch
                        demonstrated on 'spatial' example.
"linreg_parallel":      Parallel linear regression.
"linreg":               Simple linear regression.
"longlinreg":           Linear regression - 10^6
                        observations.
"lr_test":              Illustrate map feature of TMB to
                        perform likelihood ratio tests on a
                        ragged array dataset.
"matern":               Gaussian process with Matern
                        covariance.
"mvrw":                 Random walk with multivariate
                        correlated increments and
                        measurement noise.
"mvrw_sparse":          Identical with random walk example.
                        Utilizing sparse block structure so
                        efficient when the number of states
                        is high.
"nmix":                 nmix example from
                        https://groups.nceas.ucsb.edu/non-linear-modeling/projects/nmix
"orange_big":           Scaled up version of the Orange
                        Tree example (5000 latent random
                        variables)
"sam":                  State space assessment model from
                        Nielsen and Berg 2014, Fisheries
                        Research.
"sde_linear":           Inference in a linear scalar
                        stochastic differential equation.
"sdv_multi_compact":    Compact version of sdv_multi
"sdv_multi":            Multivatiate SV model from Skaug
                        and Yu 2013, Comp. Stat & data
                        Analysis (to appear)
"socatt":               socatt from ADMB example
                        collection.
"spatial":              Spatial poisson GLMM on a grid,
                        with exponentially decaying
                        correlation function
"spde_aniso":           Anisotropic version of "spde.cpp".
"spde":                 Illustration SPDE/INLA approach to
                        spatial modelling via Matern
                        correlation function
"thetalog":             Theta logistic population model
                        from Pedersen et al 2012, Ecol.
                        Modelling.
"transform2":           Beta distributed random effects
                        using copulas.
"transform_parallel":   Parallel version of transform
"transform":            Gamma distributed random effects
                        using copulas.
"tweedie":              Estimating parameters in a Tweedie
                        distribution.

Results (absolute error):

                                       Min.    Median      Max.
adaptive_integration              0.000e+00 0.000e+00 0.000e+00
ar1_4D                            0.000e+00 0.000e+00 0.000e+00
hmm                               0.000e+00 0.000e+00 0.000e+00
laplace                           0.000e+00 0.000e+00 0.000e+00
linreg                            0.000e+00 0.000e+00 0.000e+00
linreg_parallel                   0.000e+00 0.000e+00 0.000e+00
longlinreg                        0.000e+00 0.000e+00 0.000e+00
matern                            0.000e+00 0.000e+00 0.000e+00
mvrw                              0.000e+00 0.000e+00 0.000e+00
mvrw_sparse                       0.000e+00 0.000e+00 0.000e+00
nmix                              0.000e+00 0.000e+00 0.000e+00
orange_big                        0.000e+00 0.000e+00 0.000e+00
sam                               0.000e+00 0.000e+00 0.000e+00
sde_linear                        0.000e+00 0.000e+00 0.000e+00
sdv_multi_compact                 0.000e+00 0.000e+00 0.000e+00
sdv_multi                         0.000e+00 0.000e+00 0.000e+00
socatt                            0.000e+00 0.000e+00 0.000e+00
spatial                           0.000e+00 0.000e+00 0.000e+00
thetalog                          0.000e+00 0.000e+00 0.000e+00
transform2                        0.000e+00 0.000e+00 0.000e+00
transform                         0.000e+00 0.000e+00 0.000e+00
transform_parallel                1.914e-13 4.873e-13 3.593e-11
tweedie                           0.000e+00 0.000e+00 0.000e+00
validation/MVRandomWalkValidation 0.000e+00 0.000e+00 0.000e+00
validation/randomwalkvalidation   0.000e+00 0.000e+00 0.000e+00
validation/rickervalidation       0.000e+00 0.000e+00 0.000e+00

Timings:

                                  totaltime timeindex
adaptive_integration                  4.717 0.9778192
ar1_4D                               10.035 1.0135340
hmm                                   4.740 0.9618506
laplace                               6.016 1.0292558
linreg                                0.007 1.0000000
linreg_parallel                       0.307 0.9967532
longlinreg                            6.627 1.0046998
matern                                4.335 1.0693143
mvrw                                  0.155 0.9872611
mvrw_sparse                           0.146 1.0068966
nmix                                  0.778 1.0263852
orange_big                            2.865 1.0141593
sam                                   3.319 1.0006030
sde_linear                            0.156 0.9570552
sdv_multi_compact                     3.962 1.0104565
sdv_multi                             7.475 0.9946773
socatt                                0.791 0.9987374
spatial                               2.425 0.9958932
thetalog                              0.179 0.9322917
transform2                           10.829 0.9938510
transform                             6.354 1.0036329
transform_parallel                    3.208 0.5067130
tweedie                               0.508 0.9844961
validation/MVRandomWalkValidation     2.238 0.9734667
validation/randomwalkvalidation       0.285 1.0000000
validation/rickervalidation          75.970 0.9834559

Accuracy tests:

                                  passed
adaptive_integration                TRUE
ar1_4D                              TRUE
hmm                                 TRUE
laplace                             TRUE
linreg                              TRUE
linreg_parallel                     TRUE
longlinreg                          TRUE
matern                              TRUE
mvrw                                TRUE
mvrw_sparse                         TRUE
nmix                                TRUE
orange_big                          TRUE
sam                                 TRUE
sde_linear                          TRUE
sdv_multi                           TRUE
sdv_multi_compact                   TRUE
socatt                              TRUE
spatial                             TRUE
thetalog                            TRUE
transform                           TRUE
transform2                          TRUE
transform_parallel                  TRUE
tweedie                             TRUE
validation/MVRandomWalkValidation   TRUE
validation/randomwalkvalidation     TRUE
validation/rickervalidation         TRUE

Profiling:

Examples can be profiled using intel vtune. To profile e.g. example "spatial" run

make spatial.profile

This requires "amplxe-cl" on your path. View the profile with

amplxe-gui spatial.profile