Tracking Extra Quantities

Often, there are quantities in models that we might be interested in viewing the values of, but which are not random variables in the model that are explicitly drawn from a distribution.

As a motivating example, the most natural parameterization for a model might not be the most computationally feasible. Consider the following (efficiently reparametrized) implementation of Neal’s funnel (Neal, 2003):

using Turing
setprogress!(false)

@model function Neal()
    # Raw draws
    y_raw ~ Normal(0, 1)
    x_raw ~ arraydist([Normal(0, 1) for i in 1:9])

    # Transform:
    y = 3 * y_raw
    x = exp.(y ./ 2) .* x_raw
    return nothing
end
[ Info: [Turing]: progress logging is disabled globally
[ Info: [AdvancedVI]: global PROGRESS is set as false
Neal (generic function with 2 methods)

In this case, the random variables exposed in the chain (x_raw, y_raw) are not in a helpful form — what we’re after are the deterministically transformed variables x and y.

There are two ways to track these extra quantities in Turing.jl.

Using := (during inference)

The first way is to use the := operator, which behaves exactly like = except that the values of the variables on its left-hand side are automatically added to the chain returned by the sampler. For example:

@model function Neal_coloneq()
    # Raw draws
    y_raw ~ Normal(0, 1)
    x_raw ~ arraydist([Normal(0, 1) for i in 1:9])

    # Transform:
    y := 3 * y_raw
    x := exp.(y ./ 2) .* x_raw
end

sample(Neal_coloneq(), NUTS(), 1000)
Info: Found initial step size
  ϵ = 1.6
Chains MCMC chain (1000×32×1 Array{Float64, 3}):

Iterations        = 501:1:1500
Number of chains  = 1
Samples per chain = 1000
Wall duration     = 7.97 seconds
Compute duration  = 7.97 seconds
parameters        = y_raw, x_raw[1], x_raw[2], x_raw[3], x_raw[4], x_raw[5], x_raw[6], x_raw[7], x_raw[8], x_raw[9], y, x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9]
internals         = lp, n_steps, is_accept, acceptance_rate, log_density, hamiltonian_energy, hamiltonian_energy_error, max_hamiltonian_energy_error, tree_depth, numerical_error, step_size, nom_step_size

Summary Statistics
  parameters      mean       std      mcse    ess_bulk   ess_tail      rhat       Symbol   Float64   Float64   Float64     Float64    Float64   Float64    ⋯

       y_raw    0.0209    1.0491    0.0248   1820.0516   558.6560    0.9996    ⋯
    x_raw[1]    0.0102    1.0074    0.0222   2054.7111   750.0523    1.0009    ⋯
    x_raw[2]   -0.0006    0.9868    0.0247   1602.4403   737.5999    1.0020    ⋯
    x_raw[3]   -0.0214    0.9711    0.0287   1168.6203   806.4440    0.9995    ⋯
    x_raw[4]    0.0240    1.0039    0.0222   2059.1681   922.7303    0.9996    ⋯
    x_raw[5]   -0.0187    1.0326    0.0319   1049.8264   624.5197    1.0030    ⋯
    x_raw[6]    0.0136    1.0225    0.0281   1348.2509   767.7530    1.0005    ⋯
    x_raw[7]    0.0340    1.0232    0.0263   1474.7000   479.3148    1.0000    ⋯
    x_raw[8]   -0.0087    0.9293    0.0254   1317.3939   907.7013    0.9997    ⋯
    x_raw[9]    0.0128    0.9528    0.0229   1742.1841   849.8517    1.0001    ⋯
           y    0.0628    3.1474    0.0744   1820.0516   558.6560    0.9996    ⋯
        x[1]    0.7460    9.8112    0.3501    938.1532   665.2838    1.0001    ⋯
        x[2]    0.2462    8.3450    0.3243    903.6284   644.1482    0.9997    ⋯
        x[3]   -0.3114   10.6709    0.3352    929.4776   848.7930    1.0005    ⋯
        x[4]   -0.2520    7.9935    0.2919    995.1550   693.0763    0.9990    ⋯
        x[5]   -0.6022    7.7270    0.2835    926.2326   837.1625    1.0012    ⋯
        x[6]    0.4863    7.8861    0.2919    848.0189   602.7765    1.0001    ⋯
      ⋮           ⋮         ⋮         ⋮          ⋮          ⋮          ⋮       ⋱
                                                     1 column and 3 rows omitted

Quantiles
  parameters       2.5%     25.0%     50.0%     75.0%     97.5%
      Symbol    Float64   Float64   Float64   Float64   Float64

       y_raw    -1.9798   -0.7158    0.0133    0.7372    2.0784
    x_raw[1]    -1.8726   -0.7051   -0.0001    0.7238    1.8117
    x_raw[2]    -1.9224   -0.6580   -0.0326    0.6625    1.9071
    x_raw[3]    -2.0641   -0.6070   -0.0012    0.6128    1.7607
    x_raw[4]    -1.9049   -0.6433    0.0109    0.7227    2.0172
    x_raw[5]    -2.0168   -0.6939   -0.0051    0.6824    1.9806
    x_raw[6]    -1.9403   -0.7103   -0.0565    0.7697    2.0285
    x_raw[7]    -2.0058   -0.6560    0.0481    0.7680    1.9763
    x_raw[8]    -1.8158   -0.6481   -0.0059    0.6215    1.7812
    x_raw[9]    -1.8983   -0.6108    0.0095    0.6430    1.8709
           y    -5.9393   -2.1474    0.0398    2.2116    6.2353
        x[1]    -9.2035   -0.5533   -0.0009    0.6771   15.2368
        x[2]   -11.1139   -0.5070   -0.0121    0.5799   13.9480
        x[3]   -12.6957   -0.5023   -0.0037    0.5884    9.6919
        x[4]   -13.6736   -0.7041    0.0023    0.5200   11.5030
        x[5]   -14.8115   -0.6920   -0.0041    0.4855    7.8221
        x[6]    -9.0795   -0.6138   -0.0135    0.5637   14.6835
      ⋮           ⋮          ⋮         ⋮         ⋮         ⋮
                                                   3 rows omitted

Using returned (post-inference)

Alternatively, one can specify the extra quantities as part of the model function’s return statement:

@model function Neal_return()
    # Raw draws
    y_raw ~ Normal(0, 1)
    x_raw ~ arraydist([Normal(0, 1) for i in 1:9])

    # Transform and return as a NamedTuple
    y = 3 * y_raw
    x = exp.(y ./ 2) .* x_raw
    return (x=x, y=y)
end

chain = sample(Neal_return(), NUTS(), 1000)
Info: Found initial step size
  ϵ = 1.6
Chains MCMC chain (1000×22×1 Array{Float64, 3}):

Iterations        = 501:1:1500
Number of chains  = 1
Samples per chain = 1000
Wall duration     = 1.83 seconds
Compute duration  = 1.83 seconds
parameters        = y_raw, x_raw[1], x_raw[2], x_raw[3], x_raw[4], x_raw[5], x_raw[6], x_raw[7], x_raw[8], x_raw[9]
internals         = lp, n_steps, is_accept, acceptance_rate, log_density, hamiltonian_energy, hamiltonian_energy_error, max_hamiltonian_energy_error, tree_depth, numerical_error, step_size, nom_step_size

Summary Statistics
  parameters      mean       std      mcse    ess_bulk   ess_tail      rhat       Symbol   Float64   Float64   Float64     Float64    Float64   Float64    ⋯

       y_raw   -0.0093    0.9608    0.0310    979.3574   705.3716    1.0015    ⋯
    x_raw[1]    0.0390    0.9794    0.0274   1298.5072   817.8880    1.0013    ⋯
    x_raw[2]   -0.0389    0.9894    0.0292   1156.8664   834.3285    0.9990    ⋯
    x_raw[3]    0.0218    0.9713    0.0274   1246.7385   763.0073    1.0008    ⋯
    x_raw[4]   -0.0047    0.9991    0.0340    851.8805   814.6575    1.0066    ⋯
    x_raw[5]    0.0214    0.9742    0.0280   1220.4791   737.6261    1.0003    ⋯
    x_raw[6]    0.0177    0.9474    0.0262   1298.6337   769.7040    1.0040    ⋯
    x_raw[7]   -0.0026    0.9998    0.0290   1184.3691   731.4193    0.9994    ⋯
    x_raw[8]   -0.0173    1.0413    0.0351    876.0937   720.1504    1.0012    ⋯
    x_raw[9]   -0.0010    1.0149    0.0321    998.7382   646.4471    0.9991    ⋯
                                                                1 column omitted

Quantiles
  parameters      2.5%     25.0%     50.0%     75.0%     97.5%
      Symbol   Float64   Float64   Float64   Float64   Float64

       y_raw   -1.8968   -0.6454   -0.0130    0.6584    1.8603
    x_raw[1]   -1.9837   -0.6283    0.0472    0.6868    1.9296
    x_raw[2]   -1.9120   -0.7099   -0.0054    0.6546    1.8548
    x_raw[3]   -1.8727   -0.6319    0.0373    0.6567    1.9631
    x_raw[4]   -1.8873   -0.6576   -0.0192    0.6628    1.9880
    x_raw[5]   -1.8289   -0.6622    0.0192    0.7071    1.8712
    x_raw[6]   -1.8429   -0.6186    0.0251    0.6103    1.7749
    x_raw[7]   -1.9193   -0.6542   -0.0359    0.6645    1.8965
    x_raw[8]   -2.1088   -0.6908   -0.0492    0.6950    2.0301
    x_raw[9]   -1.9610   -0.7194    0.0101    0.7254    1.9655

The sampled chain does not contain x and y, but we can extract the values using the returned function. Calling this function outputs an array:

nts = returned(Neal_return(), chain)
1000×1 Matrix{@NamedTuple{x::Vector{Float64}, y::Float64}}:
 (x = [-0.07815398035383395, -0.38830652862679477, -0.07929224957204087, -0.4923281396661845, -0.021834790340977232, 0.3291687797936138, 0.27695990215480215, 0.5583234429814491, -0.23292642068284977], y = -2.491511211745035)
 (x = [-0.34938159236573346, -0.5393606232704224, 0.5943722581887919, 0.20146728289596572, 0.31058927959121985, -0.9818284912646992, 0.26213414693427217, 1.7898804307854452, -1.5564161386678341], y = 0.7468233614394233)
 (x = [-0.24295247179190527, 0.13356703230947548, 0.18834235585051856, -0.03796668643476657, -0.3374670165729042, 0.9547695111848443, -0.03580133167801666, -0.731192812866277, 0.722485444901844], y = -0.7662131197497422)
 (x = [-20.537973462295593, 22.859405895282674, -9.297756888242208, -12.956445687028614, -12.692115346906652, -20.72694742976849, -6.214894610627112, -25.51576658203066, -33.82730571533159], y = 5.90562320229614)
 (x = [0.33533116433069615, -0.17765970209743936, 0.5148729358564827, 0.37913273924244245, 0.8143281993138465, 0.06290114076364742, 0.07784821241461774, 0.4255407745553454, -0.5033162072463353], y = -1.9236697355757653)
 (x = [-0.23681047139393216, 0.14236854681133665, -0.5308996331428741, -0.462446271193756, -0.47168237552060677, -0.005495595607068415, 0.2515255544454944, -0.26439241415869735, -0.4713706937857573], y = -2.4058025135776218)
 (x = [0.16374739003577618, 0.11363078451554884, -0.008153612050467432, -0.1290405693414363, -0.09006047333927857, 0.0741293601586824, 0.06709337515380197, -0.07569471612709475, 0.08178168357206951], y = -4.397969616439216)
 (x = [0.032239241370120554, -0.006340441877220288, -0.045768599649073406, -0.06033054772029753, -0.010635006155369695, 0.0605411877537949, 0.011411329972107111, -0.04002375999068363, 0.035826409080431415], y = -6.002727093842106)
 (x = [0.007383201206190997, -0.023535986828213045, -0.012262194814208609, -0.054763116231684214, 0.04669118707817509, 0.05409356543961902, 0.00816969990823261, 0.010712147846457085, 0.10745544278690897], y = -6.263316459875968)
 (x = [-1.6809695057020433, -0.9353255935499476, -0.05770925708852529, 0.8251235762528141, 0.9101124154121513, -0.7965864742529765, -1.347884160034417, -0.8517130134536642, -0.21692337074376192], y = 0.03936787179314871)
 ⋮
 (x = [0.017050492744251616, -0.20590256924800607, -0.01852402506591976, -0.08011552240659171, 0.09098838713426328, 0.3107342593728034, 0.364838574300251, -0.5712759018335364, -0.0981093423496533], y = -2.8686966546040766)
 (x = [0.0431336551654746, -1.1255288862819333, 0.3115727877067442, -0.36542984754598035, -0.9104215338173938, -0.21310972380707, 0.24115847319139527, -0.996297786983821, -0.11782540271234229], y = -0.5045366433372832)
 (x = [0.6520383226635008, 2.2589180300024565, -1.4516495110432308, 0.6808526007133511, 0.664911224536728, -0.35384217815795965, -0.6011635558631525, -0.3328209121492987, 0.47534342251412953], y = 0.513619260417308)
 (x = [-0.2278371707873252, -1.0068152656238427, 0.6576106971127489, -0.7791231554020794, -1.0028317052247737, 0.16928475074199825, 0.3903303611234642, 0.32546841187279346, -0.34136679652884344], y = -0.7556343283731546)
 (x = [1.2377287911743713, 2.136036975343596, -0.08396633390178648, 1.540952395586804, 1.8272725657531839, -0.8255252326396992, -0.38654032749547196, -0.465356642591856, 0.4583300198905709], y = 0.09635476328364623)
 (x = [1.9180448280278768, -1.4614603507876238, -1.705052384886048, -0.86440722002838, -5.586503484967369, -2.1386181537727724, -2.0771345630768727, -0.0002142620761683667, 1.6609138941650934], y = 2.2818384682935986)
 (x = [0.03142498452971653, 0.049728391590234365, 0.031078737774178643, 0.007747344852009454, 0.2233850151058349, 0.06849257041251824, -0.05351557679112384, -0.025763527735919223, -0.011467521683084878], y = -4.099602910782336)
 (x = [0.03142498452971653, 0.049728391590234365, 0.031078737774178643, 0.007747344852009454, 0.2233850151058349, 0.06849257041251824, -0.05351557679112384, -0.025763527735919223, -0.011467521683084878], y = -4.099602910782336)
 (x = [-0.12191125977465923, -0.051676392888211846, 0.3917537258469583, 0.0643426594024197, 0.6558632902498939, -0.0705262376141384, 0.3623257858758737, 0.9354194388107887, 0.15992104778950286], y = -1.5285724618097638)

where each element of which is a NamedTuple, as specified in the return statement of the model.

nts[1]
(x = [-0.07815398035383395, -0.38830652862679477, -0.07929224957204087, -0.4923281396661845, -0.021834790340977232, 0.3291687797936138, 0.27695990215480215, 0.5583234429814491, -0.23292642068284977], y = -2.491511211745035)

Which to use?

There are some pros and cons of using returned, as opposed to :=.

Firstly, returned is more flexible, as it allows you to track any type of object; := only works with variables that can be inserted into an MCMCChains.Chains object. (Notice that x is a vector, and in the first case where we used :=, reconstructing the vector value of x can also be rather annoying as the chain stores each individual element of x separately.)

A drawback is that naively using returned can lead to unnecessary computation during inference. This is because during the sampling process, the return values are also calculated (since they are part of the model function), but then thrown away. So, if the extra quantities are expensive to compute, this can be a problem.

To avoid this, you will essentially have to create two different models, one for inference and one for post-inference. The simplest way of doing this is to add a parameter to the model argument:

@model function Neal_coloneq_optional(track::Bool)
    # Raw draws
    y_raw ~ Normal(0, 1)
    x_raw ~ arraydist([Normal(0, 1) for i in 1:9])

    if track
        y = 3 * y_raw
        x = exp.(y ./ 2) .* x_raw
        return (x=x, y=y)
    else
        return nothing
    end
end

chain = sample(Neal_coloneq_optional(false), NUTS(), 1000)
Info: Found initial step size
  ϵ = 3.2
Chains MCMC chain (1000×22×1 Array{Float64, 3}):

Iterations        = 501:1:1500
Number of chains  = 1
Samples per chain = 1000
Wall duration     = 1.68 seconds
Compute duration  = 1.68 seconds
parameters        = y_raw, x_raw[1], x_raw[2], x_raw[3], x_raw[4], x_raw[5], x_raw[6], x_raw[7], x_raw[8], x_raw[9]
internals         = lp, n_steps, is_accept, acceptance_rate, log_density, hamiltonian_energy, hamiltonian_energy_error, max_hamiltonian_energy_error, tree_depth, numerical_error, step_size, nom_step_size

Summary Statistics
  parameters      mean       std      mcse    ess_bulk   ess_tail      rhat       Symbol   Float64   Float64   Float64     Float64    Float64   Float64    ⋯

       y_raw   -0.0142    1.0226    0.0341    899.4827   619.7583    1.0012    ⋯
    x_raw[1]   -0.0044    0.9945    0.0334    892.8657   760.3880    1.0021    ⋯
    x_raw[2]   -0.0186    0.9932    0.0256   1517.5791   801.9976    0.9995    ⋯
    x_raw[3]   -0.0576    0.9859    0.0273   1309.8807   869.6589    1.0058    ⋯
    x_raw[4]    0.0436    0.9961    0.0318    998.4052   711.7502    1.0030    ⋯
    x_raw[5]    0.0030    0.9775    0.0259   1398.2647   765.9316    1.0044    ⋯
    x_raw[6]   -0.0369    1.0032    0.0295   1199.3123   745.5609    1.0058    ⋯
    x_raw[7]   -0.0105    0.9850    0.0247   1589.6915   766.6262    0.9993    ⋯
    x_raw[8]   -0.0027    1.0906    0.0307   1277.4798   849.8517    1.0021    ⋯
    x_raw[9]    0.0229    0.9877    0.0313   1000.7963   675.2338    0.9990    ⋯
                                                                1 column omitted

Quantiles
  parameters      2.5%     25.0%     50.0%     75.0%     97.5%
      Symbol   Float64   Float64   Float64   Float64   Float64

       y_raw   -2.0524   -0.6615   -0.0267    0.6747    1.9672
    x_raw[1]   -1.9362   -0.6505   -0.0448    0.6227    1.9612
    x_raw[2]   -1.9301   -0.7210   -0.0884    0.7129    1.9265
    x_raw[3]   -2.0049   -0.7447   -0.0398    0.6291    1.8489
    x_raw[4]   -1.8401   -0.6066    0.0201    0.7135    2.0215
    x_raw[5]   -1.9192   -0.6478   -0.0110    0.6504    1.9695
    x_raw[6]   -1.9492   -0.7096   -0.0345    0.6249    1.9755
    x_raw[7]   -2.0306   -0.6639   -0.0135    0.6481    1.9445
    x_raw[8]   -2.1080   -0.7472    0.0014    0.7594    2.1409
    x_raw[9]   -1.8796   -0.5886    0.0043    0.6255    1.9319

The above ensures that x and y are not calculated during inference, but allows us to still use returned to extract them:

returned(Neal_coloneq_optional(true), chain)
1000×1 Matrix{@NamedTuple{x::Vector{Float64}, y::Float64}}:
 (x = [-0.5357002350670694, -0.4853827581271848, -0.2480057904723197, 0.768767494000799, 0.08163464722475033, -0.5553165458054855, 0.6410492429612908, -0.7274454150873766, 0.6381046954474803], y = -0.725742596338186)
 (x = [0.16496382474167556, 0.255721190432259, 0.11949086855432563, -0.45336873385042065, -0.036807891353287485, 0.17361581427488185, -0.3004991547534817, 0.34937350825339586, -0.34577292154866945], y = -2.3235256198880316)
 (x = [-1.9434935205681463, 0.9432652773643708, -3.8300574692958143, -2.061013060596973, -1.765016112947345, -5.550151480328728, -1.7152246799339768, 0.4133360483060719, -3.974725539277533], y = 2.3750519015559695)
 (x = [0.15225050107970964, -0.03857643930995276, 0.1540426308724062, 0.04773409156979189, 0.06924651253302726, 0.22949569923993823, 0.0651423689422642, 0.05240252199382588, 0.20302195194822958], y = -4.092084993098463)
 (x = [0.3048141864775403, 0.21114539859390438, 0.6892473075496477, -1.1192461874343995, 1.132238026017437, -0.07121725550451906, -1.424419344373741, -1.6544870858709775, 1.0851734388020402], y = -0.326801532544003)
 (x = [0.9382506753621561, -0.7390402250155862, 0.14381398822404634, -0.42888183518285106, -0.5132903104345274, 1.1068648939320838, 0.6177022140144026, -0.11685464492894183, 0.3456171454318421], y = -0.8836601756587663)
 (x = [8.1919667208175, -10.28463361509528, 4.452857988311101, -1.3206789383382516, -5.286014839351392, -7.533017245495988, 2.7041351641905824, -4.957619100842654, -1.6091106620254543], y = 3.883335348501654)
 (x = [0.37712553573600066, 0.9836297539010022, 0.38790890447098, -0.1597524981782805, 0.3489234658109103, -0.09019347024927295, -0.25015381728031527, 0.03914560754262737, 0.07461016978956045], y = -1.8540285058864914)
 (x = [0.37712553573600066, 0.9836297539010022, 0.38790890447098, -0.1597524981782805, 0.3489234658109103, -0.09019347024927295, -0.25015381728031527, 0.03914560754262737, 0.07461016978956045], y = -1.8540285058864914)
 (x = [15.01100906714513, 20.629834932283078, 20.404521674095207, 5.622466260438148, 12.139129832030276, 1.0973212689592002, -11.115616739807397, 4.245483141086528, -7.026728541698096], y = 4.742478408080485)
 ⋮
 (x = [0.00033573885793624806, 0.4410138295381549, 0.10685770009069454, -0.14086975132461152, 0.0661449323404921, -0.1285644019522356, -0.22085359231604546, 0.011216912482010613, -0.3938205697148379], y = -2.6675393685430273)
 (x = [0.45043003336593934, -0.33899294689635545, -0.7823672052591898, -0.055552934464160146, 0.03548965986874018, -0.04754891499745819, -0.20353172208802683, 1.0874047239614393, -0.6197875108226005], y = -0.4022129366132793)
 (x = [-0.9775190228371887, 0.4378456736343229, 0.919759845311374, 0.5136165257158408, -0.046779486504010655, 0.5952880547770952, 0.1877177070679726, -0.96405021695941, 0.9745221859943742], y = 0.43298186500945046)
 (x = [-0.9775190228371887, 0.4378456736343229, 0.919759845311374, 0.5136165257158408, -0.046779486504010655, 0.5952880547770952, 0.1877177070679726, -0.96405021695941, 0.9745221859943742], y = 0.43298186500945046)
 (x = [1.779070422798361, -1.369600480894318, 0.39029749367456784, 0.2626415041411355, 0.10760866091218177, -0.7965952785633168, -0.36746210915938415, 1.1644413520030332, -2.200868599507908], y = 2.104712276522122)
 (x = [-0.02637150657420705, 0.11656638212246337, 0.038142371886855486, -0.0021179334637827078, -0.03189624140950361, -0.1436975072819587, 0.07681297091125783, 0.12712265682342053, -0.126711664887656], y = -4.280713018094486)
 (x = [-0.016313713322522825, 0.13782528745384484, 0.6025110764699106, 0.5054814337892632, 0.21529902095254283, -0.06841491006458765, -0.3570354722997146, 0.1966248328389517, 0.14143655686038814], y = -1.9846302979498622)
 (x = [-0.016313713322522825, 0.13782528745384484, 0.6025110764699106, 0.5054814337892632, 0.21529902095254283, -0.06841491006458765, -0.3570354722997146, 0.1966248328389517, 0.14143655686038814], y = -1.9846302979498622)
 (x = [0.19845452608184003, 0.9089418040902918, -0.4096186553253286, 1.1231139292329806, 0.332330493306633, 1.6243205701565986, -0.807991866886896, -0.6813163943196742, 0.07464312592150915], y = -0.5764158086792339)

Another equivalent option is to use a submodel:

@model function Neal()
    y_raw ~ Normal(0, 1)
    x_raw ~ arraydist([Normal(0, 1) for i in 1:9])
    return (x_raw=x_raw, y_raw=y_raw)
end

chain = sample(Neal(), NUTS(), 1000)

@model function Neal_with_extras()
    neal ~ to_submodel(Neal(), false)
    y = 3 * neal.y_raw
    x = exp.(y ./ 2) .* neal.x_raw
    return (x=x, y=y)
end

returned(Neal_with_extras(), chain)
Info: Found initial step size
  ϵ = 1.6
1000×1 Matrix{@NamedTuple{x::Vector{Float64}, y::Float64}}:
 (x = [31.703089922950525, 17.283679343854168, -74.28655912111219, 56.200809612333295, 112.06323557009557, 1.6144495276247692, 7.859656521799387, -18.808939629956882, 39.90353495640211], y = 8.061108834100205)
 (x = [10.052760732212862, -8.429415287630512, -13.254919152454246, -6.767173521582546, 4.602922793368632, 8.13082138464091, -0.1396171836431432, -2.471291141164966, -5.1302405825655395], y = 4.283553518877453)
 (x = [0.030463654541538043, 0.011633381271856964, 0.0018957166407367174, -0.05206994854285863, -0.02535743268857331, 0.09898690484722372, -0.00894317806902456, -0.03418345084565275, -0.1101987176727655], y = -5.231414472010342)
 (x = [-1.6754130481513936, 4.074478903942493, 1.3400487426850949, 2.5508522529360533, -0.13900900482018294, 0.6936640687381522, 3.337655523103693, 5.000518509444994, 5.332436218993612], y = 2.0148163403922323)
 (x = [-1.198431010596275, -0.4272350072234516, -1.7708944263487947, -0.12580036936548045, -0.3755706227211853, 1.469823343827072, 0.5140360795677498, 1.2429873710286112, 0.3470719937394706], y = -0.10891233798339228)
 (x = [1.6740102147358904, 0.47280524084095465, 0.03879484224678248, -0.760101270315804, 0.8102224560872578, -2.4517974469616033, -1.4092675268069212, -2.186492433419733, -0.4886683674261788], y = 1.0783877907925836)
 (x = [-0.17773865510391088, -0.03788206134506213, -0.12088762409994384, 0.16365552791209229, -0.29409413836888065, 0.28555463307383566, 0.21261401033167032, 0.3522234835859099, 0.10006479778468033], y = -3.1577922580694757)
 (x = [1.3463649399400182, 3.726394337225959, 0.30596074454896843, -1.190244679664184, 0.34708252857103045, -2.011159421819922, 2.4481107800648227, 1.5256458568387343, -1.9273662736950494], y = 1.2103360903019964)
 (x = [-1.3111142915829241, -1.94771596491049, 1.1216804040563952, 0.6760594766228228, 0.5651505732910893, -1.9458431455711038, -2.4323482106716465, -0.318924780977956, 0.24941935190465234], y = -0.04890440931959056)
 (x = [-1.0263161436432982, 0.9323127259597617, 0.26306756144068794, 0.5604541376872896, -2.5476013138259956, 0.7542924972138229, 2.4527748848129205, -1.4286894575827698, -0.7996084563801612], y = 0.2625739906100052)
 ⋮
 (x = [-2.123582839294585, -0.7824710468753314, 0.052370209938025714, -3.72312439225513, -2.1803899358702004, -0.5725514343897488, -0.22353018546201098, 6.980905204335856, 3.8593576082548675], y = 2.34350096960585)
 (x = [-0.3206308394840526, 0.09557737241444508, -0.3559115179749784, -0.4525054050742172, 0.2068057020809316, 0.01648287428098194, 0.28311754364473124, 0.43365948115984465, -0.14523173567902806], y = -1.820342253138942)
 (x = [-0.3969793566526594, 0.5800207883348518, -0.28074838758713516, -0.3164843216774945, 0.08364294862665336, 0.06485130980198552, 0.3513697291527203, 0.2663243066106378, -0.3045101053931635], y = -2.19745165885566)
 (x = [3.52675143365799, -2.6628648491229976, 2.167965215824867, 1.6412805394534284, -0.388883634153199, -0.6415365291899808, -2.3534786822208376, -1.6479668219526946, 2.2796466394170856], y = 1.8473620278611145)
 (x = [-2.1445458346380515, 1.503281044948302, -1.1604242501173792, 0.6800267786918053, 0.6878766607591942, -0.09151313121945695, 0.5997580843292866, -0.19864036989644923, -0.3893546122647123], y = 0.6012057262538326)
 (x = [-1.930790806200658, -1.5518427697659156, -2.2461694071100524, 2.5195682854252146, -0.671041771737981, -1.1912884364126113, -3.401097597848852, -2.1307264902767553, -1.5149523879926976], y = 1.3617579478287485)
 (x = [-0.4078280115978213, -0.06538471611022303, 0.47901299828892424, -0.1436757256744503, -0.32659697966151224, 0.22113915418191302, -0.841993278350594, -0.07691017003159319, -0.07157764383269587], y = -2.0139926674376873)
 (x = [6.201648615187703, 0.3462912918124302, 0.2616870829251388, 5.441507308947033, 0.07100066445288139, -5.040909468228598, 15.826507107499422, -0.03586505863482562, -1.0060564561976115], y = 4.271617789174725)
 (x = [-0.6604126239216518, 2.1348367483909514, 0.028947133480348695, -0.37384628614728893, 0.18400499896752165, -3.1519600918114055, 0.546794094700488, -1.1024677984239768, -1.5465867913640807], y = 1.5103090218479278)

Note that for the returned call to work, the Neal_with_extras() model must have the same variable names as stored in chain. This means the submodel Neal() must not be prefixed, i.e. to_submodel() must be passed a second parameter false.

Back to top