<div class="section-label"><span class="num">03</span> PSR</div> <div class="section-title"><em>Partial-sample regression</em> at thresholds you choose.</div> `POST /psr` forms a relevance-weighted forecast at the thresholds you set. Prefer a [[API/Clients/Introduction|language client]] unless you are writing HTTP yourself. For primary analysis, use [[API/Endpoints/Grid|Grid]]. What PSR means: [[Functions/Predict|Predict]]. **Call:** `POST /psr` **Auth:** `x-api-key` header + `access_id` in the body **Returns:** a receipt, then poll [[API/Endpoints/Results|Results]] ## Signature ```http POST https://api.csanalytics.io/v3/rbp-engine/psr ``` Required JSON body: ```text { access_id, y, # outcomes, N numbers X # attributes, N rows of K numbers } ``` Optional: `theta` and `options` ([[Settings/Options#PredictOptions|PredictOptions]]). PSR does not accept `censor_type` `both`; use [[API/Endpoints/MaxFit|MaxFit]] or [[API/Endpoints/Grid|Grid]] for that. ## Example ```python import os, time, requests base = "https://api.csanalytics.io/v3/rbp-engine" headers = { "x-api-key": os.environ["CSA_API_KEY"], "Content-Type": "application/json", } payload = { "access_id": os.environ["CSA_ACCESS_ID"], "y": [0.1, 0.2, 0.3], "X": [[1.0, 0.0], [0.0, 1.0], [1.0, 1.0]], } receipt = requests.post(f"{base}/psr", headers=headers, json=payload).json() job_id, job_code = receipt["job_id"], receipt["job_code"] while True: r = requests.get(f"{base}/results/{job_id}/{job_code}", headers=headers) if r.status_code == 202: time.sleep(2) continue r.raise_for_status() print(r.json()["results"]["yhat"]) break ``` A successful POST returns a receipt: <span class="mono">job_id</span> and <span class="mono">job_code</span>. Client that wraps this loop: [[API/Clients/Python|Python]]. Stdlib-only example: [post_predict_http.py](https://github.com/CambridgeSportsAnalytics/rbp-engine-api-client/blob/main/python/examples/post_predict_http.py). ## Options Put settings on `options`. Names match [[Settings/Options#PredictOptions|PredictOptions]]: `threshold`, `censor_type`, `censor_unit`, `censor_operator`, `prediction_scale`, `inv_method`, and related flags. For logistic outcomes, set `prediction_scale` to `logistic`. ## Results [[API/Endpoints/Results|Results]] include the forecast at the thresholds you chose, with fit and weights. [[Results/Overview|Results]] Full HTTP contract: [rbp-engine-api.json](https://github.com/CambridgeSportsAnalytics/rbp-engine-api-client/blob/main/openapi/rbp-engine-api.json). ## Related - [[API/Introduction|API]] · [[API/Clients/Introduction|Clients]] - [[API/Endpoints/Grid|Grid]] · [[API/Endpoints/MaxFit|MaxFit]] - [[Functions/Predict|Predict]] <div class="btn-row center"> <a class="btn-primary" href="/API/Clients/Python">Python client</a> <a class="btn-ghost" href="/API/Endpoints/Grid">Grid</a> </div>