Skip to main content

Docs · Research

Data Studio: statistics, graphs, Python and R

Every dataset opens in a studio with SPSS-style menus: Data (select, sort, restructure, merge), Transform (recode, standardize, rank, bin, impute…), Analyze (45 analyses from frequencies to Cox regression, factor analysis and clustering), Graphs, a Python/R code runner and an Assistant tab your own AI agent works through. Every result is saved in the Output viewer with the syntax that reproduces it.

Updated 2026-09-12Open a project → Data

The studio at a glance

Project → Data lists the datasets; creating or importing one opens the studio: six tabs (Data · Variables · Output · Graphs · Code · Assistant) under a menu bar (File · Data · Transform · Analyze · Graphs · Code). The Analyze menu opens with a search box and a “Common” shortlist in plain language (compare two groups, predict a yes/no outcome…) above the full catalogue.

TabWhat it holds
DataThe case grid: click a cell and type, Enter moves down, Tab moves right, paste a block from a spreadsheet. Toolbar: undo/redo, add or delete rows, add variable, compute, select cases, pivot, export, history, value labels.
VariablesThe codebook: one row per variable with name, label, type, measure, value labels, missing values and width.
OutputEvery saved result: analyses, code runs and AI answers, pinned ones first. Tables copy as tab-separated text; charts export as SVG or 300-DPI PNG; the syntax that reproduces an analysis is one click away.
GraphsThe chart builder bound to this dataset: bar, line, scatter, box, histogram, Kaplan–Meier, bubble, forest and funnel plots with journal presets.
CodeWrite Python or R against the dataset and run it in the sandbox; the script, printed output, tables and figures are saved together.
AssistantWhere your AI agent works on this dataset: it describes the variables, runs analyses from the catalogue and sandboxed Python or R, and the outputs land in Output. Where an administrator has switched platform AI on, you can also type the question here.

The graphs hub tab moved here: figures belong with the data they draw. The datasets page also has project-wide Outputs and Graphs tabs.

Data menu — cases

  • Select cases… keeps the cases where a condition is true (age >= 18 AND sex = "F"); the others are greyed out and left out of every analysis unless you untick “Active cases only”.
  • Split file is an option inside every analysis dialog: the analysis is repeated for each level of the split variable, stacked in one output.
  • Sort cases, Remove duplicate cases (by key), Aggregate (one row per group with n, mean, sum, SD…), Restructure wide → long and long → wide, Merge by key and Append cases. Aggregate, restructure, merge and append create a new derived dataset so the original stays intact.

Transform menu — variables

CommandResult
Compute variableA formula over other variables (ROUND, IF, MEAN, DATEDIFF… — see the function list in the dialog), kept up to date when inputs change
Recode into different variableOld value / range / missing → new code, rules top to bottom, unmatched values copied or dropped
Automatic recodeText categories → integer codes with value labels
Standardizez-scores
Rank cases / N-tilesAverage ranks, or quartiles, quintiles… as an ordinal variable
Visual binningEqual width, quantiles, mean ± SD or custom cut points, with generated labels
Count occurrencesHow many of the chosen variables equal a value, fall in a range or are missing
Indicator variablesOne 0/1 dummy per category
Replace missing valuesMean, median, mode, constant, last observation carried forward or linear interpolation
Lag, cumulative sum, differencesIn case order
String function, Date partUPPER/LOWER/TRIM/LENGTH; year, month, day, weekday, quarter

Analyze menu — the statistics engine

Each analysis opens a dialog: pick the variables by role (only suitable ones are offered), set options, watch the live preview, then “Run and save to Output”. Results come as APA-ready tables with statistics, p-values, effect sizes and confidence intervals, a summary sentence you can paste into a manuscript, and charts where they help.

GroupAnalyses
Descriptive statisticsFrequencies, Descriptives, Explore (CIs, percentiles, outliers, normality, histogram, Q–Q), Normality tests, Crosstabs (χ², Fisher, likelihood ratio, residuals, OR/RR/NNT, κ), Missing value analysis
Compare meansMeans by group, one-sample / independent / paired t-tests (Levene, Welch, Cohen's d, Hedges' g), one-way ANOVA with Welch's F and post hoc tests (Tukey, Games–Howell, Bonferroni, Holm, Scheffé), Bootstrap CIs
General linear modelFactorial ANOVA / ANCOVA with interactions and partial η²; repeated-measures ANOVA with Greenhouse–Geisser and Friedman
CorrelatePearson, Spearman, Kendall matrices with heatmap; partial correlations
RegressionLinear (standardized β, VIF, Durbin–Watson, Breusch–Pagan, residual plots), binary logistic (OR, Hosmer–Lemeshow, classification, AUC), Poisson (IRR, offset, overdispersion), multinomial, ordinal (proportional odds, parallel lines), curve estimation (8 models)
NonparametricMann–Whitney, Kruskal–Wallis with pairwise tests, Wilcoxon, sign, Friedman, McNemar, Cochran's Q, chi-square goodness of fit, binomial, runs, one- and two-sample Kolmogorov–Smirnov, median test, Jonckheere–Terpstra
SurvivalKaplan–Meier (medians with CI, survival at times, log-rank, pairwise, HR) and Cox regression (Efron ties, LR/Wald/score tests, concordance, forest plot)
Scale and agreementCronbach's α with item-total statistics, intraclass correlations, Cohen's κ (weighted), Bland–Altman with Lin's CCC
ClassifyDiagnostic accuracy (Se, Sp, PPV, NPV, LRs, DOR with CIs), ROC (DeLong CI, Youden cut-off), k-means, hierarchical clustering with dendrogram, discriminant analysis
Dimension reductionPCA and principal-axis factoring with KMO, Bartlett, scree plot, varimax rotation, communalities

