PumasEMModel-Error models
using Pumas
The error models in a PumasEMModel
implicitly define the dispersion parameters based on the provided distribution. The general syntax is
@error begin
dv ~ ProportionalNormal(μ)
end
Where dv
is the observed variable, and μ
the expectation, specified in an earlier block. All currently supported error models follow the observed ~ Distribution(expectation)
syntax. When specifying init
s, add a σ
field to the named tuple with one element per observed variable. Each element should itself be a tuple with a Float64
per parameter in the error model. For example, given
@error begin
dv1 ~ ProportionalNormal(cp1) # parameterized by 1 dispersion parameter
dv2 ~ CombinedNormal(cp2) # parameterized by 2 dispersion parameters
end
one may, specify init
s of the form σ = ((2.0,), (0.9, 0.5))
, where 2.0
is the standard deviation parameter for dv1
and 0.9, 0.5
are the parameters for dv2
, in this case corresponding to the additive and proportional standard deviations of the combined normal error model. It is not necessary to initialize σ
when fitting; if unspecified, each element is initialized to 1.0
.
It is recommended to use initial values larger than you estimate the true value of σ
to be while fitting to assist exploration and escape from local minimum.
Gaussian models
Additive Normal
@error begin
Y ~ Normal(μ)
end
Indicates that Y ~ Normal(μ, σ)
.
Proportional Normal
@error begin
Y ~ ProportionalNormal(μ)
end
Indicates that Y ~ Normal(μ, abs(μ)*σ)
.
Combined Normal
@error begin
Y ~ CombinedNormal(μ)
end
Indicates that Y ~ Normal(μ, √(σₐ² + μ²*σₚ²))
.
Log Normal
@error begin
Y ~ LogNormal(μ)
end
Indicates that Y ~ LogNormal(μ, σ)
.
0-Dispersion-Parameter models
Bernoulli
@error begin
Y ~ Bernoulli(μ)
end
Indicates that Y ~ Bernoulli(μ)
.
Bernoulli Logit
@error begin
Y ~ BernoulliLogit(μ)
end
Indicates that Y ~ Bernoulli( 1 /(1 + exp(-μ)) )
.
Exponential
@error begin
Y ~ Exponential(μ)
end
Indicates that Y ~ Exponential(μ)
.
Poisson
@error begin
Y ~ Poisson(μ)
end
Indicates that Y ~ Poisson(μ)
.
1-Dispersion-Parameter models
Beta
@error begin
Y ~ Beta(μ)
end
Indicates that Y ~ Beta(μ * 10/σ, (1 - μ) * 10/σ)
.
Gamma
@error begin
Y ~ Gamma(μ)
end
Indicates that Y ~ Gamma( 1 / σ², μ * σ² )
.
Summary of Error Models
Data | Model | Derived Block Expression | Distribution | # Dispersion Parameters |
---|---|---|---|---|
Continuous | 1 | |||
Normal-Additive | y ~ Normal(μ) | y ~ Normal(μ, σ) | 1 | |
Normal-Proportional | y ~ ProportionalNormal(μ) | y ~ Normal(μ, abs(μ)*σ) | 1 | |
Normal-Additive & Proportional | y ~ CombinedNormal(μ) | y ~ Normal(μ, √(σ_add^2 + (μ*σ_prop)^2)) | 2 | |
Log-Normal | y ~ LogNormal(μ, σ) | y ~ LogNormal(μ, σ) | 1 | |
Exponential | y ~ Exponential(μ) | y ~ Exponential(μ) | 0 | |
Beta | y ~ Beta(μ) | y ~ Beta(μ * 10/σ, (1 - μ) * 10/σ) | 1 | |
Gamma | y ~ Gamma(μ) | y ~ Gamma(inv(abs2(σ)), μ*abs2(σ)) | 1 | |
Discrete | ||||
Bernoulli | y ~ Bernoulli(μ) | y ~ Bernoulli(μ) | 0 | |
Bernoulli-Logit | y ~ BernoulliLogit(μ) | y ~ Bernoulli(1/(1+exp(-μ))) | 0 | |
Poisson | y ~ Poisson(μ) | y ~ Poisson(μ) | 0 |