Nash - Scientific Computing with PCs (523165), страница 49
Текст из файла (страница 49)
We could alsohave "programmed" MATLAB to perform the equispaced time point interpolation.The lessons of this case may be summarized as follows.•To relate the problem and its solutions to the real-world, use units algebra to carry quantities andconversion factors through the equations that make up the formulation.•Check solutions with graphs that include real-world features.•Extra features, such as the equispaced time points or high-quality output, may be important.
Neitherof the two examples here could produce graphs of better than screen-capture quality (the professionalversion of MATLAB has this capability).16: SPACECRAFT TRAJECTORIESFigure 16.5.2Another PLOD Apollo spacecraft trajectoryFigure 16.5.3MATLAB version of the Figure 15.6.3143Previous Home Next144Copyright © 1984, 1994 J C & M M NashNash Information Services Inc., 1975 Bel Air Drive, Ottawa, ON K2C 0X1 CanadaSCIENTIFIC COMPUTING WITH PCsCopy for:Dr. Dobb’s JournalChapter 17Simulating a Hiring Process17.117.217.317.417.517.6Problem StatementFormulationsMethods and AlgorithmsPrograms or PackagesSome solutionsAssessmentIn this case study, we touch upon the elements that make up a computer simulation or Monte Carlocalculation.17.1 Problem StatementMany problems present themselves in ways that do not immediately suggest standard solution methods.Examples arise throughout the physical, biological and social sciences, as well as engineering andmanagement.
The "problem" may not be well-specified; indeed, a phenomenon may present itself onlypartially, so that clear objectives and understandings are impossible. Simulation allows explicit inclusionof knowledge that does not lead to an analytic (i.e., calculus or algebra) solution to the problem. Scenariorules are written down and actually followed through to see what happens. The approach also findsformal expression in resampling methods in modern statistical estimation.This "trying out" of ideas relating to problems does not lead to a true solution. Typically we simply wantto understand the processes better, but simulations may give a very good picture of what is going.
Forexample, a simulation of the operation of an insurance scheme may allow the premium and regulationsto be set using optimization techniques. A simplified example appears in Nash J C (1990d), pp. 165-167.Our example here considers the hiring of people for several jobs where the employer is thought todiscriminate against a specific group of candidates. In our simplified treatment we make only cursoryreference to the large literature on this subject. The hiring process is quite difficult to model in detail.Some factors that come into play are the number of jobs available, how the employer discriminates foror against candidates who are members of particular groups, the awareness of candidates of theavailability of jobs, perceived policies or conditions of work that may discourage applicants who aremembers of certain groups, mechanisms used to process applications, and interview / selectionprocedures.17.2 FormulationsTo simplify our task in simulating the hiring process, we make the following assumptions.
First, thepopulation is considered to be made up of only two groups, A and B. Let P(A) be the populationproportion of group A, so that (1-P(A)) is the proportion of B’s. In reality a candidate may belong toseveral groups (black / white, male / female, anglophone / francophone, college-educated / notcollege-educated).Second, the relative odds that an A gets a job compared to a B are17: SIMULATING A HIRING PROCESS(17.2.1)145d = P(Job|A) / P(Job|B)P(Job|B) is the conditional probability a type B candidate gets a job. Fixing d implies a constant policyof "discrimination" by the employer, who does not change his hiring methods or attitudes during theperiod of our study.
Note that d can include factors beyond the employer’s control that influence therelative likelihood A’s or B’s get jobs. The "discrimination" may be unintended.Third, we assume that the employer fixes his number of jobs available as n and pursues the hiring processuntil all positions are filled. We ignore the possibility of disappointing candidates or lack of applications.Fourth, the hiring process will be considered to be a single stochastic trial for the candidate. This ignoresthe reality that the candidate may withdraw when he is discouraged by a long application form, that hemay not get an interview because his application appears weak, or similar occurrences that imply that theprocess has more than one stage at which selection / rejection can occur.Finally, in our simulation we fix the chance that an "average" candidate gets a job as P(Job), despite groupmembership.
Using d, we find the probabilities members of each group get jobs as(17.2.2)P(Job|A) = P(Job) d / ( 1 + (d-1) P(A) )(17.2.3)P(Job|B) = P(Job) / ( 1 + (d-1) P(A) )We want, given the notation and assumptions above, to derive the probability distribution of the numberof candidates succA of type A who get a job. This will vary with n jobs available, P(A) fraction of A’sin the population, d relative chances of A getting a job compared to B, and P(Job) average chance ofgetting hired. That is, there are four dimensions in which we can vary the "world" we simulate. BesidessuccA, the number of A’s who get jobs out of the n available, we could look at succB, the number of B’swho are hired (this is n - succA in each trial, but the distribution may have a different shape), apply,the total number of candidates who present themselves before all n jobs are filled, and the partitioningof this into A and B subsets, namely, applA and applB.It may be possible to derive analytic expressions for these distributions.
If there are not two groupings,but merely n jobs available with P(Job) chance that an individual applicant gets one, the distribution ofthe number of applicants follows the Pascal distribution, while the number of rejected candidates followsthe Negative Binomial distribution (see Hastings and Peacock, 1975). Under more complicatedassumptions, such as those of the previous section, analytic results do not appear obvious and we willuse simulation to approximate them.17.3 Methods and AlgorithmsThe essentials of simulation are a set of rules by which our system or phenomenon is assumed to operate,a mechanism for translating these rules into mathematical or algorithmic form, tools for generatingrandom numbers corresponding to the uncertainties that influence outcomes, and ways of analyzing theresults of operating the simulation several times.The most technically awkward of these requirements is generating the random numbers.
Where real datais available, we can use files of such data. Central statistical agencies have started to offer special files ofmicro-data drawn from their extensive survey and census information (e.g., Keller and Bethlehem, 1992,and related papers).Without "real" data files, we must generate the numbers. Though hardware devices do exist, only the mostspecialized of applications will use them. Software pseudo-random number generators are common, butsome have grave deficiencies (Park and Miller, 1988). Most provide sequences of uniformly distributed146Copyright © 1984, 1994 J C & M M NashSCIENTIFIC COMPUTING WITH PCsNash Information Services Inc., 1975 Bel Air Drive, Ottawa, ON K2C 0X1 CanadaCopy for:Dr.
Dobb’s Journalpseudo-random numbers on the unit interval, that is between 0 and 1. Sometimes 0 or 1 or both may beleft out of the sequence. The generation mechanisms are such that the number sequence will eventuallyrepeat. There may also be patterns, even if difficult to detect, that may be important if we use a singlegenerator to produce values first for one variable, then another, and so on. Successive values for a variableare drawn a fixed number of positions apart in the pseudo-random sequence, and may turn out to becorrelated.
This difficulty is reduced in linear congruential generators if their period is long, thejustification for generators such as that in Nash J C, Sande and Young (1984) and Wichmann and Hill(1987).If we need numbers distributed from other than a uniform distribution on [0,1), these are usually createdby transformation of uniform random numbers (Dagpunar, 1988). We specify the interval to include zerobut not one. Users should be cautious of such details in making transformations.The set of rules by which our hiring process operates can be written down and embedded in a simulationto obtain the distribution of outcomes. We conduct "experiments" that trace applicants through the system.Figure 17.3.1 shows the possible paths.
At the nodes of this tree, random numbers will be used to decidethe path to be taken. All random numbers are drawn from a uniform distribution on the unit interval[ 0, 1), so approximate probabilities reasonably well.Repeat until all jobs filled:Step 1: Applicant is presented. A random numberIf R1>P(A), applicant is a B, else an A.R1 is drawn.Step 2: A random number R2 is drawn.a.