R/market_model.R
, R/diseq_basic.R
, R/diseq_deterministic_adjustment.R
, and 4 more
scores.Rd
It calculates the gradient of the likelihood at the given parameter point for each observation in the sample. It, therefore, returns an n x k matrix, where n denotes the number of observations in the sample and k the number of estimated parameters. The ordering of the parameters is the same as the one that is used in the summary of the results. The method can be called either using directly a fitted model object, or by separately providing a model object and a parameter vector.
scores(object, parameters, fit = missing())
# S4 method for diseq_basic,ANY,ANY
scores(object, parameters)
# S4 method for diseq_deterministic_adjustment,ANY,ANY
scores(object, parameters)
# S4 method for diseq_directional,ANY,ANY
scores(object, parameters)
# S4 method for diseq_stochastic_adjustment,ANY,ANY
scores(object, parameters)
# S4 method for equilibrium_model,ANY,ANY
scores(object, parameters)
# S4 method for missing,missing,market_fit
scores(fit)
A model object.
A vector with model parameters.
A fitted model object.
The score matrix.
# \donttest{
model <- simulate_model(
"diseq_basic", list(
# observed entities, observed time points
nobs = 500, tobs = 3,
# demand coefficients
alpha_d = -0.9, beta_d0 = 8.9, beta_d = c(0.6), eta_d = c(-0.2),
# supply coefficients
alpha_s = 0.9, beta_s0 = 7.9, beta_s = c(0.03, 1.2), eta_s = c(0.1)
),
seed = 7523
)
# estimate the model object (BFGS is used by default)
fit <- estimate(model)
# Calculate the score matrix
head(scores(model, coef(fit)))
#> D_P D_CONST D_Xd1 D_X1 S_P S_CONST
#> 1 -0.122260422 0.34811752 -0.417340236 0.3605332179 -0.5466158 1.55640326
#> 2 0.743843382 1.23910947 -1.148249906 1.4036189852 0.1513030 0.25204357
#> 3 0.037446089 0.04769418 0.047007752 0.0006108855 0.0625768 0.07970256
#> 4 -0.002693132 0.01690514 -0.008471139 -0.0192476350 0.1587665 -0.99659773
#> 5 -0.088372742 0.14821086 -0.129232886 0.0357887188 -0.1360946 0.22824566
#> 6 -0.201806861 -0.29613341 0.271890840 -0.1908639813 -0.3212258 -0.47137000
#> S_Xs1 S_Xs2 S_X1 D_VARIANCE S_VARIANCE RHO
#> 1 -1.35247639 -0.20897526 1.611912774 -0.39852402 -0.97800236 0.03240626
#> 2 0.05638665 0.04213804 0.285505964 -0.42071759 -0.25214455 0.05403332
#> 3 -0.07472583 -0.12786917 0.001020861 -0.04798689 0.47379627 0.04437969
#> 4 -1.33182296 1.31959174 1.134693567 0.02317068 -0.02313445 0.08570107
#> 5 -0.15303714 -0.03443069 0.055114852 -0.08776477 0.40012622 0.13650416
#> 6 -0.58471108 0.50310081 -0.303807511 0.25698735 0.24866134 0.05187506
# }