{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "people-introduction",
      "metadata": {
      },
      "source": "# Case A: recorded student choices\n\nReanalyse the original College Pulse December 2018 survey, attributed by [u/monkeymaster56](https://www.reddit.com/r/dataisbeautiful/comments/acow6y/asking_over_8500_students_to_pick_a_random_number/). The exact question was: **Pick a random number from 1-10. [Asked by: Rutgers]**\n\nRun from the project root with **Shared variables** and execute cells in order. The notebook contains native Aner code and empty outputs; every count and chart is computed from the bundled response projection. [Source verification, inclusion rules and rights](../docs/human-sources.md).\n"
    },
    {
      "cell_type": "markdown",
      "id": "people-ingestion-note",
      "metadata": {
      },
      "source": "## Read the traceable source\n\nThe bounded projection retains all 8,808 target-response strings, spreadsheet rows and classifications. Missing text remains missing. The original question did not explicitly require an integer; accepting only whole values 1–10 is this study's declared comparison policy.\n"
    },
    {
      "cell_type": "code",
      "id": "people-ingestion",
      "metadata": {
      },
      "execution_count": null,
      "outputs": [

      ],
      "source": "// Case A: recorded College Pulse student choices, not generated human values.\n// Run from the project root. Provenance and rights: docs/human-sources.md.\nimport aner.data\nimport aner.plot\n\nfn people_json_counts(values: Array<Int64>) -> String {\n    var text = \"[\"\n    for i in Range(values.len()) {\n        if i > 0 { text = text + \",\" }\n        text = text + String(values[i])\n    }\n    return text + \"]\"\n}\n\n// The CSV retains every target response, spreadsheet row identity and category.\nvar people_schema = data.schema()\npeople_schema = data.column(people_schema, \"source_row\", \"Int64\", false)\npeople_schema = data.column(people_schema, \"response\", \"Float64\", true)\npeople_schema = data.column(people_schema, \"classification\", \"String\", false)\nlet people_rows = data.collect(data.scan_csv(\n    \"data/human/college-pulse-2018-responses.csv\", people_schema, missing: \"\"),\n    max_rows: 10_000, max_bytes: 16_777_216, batch_rows: 1_024)\nif data.rows(people_rows) != 8_808 {\n    print(\"FAILED: Case A requires the documented 8808-row source snapshot\")\n    print(integer_div(1, 0))\n}\n\n"
    },
    {
      "cell_type": "markdown",
      "id": "people-analysis-note",
      "metadata": {
      },
      "source": "## Recompute every classification and count\n\nValidate each source row and category, then calculate the ten-bin histogram. No cached histogram is read. The JSON record identifies the source projection and keeps the accepted and excluded denominators separate.\n"
    },
    {
      "cell_type": "code",
      "id": "people-analysis",
      "metadata": {
      },
      "execution_count": null,
      "outputs": [

      ],
      "source": "let people_counts = Array<Int64>(10, 0)\n// Categories: accepted integer, outside 1-10, non-integer, missing.\nlet people_categories = Array<Int64>(4, 0)\nfor row in Range(data.rows(people_rows)) {\n    if data.integer(people_rows, row, \"source_row\") != row + 2 {\n        print(\"FAILED: Case A spreadsheet row identity differs\")\n        print(integer_div(1, 0))\n    }\n    var category = \"missing\"\n    var category_index = 3\n    if !data.is_missing(people_rows, row, \"response\") {\n        let value = data.number(people_rows, row, \"response\")\n        if value < 1.0 || value > 10.0 {\n            category = \"out_of_range\"\n            category_index = 1\n        } else if value == Float64(Int64(value)) {\n            category = \"valid_integer\"\n            category_index = 0\n            people_counts[Int64(value) - 1] += 1\n        } else {\n            category = \"non_integer\"\n            category_index = 2\n        }\n    }\n    if data.text(people_rows, row, \"classification\") != category {\n        print(\"FAILED: Case A classification differs at source row \" + String(row + 2))\n        print(integer_div(1, 0))\n    }\n    people_categories[category_index] += 1\n}\n\nlet people_accepted = people_categories[0]\nlet people_percentages = Array<Float64>(10, 0.0)\nfor face in Range(10) { people_percentages[face] = 100.0 * people_counts[face] / people_accepted }\nprint(\"Case A: \" + String(people_accepted) + \" accepted integer choices from \"\n    + String(data.rows(people_rows)) + \" recorded source rows\")\nprint(\"Seven: \" + String(people_counts[6]) + \" / \" + String(people_accepted)\n    + \" = \" + String(people_percentages[6]) + \"%\")\nprint(\"Grouped source order is not chronology; no temporal analysis is performed.\")\nprint(\"TRACEABLE_CHOICES_A_V1 {\\\"schema\\\":\\\"traceable-number-choices.people/1\\\",\\\"case\\\":\\\"A\\\",\"\n    + \"\\\"source_id\\\":\\\"college-pulse-2018-number-choice\\\",\\\"source_rows\\\":\" + String(data.rows(people_rows))\n    + \",\\\"accepted\\\":\" + String(people_accepted) + \",\\\"out_of_range\\\":\" + String(people_categories[1])\n    + \",\\\"non_integer\\\":\" + String(people_categories[2]) + \",\\\"missing\\\":\" + String(people_categories[3])\n    + \",\\\"counts\\\":\" + people_json_counts(people_counts) + \",\\\"seven_percent\\\":\" + String(people_percentages[6])\n    + \",\\\"order\\\":\\\"grouped_source_order\\\",\\\"temporal_analysis_allowed\\\":false,\"\n    + \"\\\"projection_hash_verified_at_runtime\\\":false,\"\n    + \"\\\"source_projection_sha256\\\":\\\"87f9c8272314ee4b3c1599dbb8c51754dbfb24658fb6ff6b107dd181162a3e52\\\"}\")\n"
    },
    {
      "cell_type": "markdown",
      "id": "people-chart-note",
      "metadata": {
      },
      "source": "## Show accepted choices\n\nThe denominator is the accepted integer choices, not all recorded rows. The published source groups/sorts responses and provides no answer timestamps: row identifiers establish provenance, not chronology. No temporal or causal sequence analysis is performed.\n"
    },
    {
      "cell_type": "code",
      "id": "people-chart",
      "metadata": {
      },
      "execution_count": null,
      "outputs": [

      ],
      "source": "let people_labels = List(\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\")\nlet people_chart = plot.bar(people_labels, people_percentages)\n    .title(\"Case A · Recorded student choices\")\n    .labels(\"Chosen integer\", \"Accepted responses (%)\")\n    .caption(\"College Pulse, Dec 2018. Valid n=\" + String(people_accepted)\n        + \" of \" + String(data.rows(people_rows)) + \"; \"\n        + String(data.rows(people_rows) - people_accepted) + \" exclusions retained. Uniform reference: 10%.\")\n    .theme(plot.theme(\"light\"))\n    .size(width: 960, height: 540)\npeople_chart.show()\n"
    },
    {
      "cell_type": "markdown",
      "id": "people-limits",
      "metadata": {
      },
      "source": "## Interpretation and rights\n\nThese recorded student choices describe one convenience sample and one survey context. Nonuniform number choices alone do not establish model quality, intelligence or a causal explanation of why seven was selected. The native execution cases test equality of shared seeded draws; they are not independent surveys.\n\n**Dataset rights: unspecified.** No explicit redistribution license was identified in the original post or sheet. The project's code license does not relicense this bounded factual survey projection. Collection is credited to College Pulse, the question to Rutgers, and the linked original analysis to u/monkeymaster56. This chart is generated from the source values; the original chart is not copied.\n"
    }
  ],
  "metadata": {
    "kernelspec": {
      "name": "aner",
      "display_name": "Aner",
      "language": "aner"
    },
    "language_info": {
      "name": "aner",
      "file_extension": ".aner",
      "mimetype": "text/x-aner"
    },
    "aner": {
      "execution_mode": "persistent-session",
      "runtime_mode": "production",
      "source_file": "../examples/case_A_people.aner",
      "status": "live-source-only"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
