Run Regression
run_regressionThis is QUESTIONSTAR's built-in, server-side computation on the survey's responses. The same and other statistics (e.g. multivariate/interaction regression, time-series, ANOVA) can be computed from the raw responses returned by list_survey_responses. Computes a LINEAR REGRESSION of one survey variable (dependent) on one or more predictors. Variables are addressed by question codes as returned by get_survey: Q1 (whole question), Q3.1 (matrix row), Q2.3 (checkbox option — enters as 0/1). Analyzable: choice questions (options enter by their numeric export code), checkbox options, numeric, slider and sorting questions; free-text cannot be analyzed. Responses missing ANY model variable are excluded LISTWISE. The result uses POSITIONAL header contracts: modelSummaryHeader[i] names modelSummary[i] (R², adjusted R², …); anovaHeader names the columns of each anova row; coefficientNames[i] names coefficients[i] — each coefficient row holds estimate, standard error, t and p in the header's order. coefficientsWarnings carries engine warnings such as collinearity. The regression runs on the server's R engine; if it is unavailable the call returns an error envelope. Heavy rate class (600 requests/hour).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Survey publication code — the 8-character code from the survey's public link (e.g. 1a2b3c4d). Returned by list_surveys. | |
| dependent | Yes | Question code of the dependent variable (the one to explain). | |
| predictors | Yes | Question codes of the predictors, at least one. | |
| includeConstant | No | Whether the model includes a constant (intercept); omitted = true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| anova | No | ||
| errors | No | ||
| dependent | No | ||
| casesTotal | No | ||
| predictors | No | ||
| surveyCode | No | ||
| anovaHeader | No | ||
| coefficients | No | ||
| modelSummary | No | ||
| coefficientNames | No | ||
| modelSummaryHeader | No | ||
| coefficientsWarnings | No |