Appendix C — Quick Reference

A compact reference to every exported function in the PRA package. Arguments marked * are required; all others have defaults.

C.1 Monte Carlo Simulation

Function Key Arguments Returns Chapter
mcs(task_dists*, n, cor_mat) task_dists list of distribution specs; n simulations (default 10 000); optional correlation matrix S3 object of class mcs with $simulations matrix, $total_distribution, percentiles Chapter 2
print.mcs(x) x an mcs object Console summary of P50/P80/P95 and task means Chapter 2

Distribution spec format (used by mcs(), sensitivity(), smm()):

list(type = "normal",     mean = 10, sd = 2)
list(type = "triangular", a = 5, b = 10, c = 15)   # a=min, b=mode, c=max
list(type = "uniform",    min = 8, max = 12)

C.2 Second Moment Method

Function Key Arguments Returns Chapter
smm(means*, vars*) Numeric vectors of task means and variances S3 object of class smm with $total_mean, $total_var, $total_sd Chapter 3
print.smm(x) x an smm object Console summary of total mean, SD, and 95% CI Chapter 3

C.3 Sensitivity Analysis

Function Key Arguments Returns Chapter
sensitivity(task_dists*, cor_mat) Same distribution specs as mcs(); optional correlation matrix Named numeric vector of sensitivity indices (one per task) Chapter 4

C.4 Contingency & Correlation

Function Key Arguments Returns Chapter
contingency(mcs_result*, phigh, pbase) mcs_result from mcs(); phigh target percentile (default 0.95); pbase base percentile (default 0.50) Numeric contingency reserve (phigh quantile minus pbase quantile) Chapter 2
cor_matrix(num_samples, num_vars, dists*) dists list of sampling functions function(n) ...; num_samples (default 100); num_vars (default 5) Numeric correlation matrix Chapter 4

C.5 Earned Value Management

All EVM functions accept numeric scalars or vectors as noted.

Function Key Arguments Returns Chapter
pv(bac*, schedule*, period*) Budget at completion; cumulative schedule proportions; current period (1-based) Planned Value Chapter 5
ev(bac*, complete*) Budget at completion; fraction complete (0–1) Earned Value Chapter 5
ac(costs*, period*) Vector of actual costs per period; current period Actual Cost Chapter 5
sv(ev*, pv*) Earned Value; Planned Value Schedule Variance (EV − PV) Chapter 5
cv(ev*, ac*) Earned Value; Actual Cost Cost Variance (EV − AC) Chapter 5
spi(ev*, pv*) Earned Value; Planned Value Schedule Performance Index (EV / PV) Chapter 5
cpi(ev*, ac*) Earned Value; Actual Cost Cost Performance Index (EV / AC) Chapter 5
eac(bac*, ac*, ev*, method) BAC, AC, EV; method = “typical” / “atypical” / “combined” Estimate at Completion Chapter 5
etc(eac*, ac*) Estimate at Completion; Actual Cost Estimate to Complete (EAC − AC) Chapter 5
tcpi(bac*, ev*, eac*) BAC, EV, EAC To-Complete Performance Index Chapter 5
vac(bac*, eac*) Budget at Completion; Estimate at Completion Variance at Completion (BAC − EAC) Chapter 5

C.6 Bayesian Risk

Function Key Arguments Returns Chapter
risk_prob(causes*, given*, not_given*) Vectors of prior probabilities, likelihoods if cause present/absent Prior risk probability (scalar) Chapter 6
risk_post_prob(causes*, given*, not_given*, observed*) Same as above plus observed vector (1 = observed, 0 = not, NA = unknown) Posterior risk probability after observations Chapter 6

C.7 Learning Curves

Function Key Arguments Returns Chapter
fit_sigmoidal(x*, y*, model) x time vector; y response vector; model = “logistic” / “gompertz” / “pearl” List with fitted model object, coefficients, RSE Chapter 7
predict_sigmoidal(fit*, newx*) Object from fit_sigmoidal(); new x values Numeric vector of predictions Chapter 7
plot_sigmoidal(fit*, x*, y*) Object from fit_sigmoidal(); original data Plot of fitted curve with confidence band Chapter 7

C.8 Design Structure Matrices

Function Key Arguments Returns Chapter
parent_dsm(S*) Resource-Task matrix S (resources × tasks, binary) S3 object of class parent_dsm; $matrix is tasks × tasks Chapter 8
grandparent_dsm(S*, R*) Resource-Task matrix S; Risk-Resource matrix R (risks × resources, binary) S3 object of class grandparent_dsm; $matrix is tasks × tasks Chapter 8

Both objects have print() and plot() methods.


C.9 Probabilistic Networks

Function Key Arguments Returns Chapter
prob_net(nodes*, links*, distributions*) Data frames of nodes (id, label, group) and links (source, target, value); named list of distributions Graph object (list of nodes, links, distributions) Chapter 9
prob_net_sim(graph*, num_samples) Graph from prob_net(); number of simulations (default 10 000) Named list of sample vectors, one per node Chapter 9
prob_net_learn(graph*, observations*, num_samples) Graph; named list of clamped observations e.g. list(B = "No"); sample count Named list of sample vectors with upstream nodes clamped Chapter 9
prob_net_update(graph*, remove_links, update_distributions) Graph; data frame of edges to remove; named list of replacement distributions Modified graph object Chapter 9

Node distribution types (used in distributions list):

list(type = "discrete",     values = c(1, 0), probs = c(0.7, 0.3))
list(type = "normal",       mean = 50000, sd = 10000)
list(type = "conditional",  condition = "A",
     true_dist  = list(type = "normal", mean = 80000, sd = 20000),
     false_dist = list(type = "normal", mean = 50000, sd = 10000))
list(type = "aggregate",    nodes = c("F", "G", "H"))

C.10 Agentic Framework

Function Key Arguments Returns Chapter
pra_chat(model, chat) model Ollama model name (default “llama3.2”); or chat an ellmer chat object for cloud models Chat object; call $chat("...") to converse Chapter 11
pra_app() None Launches Shiny app in browser (requires Ollama) Chapter 11
pra_mcp_server() None Starts MCP server; register with claude mcp add Chapter 11