matching.solve: Solves the equations by arbitrating.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Solves the underlying equations based on data, the inputs parameters, and the control parameters. It tries to distribute the errors in the places accepted by the user.

Usage

1
2
3
matching.solve(case, nA, nB, nu.A, phi.A, delta.A, gamma, delta.B, phi.B,
  nu.B, verbose = FALSE, tolerance.pd = 1.5e-06,
  tolerance.degree.max = 1.5e-08, tolerance.pij = 1e-06)

Arguments

case

a case prepared with matching.prepare

nA

the count of entities expected for population A

nB

the count of entities expected for population B

nu.A

control for nA: 0 means "respect nA", non-null "adapt it to solve the case"

phi.A

control for frequencies: 0 means "respect the original frequencies as detected in the sample", non-null "adapt it to solve the case"

delta.A

control for degree A: 0 means "respect the input parameters pdi", non-null "adapt them to solve the case"

gamma

control for pij: 0 means "respect the matching probabilities pij", non-null "adapt them to solve the case"

delta.B

control for degree B: 0 means "respect the input parameters pdj", non-null "adapt them to solve the case"

phi.B

control for frequencies: 0 means "respect the original frequencies as detected in the sample", non-null "adapt it to solve the case"

nu.B

control for nB: 0 means "respect nB", non-null "adapt it to solve the case"

verbose

if TRUE, the resolution will emit messages for debug

tolerance.pd

the tolerance for probability distributions

tolerance.degree.max

the tolerance for min/max average degrees

tolerance.pij

the tolerance for pij probabilities

Details

This function is deterministic as long as only one solution is found. In case several solutions with equivalent quality are found, one of them is randomly chosen.

Value

a case ready for generation

Author(s)

Samuel Thiriot <samuel.thiriot@res-ear.ch>

See Also

matching.prepare to prepare a case for this function, matching.generate to use the result for actual generation, plot.dpp_resolved to plot the quality of the solution

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# load sample data
data(dwellings_households)
# prepare the case  
case.prepared <- matching.prepare(
                     dwellings_households$sample.A, dwellings_households$sample.B, 
                     dwellings_households$pdi, dwellings_households$pdj, 
                     dwellings_households$pij)
# resolve tbe case
solved <- matching.solve(case.prepared, 
                     nA=50000,nB=40000, 
                     nu.A=0, phi.A=0, delta.A=1, 
                     gamma=1, 
                     delta.B=0, phi.B=0, nu.B=0)
# print the resolution information
print(solved)
# access the solved frequencies, distribution of degrees and matching probabilities
print(solved$gen$hat.fi)
print(solved$gen$hat.pdi)
print(solved$gen$hat.pij)

samthiriot/gosp.dpp documentation built on May 18, 2019, 3:44 p.m.