# valeriepan/survive-380-anna-the-best architecture

> Architecture diagram of the GitHub repository valeriepan/survive-380-anna-the-best, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/valeriepan/survive-380-anna-the-best
- Repository: https://github.com/valeriepan/survive-380-anna-the-best

## Overview

This is an R package and Shiny application for Monte Carlo study of one-sample binomial-proportion z-tests. The documented workflow lets a user vary simulation and test settings, simulate binomial outcomes and p-values, estimate Type I error, Type II error, and power, then inspect a summary table and p-value histogram. The README and file tree support these product capabilities and module paths; source excerpts were unavailable, so the graph avoids asserting specific calls between app modules and package functions.

Main entry points: [`R/Function_Code.R`](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R) (Simulation functions), [`shiny-app/server-plots.R`](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/server-plots.R) (Plot handling), [`shiny-app/app.R`](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/app.R) (Shiny app), [`shiny-app/R/ui-sim_input.R`](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/R/ui-sim_input.R) (Simulation controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Interactive app"]
  node_app_entry["Shiny app<br/>[app.R]"]
  node_sim_controls["Simulation controls<br/>[ui-sim_input.R]"]
  node_plot_server["Plot handling<br/>[server-plots.R]"]
end

subgraph group_simulation["Simulation and tests"]
  node_package_functions["Simulation functions<br/>[Function_Code.R]"]
  node_pval_binom["Binomial p-values<br/>[Function_Code.R]"]
  node_pval_null["Null p-values<br/>[Function_Code.R]"]
end

subgraph group_results["Results and visualization"]
  node_type1["Type I error<br/>[Function_Code.R]"]
  node_power_simple["Type II and power<br/>[Function_Code.R]"]
  node_power_curve["Power curve<br/>[Function_Code.R]"]
  node_summary_table["Error and power table"]
  node_pvalue_histogram["P-value histogram"]
end

node_user(("User"))

node_user -->|"interacts with"| node_app_entry
node_user -->|"adjusts"| node_sim_controls
node_package_functions -->|"computes"| node_pval_binom
node_package_functions -->|"computes"| node_pval_null
node_package_functions -->|"estimates"| node_type1
node_package_functions -->|"estimates"| node_power_simple
node_package_functions -->|"estimates"| node_power_curve
node_type1 -->|"reports"| node_summary_table
node_power_simple -->|"reports"| node_summary_table
node_power_curve -->|"reports"| node_summary_table
node_pval_binom -->|"provides p-values"| node_pvalue_histogram
node_pval_null -->|"provides p-values"| node_pvalue_histogram
node_plot_server -->|"renders"| node_pvalue_histogram

click node_app_entry "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/app.R"
click node_sim_controls "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/R/ui-sim_input.R"
click node_plot_server "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/server-plots.R"
click node_package_functions "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R"
click node_pval_binom "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R"
click node_pval_null "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R"
click node_type1 "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R"
click node_power_simple "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R"
click node_power_curve "https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_entry,node_sim_controls,node_plot_server,node_user toneBlue
class node_package_functions,node_pval_binom,node_pval_null toneAmber
class node_type1,node_power_simple,node_power_curve,node_summary_table,node_pvalue_histogram toneMint
```

## Components

### Interactive app

- [Shiny app](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/app.R): `shiny-app/app.R`
- [Simulation controls](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/R/ui-sim_input.R): `shiny-app/R/ui-sim_input.R`
- [Plot handling](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/shiny-app/server-plots.R): `shiny-app/server-plots.R`

### Simulation and tests

- [Simulation functions](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R): `R/Function_Code.R`
- [Binomial p-values](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R): `R/Function_Code.R`
- [Null p-values](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R): `R/Function_Code.R`

### Results and visualization

- [Type I error](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R): `R/Function_Code.R`
- [Type II and power](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R): `R/Function_Code.R`
- [Power curve](https://github.com/valeriepan/survive-380-anna-the-best/blob/main/R/Function_Code.R): `R/Function_Code.R`
- **Error and power table**
- **P-value histogram**

### Other components

- **User**

## Connections

- User → Shiny app: interacts with
- User → Simulation controls: adjusts
- Simulation functions → Binomial p-values: computes
- Simulation functions → Null p-values: computes
- Simulation functions → Type I error: estimates
- Simulation functions → Type II and power: estimates
- Simulation functions → Power curve: estimates
- Type I error → Error and power table: reports
- Type II and power → Error and power table: reports
- Power curve → Error and power table: reports
- Binomial p-values → P-value histogram: provides p-values
- Null p-values → P-value histogram: provides p-values
- Plot handling → P-value histogram: renders
