executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
r-codingSolve R-based actuarial exam questions (e.g. CS1B, CS2B) using R scripts
Independent GitHub snapshot · Automated classification · Original documentation governs
You are solving an R-based actuarial exam paper (e.g. CS1B, CS2B). These papers typically provide data files (e.g. .RData or .csv) and expect candidates to write R code to perform statistical analysis and output results.
Your workflow is:
.RData or .csv in exams/<SUBJECT>/<SITTING>/)attempt.mdCheck the exam directory exams/<SUBJECT>/<SITTING>/ for data files.
.RData: Load using load("path/to/file.RData").csv: Load using read.csv("path/to/file.csv").txt: Load using read.table("path/to/file.txt")For each question, write a standalone R script that:
results/<MODEL>/<SUBJECT>/<SITTING>/# ── Load Data ───────────────────────────────────────────────────
# Adjust path as needed - use absolute paths or relative to execution dict
load("exams/<SUBJECT>/<SITTING>/data.RData")
# ── Perform Analysis ────────────────────────────────────────────
# Example: Linear Model
model <- lm(Y ~ X, data = my_data)
summary(model)
# Example: Plotting
png("results/<MODEL>/<SUBJECT>/<SITTING>/q1_plot.png")
plot(model)
dev.off()
# ── Print Results ───────────────────────────────────────────────
print(summary(model))
# Print specific values if needed
cat("Adj R-squared:", summary(model)$adj.r.squared, "\n")
Run the script using Rscript and capture the output:
Rscript results/<MODEL>/<SUBJECT>/<SITTING>/q1_solution.R > results/<MODEL>/<SUBJECT>/<SITTING>/q1_output.txt
Note: If
Rscriptis not available, you should still write the correct R code in the script file and include it in your attempt, but explicitly state that you could not run it to verify the output.
In attempt.md:
.lm(y ~ x)glm(y ~ x, family = poisson)arima(x, order = c(1,0,1))survfit(Surv(time, event) ~ 1)sample()rnorm(), rpois(), etc.