scoreTest: scoreTest

View source: R/4_auxiliaryFunctions.R

scoreTestR Documentation

scoreTest

Description

Based on an estimated model, a score-type test shows whether effects that are not included in the model are likely to be significant if they were included.

Usage

scoreTest(ans, effects, modelEffects = NULL, nonParametric = FALSE)

## S3 method for class 'scoretest.monan'
print(x, ...)

Arguments

ans

An object of class "result.monan" resulting from an estimation with the function estimateMobilityNetwork() using the option returnDeps = TRUE.

effects

An object of class "effectsList.monan" in which the non included effects that should be tested are specified.

modelEffects

The effects object of the estimated model. Only needed for results estimated with earlier versions of MoNAn, which do not contain the statistics of the model's effects.

nonParametric

Logical: should the non-parametric value of earlier versions be reported, too? It is the share of simulated statistics that are smaller than or equal to the observed one (further away from 0.5 = more significant). It is not corrected for the correlation with the model's effects and therefore rarely extreme; it is not recommended for testing.

x

An object of class "scoretest.monan".

...

For internal use only.

Details

For each tested effect, the statistic of the effect in the observed network is compared with its distribution in the networks simulated in Phase 3 of the estimation. Because the statistics of tested effects are usually correlated with the statistics of the effects in the model, the test is conditional on the model's statistics: the deviation of the observed statistic from the simulated mean is adjusted for the remaining deviations of the model's statistics, and divided by the standard deviation of the tested statistic given the model's statistics (a generalised score test). The resulting t-statistic is approximately standard normal if the effect's parameter is 0.

R2 is the share of the variance of the tested statistic that is explained by the model's statistics. Values close to 1 indicate that the effect is nearly redundant given the model, so that its parameter is hard to estimate.

The test needs the statistics of the model's effects in the simulated networks. Estimations with returnDeps = TRUE store them. For results of earlier versions of MoNAn, which do not contain them, the effects of the estimated model must be specified with modelEffects.

Value

The function scoreTest returns an object of class "scoretest.monan" with, for each tested effect, the t-statistic (tStatistics), the two-sided p-value (pValues) and R2 (R2), the observed and simulated statistics, and with nonParametric = TRUE the non-parametric values (pValuesNonParametric).

The function print.scoretest.monan shows the t-statistics, p-values and R2 for each tested effect.

See Also

createEffectsObject(), estimateMobilityNetwork()

Examples


# test whether other effects should be included
myEffects2 <- createEffects(myState) |>
  addEffect(transitivity_AC, alpha = 8)

test_ME.2 <- scoreTest(myResDN, myEffects2)


test_ME.2


MoNAn documentation built on Oct. 12, 2026, 5:07 p.m.