Assumption checks are built in: t-tests and ANOVA report Levene's test and switch the post hoc test when variances differ; Explore and Normality run Shapiro–Wilk, Anderson–Darling and Lilliefors and say which test family to prefer; regressions report VIF, heteroscedasticity and residual normality.

Code — Python and R

The Code tab runs your own script in an isolated sandbox (no network, three-minute limit) against the active cases. Python has pandas, numpy, scipy, statsmodels, lifelines, scikit-learn, seaborn/matplotlib and pingouin; R has survival, ggplot2, lme4, metafor, meta, pROC, car, emmeans, psych, irr, nnet and ordinal.

Python: numbers with hikma.result, tables with hikma.table, figures with hikma.figure(name, fig, caption)

import pandas as pd
d = pd.read_csv(DATA_PATH + "/data.csv")
hikma.result("n", len(d), label="Cases")
hikma.table("means", d.groupby("arm")["sbp"].mean().reset_index(), "Mean SBP by arm")

R: hikma$data() reads the cases; hikma$result / hikma$table / hikma$figure report

d <- hikma$data()
m <- coxph(survival::Surv(time, status) ~ group, data = d)
hikma$table("hr", as.data.frame(summary(m)$conf.int), "Hazard ratios")
hikma$figure("km", function() plot(survival::survfit(survival::Surv(time, status) ~ group, data = d)), "Kaplan–Meier")

Templates in the tab give you a starting script for descriptives, tests, mixed models, Cox models and plots. Every run is saved to Output with its script, so a reviewer can rerun it.

Analysing with AI

Ask your connected agent (project → Your AI) about the dataset in plain language — “does systolic blood pressure differ between arms after adjusting for age?”. Over MCP it describes the dataset and its variable dictionary, runs analyses from the catalogue, writes and runs sandboxed Python or R for what the catalogue cannot express, and reads the results back; every output lands in the Output viewer with the syntax that reproduces it, so its interpretation can be checked number by number.

The Assistant tab's own question box — type a question, the platform plans 1–6 steps, runs them and writes the interpretation from the returned results only — needs platform AI switched on by an administrator. In the default mode the tab explains where to ask instead.

  1. Describe what you want to know, naming the project and the dataset.
  2. The steps are planned against the variable dictionary, preferring analyses from the catalogue over hand-written code.
  3. Each step runs on your real data in the sandbox; nothing is estimated.
  4. The interpretation must come from the returned tables — every number copied, with caveats — because that is all the results contain.
  5. The answer, its steps and their tables are saved to Output and listed under Earlier questions.

From an MCP client (Claude, Codex, Cursor…), the same power is available through describe_dataset, list_analysis_catalog, run_dataset_analysis, transform_dataset, dataset_cases, run_dataset_code and list_dataset_outputs.

From Output into the manuscript

Every saved output has “Insert into manuscript”: choose the manuscript, what to include (the summary sentence, the tables, the charts) and where; the tables arrive as real tables, the charts as figures with captions, all as tracked changes attributed to whoever inserted them — “Claude Code” or whatever your connected agent is called — so co-authors can accept or reject them. Meta-analysis results, risk-of-bias and Summary-of-Findings tables insert the same way from their own pages.

Identifier scan and de-identification

Every dataset is scanned when it is created or imported: variable names, labels and a sample of values are checked for direct identifiers (names, e-mail addresses, telephone numbers, postal addresses, national or hospital numbers, dates of birth, device identifiers). A red or amber banner in the studio lists the flagged columns with the reason. Remove or recode them (Variables tab, Transform › Recode), re-scan, or record an attestation that the data are de-identified — the attestation is kept with the dataset's history with your name and the time. Study codes issued by the project are flagged as “possible” only so you can confirm them.

Graphs — from the dataset, saved as outputs

The Graphs tab (and Graphs › New graph) builds a figure from the dataset's own variables: bar (counts or a summary by category, stacked), line, pie, mean ± SD/SE/95% CI, scatter with trend line, box plot, histogram, Kaplan–Meier with log-rank, bubble, forest and funnel plots. Map the variables and the graph draws at once; style it (title, axes, palette, journal size) and press “Save graph” — it is stored in Output as a chart result with its settings, so you can reopen it with “Edit graph”, export it as SVG or 300-DPI PNG, and copy it to project files. The project's Data › Graphs gallery lists every saved graph across datasets; “New graph” always starts from a dataset. Numbers that are not in any dataset can still be graphed from the gallery's “typed values” panel.

Analyses save their own charts too (histograms with normal curve, Q–Q, error bars, ROC, survival curves, forest plots), and the Analysis hub's “Run an analysis” opens the chosen procedure on the chosen dataset in one step.

Output viewer

  • Pin what matters; rename outputs; delete drafts.
  • Copy any table as tab-separated text for Word or Excel; export any chart as SVG or 300-DPI PNG.
  • Analyses carry a Hikma syntax line (ANALYZE …) — the exact specification that produced them.
  • The datasets page → Outputs lists results across all datasets of the project.

Related

Something missing or wrong? Tell us.