Appendix C lists the frequency (papfq), transmission (paptc), major locus discrete (dmlpr), major locus quantitative (qmlpr), and within genotype (papwg) subroutines included in PAP. If you want to modify the parameterization or add parameters, you can write a subroutine within specified constraints. I recommend starting with a similar subroutine and making the required modifications; reparameterization usually requires only a few lines of code added at the beginning. For example, to estimate the variance instead of the standard deviation in qmlprmv replace VARWG = PNPAR(2, 1, ITRAIT) ** 2 with VARWG = PNPAR(2, 1, ITRAIT).
Carefully test any modified subroutine. If the modification represents a reparameterization, compare likelihoods using the modified subroutine to likelihoods using the original subroutine for corresponding parameter values. If the modification adds parameters, perform two sets of tests. First, restrict the added parameters of the modified subroutine and compare the likelihood to a corresponding likelihood using the original subroutine. Second, simplify the data and, for a nontrivial value of the added parameter, compare a hand-calculated likelihood to the likelihood using the modified subroutine.
Subroutine papfq stores the genotype frequencies as logarithms in the first NGENTL elements of array PRLST. If necessary, papfq first computes the genotype frequencies and ensures a sum of 1. Array FREQ contains parameter values for computing the genotype frequencies.
After producing a modified subroutine, name it papfq with 1-3 added letters and add the relevant information to freq.dat (section B.8). Assign the number associated with the subroutine in freq.dat in a DATA statement in a BLOCK DATA SUBROUTINE appended to papfq.
See subroutine papfqg for an example of the minimum structure of papfq. The parameters in FREQ are genotype frequencies and papfqg stores them in array PRLST after ensuring a sum of 1. A data statement assigns the number 3 to papfqg corresponding to the assignment made in freq.dat.
Subroutine paptc, for a specified pair of parental genotypes, stores each nonzero genotype transmission probability as a logarithm in array TRPRB, stores the corresponding genotype in array IGENTP, and stores the number of nonzero values in NGENTP. Arrays TRNDAU, TRNSON, RCMFTH, and RCMMTH may contain parameter values for computing the genotype transmission probabilities.
After producing a modified subroutine, name it paptc with 1-3 added letters and add the relevant information to tran.dat (section B.9). Assign the number associated with the subroutine in tran.dat in a DATA statement in a BLOCK DATA SUBROUTINE appended to paptc.
See subroutine paptce for an example of the minimum structure of paptc. Subroutine paptce ignores the parental genotypes which enter as arguments and assigns the frequencies to TRPRB. A data statement assigns the number 5 to paptce corresponding to the assignment made in tran.dat.
Subroutine dmlpr performs three functions, numbered 1, 2, 4. (1) Assign each member INO of the sample to a category for trait IT in array ICATEG(INO, IT). (2) Store the genotype-and category-specific affection probability (in PEN and as a logarithm in PRBPHN) along with the corresponding deviations for the lower (DEVL) and upper (DEVU) thresholds. (4) Assign an appropriate simulated phenotype using the simulated genotype and simulated deviation.
Name the modified subroutine dmlpr with 1-3 added letters and add the relevant information to dmlp.dat (section B.10). Assign the number associated with the subroutine in dmlp.dat in a DATA statement in a BLOCK DATA SUBROUTINE appended to dmlpr.
See subroutine dmlprpn for an example of the minimum structure of dmlpr. Subroutine dmlprpn (1) assigns affection status to ICATEG, (2) stores the penetrance probability input as PARMD as PEN and PRBPHN, finding the corresponding deviations using function devia, (4) assigns phenotype 1 to individuals whose simulated deviation from their genotypic mean falls below the threshold and assigns phenotype 2 to individuals whose simulated deviation from their genotypic mean falls above the threshold.
Subroutine qmlpr performs four functions. (1) Assign each measured member INO of the sample as category -1 for trait IT in array ICATEG(INO, IT). (2) Store the genotype- and category-specific means (in GMEAN) and variance (in VARWG). (3) Store a genotype-specific deviation (DEV) for each individual and stores the logarithm of the jacobean as the penetrance probability (PENTR). (4) Assign an appropriate simulated phenotype using the simulated genotype and simulated deviation.
Name the modified subroutine qmlpr with 1-3 added letters and add the relevant information to qmlp.dat (section B.8). Assign the number associated with the subroutine in qmlp.dat in a DATA statement in a BLOCK DATA SUBROUTINE appended to qmlpr.
See subroutine qmlprmv for an example of the minimum structure of qmlpr. Subroutine qmlprmv (1) assigns to ICATEG, -1 if measured and 0 if unmeasured, (2) stores the means and standard deviations which were input as PARMQ as GMEAN and VARWG, (3) transforms the phenotype and stores the deviation from each genotypic mean as DEV, (4) applies the mean and variance for the simulated genotype to the simulated deviation to produce a simulated phenotype.
Subroutine papwg has two purposes. First, transfers parameter from PARWG to the correlation array RHO. Second, it assigns a correlation to each pair in the pedigree in array RWG.
Name the modified subroutine papwg with 1-3 added letters and add the relevant information to wgen.dat (section B.9). Assign the number associated with the subroutine in wgen.dat in a DATA statement in a BLOCK DATA SUBROUTINE appended to papwg.
See subroutine papwgml for an example of the minimum structure of papwg. It stores values from PARWG in RHO as the correlations between traits. Then it generates the pedigree correlation matrix using those correlations.