Skip to main content
Glama
Ian3738
by Ian3738

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
R_MCP_RSCRIPTNoPath to the R executableRscript
R_MCP_TIMEOUTNoDefault per-call timeout in seconds180
R_MCP_WORKDIRNoWhere relative paths in data_load resolveStartup directory (home if /)

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
r_runA

Run arbitrary R code in the persistent session and return the console output plus any plots. This is the escape hatch for anything the structured tools do not cover: custom models, package-specific functions, data wrangling, or follow-up on a saved model (e.g. summary(anova_fit1)). Objects created here persist and are visible to the other tools; a data frame you create is usable as data="<name>" everywhere.

r_install_packagesA

Install R packages from CRAN into the user's R library. Use when a tool reports that a package is missing. Installation can take several minutes for packages that compile.

r_session_infoA

Report the R version, platform, working directory and which key statistics packages are available.

data_loadA

Load a data file into the session under a name. Supports CSV, TSV, Excel (.xlsx/.xls), SPSS (.sav), Stata (.dta), SAS (.sas7bdat), RDS, RData, JSON and Parquet; the format is detected from the extension. Returns the dimensions and a per-column summary of types, missing values and example values. The dataset is then available to every other tool as data="<name>".

data_builtinA

Load a dataset that ships with R or with an installed package (mtcars, iris, ToothGrowth, sleepstudy from lme4, bfi from psych, lung from survival, HolzingerSwineford1939 from lavaan, ...). Useful for demonstrating a method or checking that an analysis works before running it on real data.

data_listA

List the datasets and other objects (fitted models, vectors) currently in the R session, with their dimensions.

session_clearA

Remove datasets and models from the session, freeing memory and preventing one analysis from leaking into the next. Use it when switching to an unrelated topic. Pass keep to hold on to named objects. Safer than clearing by hand: it never touches the server's own internal bindings.

data_inspectA

Inspect a dataset: dimensions, per-column type, missing counts, distinct counts, example values, and the first rows. Run this before choosing an analysis - it tells you which columns are numeric versus factors, which is what determines whether a test will work.

data_transformA

Clean and reshape a dataset. Operations run in a fixed order: filter, mutate, to_numeric, recode, to_factor, factor_levels, select, drop, rename, arrange, drop_na, distinct, slice_head, reshape. Writes back to the same name unless save_as is given.

Converting grouping variables to factors is the most common prerequisite for the test tools: to_factor=['group']. Ordered factors for an ordinal outcome need factor_levels={'severity': ['low','medium','high']}.

data_exportB

Write a dataset from the session to disk as CSV, TSV, Excel or RDS.

describeA

Descriptive statistics: n, missing, mean, SD, SE, confidence interval for the mean, median, min/max, quartiles, IQR, skewness and kurtosis - optionally split by one or more grouping variables. Categorical columns get a level count and modal category instead.

frequency_tableA

Frequency tables for categorical variables, or a cross-tabulation with counts and row percentages when by is given. Use test_categorical afterwards to test the association.

check_assumptionsA

Check the assumptions behind parametric tests. On raw data: normality (Shapiro-Wilk, Kolmogorov-Smirnov, skew/kurtosis), homogeneity of variance across a group (Levene, Bartlett), outliers (z-scores and Tukey fences) and highly correlated variable pairs, plus Q-Q plots. On a fitted model (pass model instead of variables): residual normality, Breusch-Pagan heteroscedasticity, Durbin-Watson independence, VIF, and the standard four-panel diagnostic plot.

test_ttestA

Compare means with a t-test, reporting group descriptives, Levene's test, both the Student and Welch results, the mean difference with its confidence interval, and Cohen's d / Hedges' g with a confidence interval.

Three designs:

  • one sample: give y and mu (the test value)

  • two independent groups: give y and group (a 2-level factor)

  • paired: give y and y2 (the two measurement columns) with paired=true

Set nonparametric=true to add the Mann-Whitney U / Wilcoxon signed-rank equivalent with a rank-based effect size.

test_anovaA

ANOVA in all its usual forms, with effect sizes (eta squared, partial eta squared, omega squared), Levene's test and post-hoc comparisons via estimated marginal means.

  • one-way / factorial: dv plus between=['factor1','factor2']

  • ANCOVA: add covariates=['age']

  • repeated measures: within=['time'] plus id='subject' (data must be in long format)

  • mixed: both between and within, plus id

Set nonparametric=true for Kruskal-Wallis (between) or Friedman (within) with post-hoc tests, and welch=true for a Welch ANOVA when variances differ. The fitted model is saved for use with model_diagnostics.

test_categoricalA

Tests for categorical data. With x and y: a chi-square test of independence with the contingency table, expected counts, standardised residuals, Cramer's V, and - for 2x2 tables - the odds ratio, risk ratio and phi. Fisher's exact test is added automatically when expected counts are too small. With x only: a goodness-of-fit test against expected_probs (uniform by default). Set test='mcnemar' for paired binary data.

test_proportionA

Test proportions. One sample: a binary column (or raw successes/n) against a hypothesised proportion, with both the normal approximation and the exact binomial test. Two or more samples: pass group to compare the proportion across groups.

correlationA

Correlations between numeric variables: a full matrix plus per-pair tests with n, r, p, confidence intervals and a magnitude label. Supports Pearson, Spearman and Kendall, multiple-comparison adjustment, and partial correlations - pass control to residualise one or more variables out of every pair first.

regressionA

Fit a regression model and report coefficients with confidence intervals, model fit and diagnostics. Supported type values:

  • linear: OLS, with optional standardised betas and robust (HC3) standard errors

  • logistic: binary outcome, reported with odds ratios and a classification table

  • poisson / negbin: count outcomes, reported with incidence rate ratios

  • ordinal: ordered outcome (proportional odds); order the levels with data_transform first

  • multinomial: unordered outcome with more than two categories

  • mixed / mixed_logistic: multilevel models; give the random part in random, e.g. random='(1 | school)'

  • gam: smooth terms, written in the formula as s(x)

Specify the model either as formula ('y ~ x1 + x2 + x1:x2') or as dv plus predictors. The fit is saved in the session for model_diagnostics, model_compare and model_predict.

model_diagnosticsB

Full diagnostic report for a fitted model: residual normality, Breusch-Pagan test for heteroscedasticity, Durbin-Watson test for independence, VIF for multicollinearity, the most influential cases by Cook's distance and leverage, and the four standard diagnostic plots.

model_compareA

Compare two or more fitted models on AIC, BIC, log-likelihood and delta AIC, plus a likelihood-ratio or F test when the models are nested. Fit the models first with regression or test_anova, giving each a save_as name.

model_predictA

Predictions from a fitted model. Pass at for estimated marginal means at chosen predictor values (e.g. {'dose': [0, 10, 20]}), holding everything else at its average - this is the usual way to describe what a model implies. Pass newdata for predictions on specific new cases, or neither for fitted values on the original data.

reliabilityA

Internal-consistency reliability for a set of scale items: Cronbach's alpha with its confidence interval, McDonald's omega, the average inter-item correlation, and per-item statistics including the corrected item-total correlation and alpha-if-dropped. Flags items that weaken the scale. Use reverse (with scale_max) for reverse-worded items.

factor_analysisA

Exploratory factor analysis or principal component analysis. Reports KMO sampling adequacy, Bartlett's test of sphericity, the number of factors suggested by parallel analysis and by the Kaiser criterion, the rotated loading matrix with communalities, variance accounted for, a scree plot, and a list of items that cross-load or fail to load. Leave n_factors empty to use the parallel-analysis suggestion.

semA

Confirmatory factor analysis or structural equation modelling with lavaan. Give the model in lavaan syntax: =~ defines a latent factor ('anxiety =~ q1 + q2 + q3') ~ a regression ('outcome ~ anxiety + age') ~~ a covariance := a derived quantity Reports chi-square, CFI, TLI, RMSEA with its interval, SRMR, standardised loadings and path estimates, and composite reliability / AVE per factor. Set modification_indices=true to see which fixed parameters would most improve fit.

mediationA

Mediation analysis: does X affect Y through M? Builds and fits the path model, and reports the a, b, direct (c') and indirect paths with bootstrap confidence intervals - the standard Preacher-Hayes evidence for mediation. Supports several mediators at once (each gets its own indirect effect plus a total) and covariates.

moderationA

Moderation analysis: does the effect of X on Y depend on W? Fits the interaction model with mean-centred predictors, reports the R-squared change contributed by the interaction, and gives simple slopes at -1 SD / mean / +1 SD of a continuous moderator (or within each level of a categorical one), plus an interaction plot.

survival_analysisA

Survival / time-to-event analysis. type='km' gives Kaplan-Meier estimates with median survival, a survival curve, and a log-rank test when group is supplied; times_of_interest adds survival probabilities at chosen follow-up times. type='cox' fits a Cox proportional hazards model with hazard ratios, concordance, and the Schoenfeld test of the proportional-hazards assumption. event must be coded 1 = event occurred, 0 = censored.

time_seriesA

Time series analysis and forecasting. Reports stationarity (ADF and KPSS), STL decomposition with trend and seasonal strength, an automatically selected ARIMA or ETS model, in-sample accuracy, a Ljung-Box test on the residuals, and a forecast with prediction intervals - plus forecast, decomposition and ACF/PACF plots. Set frequency to the number of observations per cycle (12 for monthly, 4 for quarterly, 7 for daily data with a weekly cycle).

plotA

Draw a publication-style ggplot2 chart and return it as an image. Types: histogram, density, box, violin, scatter, line, bar, qq, heatmap.

x is the main variable (the grouping variable for box/violin plots), y the outcome, group adds colour, facet splits into panels. For scatter plots set smooth=true to overlay a fitted line; for bar plots giving y shows group means (with error_bars=true for standard errors) instead of counts. For anything more specific, write ggplot2 code in r_run.

survey_meanA

Means for complex survey data, with design-correct standard errors. Use this instead of describe whenever the data comes from a clustered or stratified sample — the ordinary standard error assumes a simple random sample and can be less than half the true value.

For achievement scores use plausible values, never a single score: pv_prefix='BSMMAT' expands to BSMMAT01..05 (TIMSS style), or pv_pattern='PV{i}MATH' expands to PV1MATH.. (PISA style). The output reports how much of the standard error comes from sampling versus measurement.

Give the design one of two ways: replicate_weights (existing columns — either a list of names or a prefix such as 'W_FSTURWT' that matches W_FSTURWT1..80), or jkzone + jkrep so JK2 replicates are built for you (TIMSS/PIRLS ship JKZONE and JKREP). method defaults to JK2 for constructed replicates and Fay for 60+ supplied columns, which is what PISA needs.

survey_regressionA

Weighted regression for complex survey data, with replicate-weight standard errors and plausible-value pooling (Rubin's rules, Barnard-Rubin degrees of freedom). Use this instead of regression for TIMSS/PISA-style data: passing a single plausible value to an ordinary regression ignores measurement uncertainty, which is often 10-20% of the total.

For achievement scores use plausible values, never a single score: pv_prefix='BSMMAT' expands to BSMMAT01..05 (TIMSS style), or pv_pattern='PV{i}MATH' expands to PV1MATH.. (PISA style). The output reports how much of the standard error comes from sampling versus measurement.

Give the design one of two ways: replicate_weights (existing columns — either a list of names or a prefix such as 'W_FSTURWT' that matches W_FSTURWT1..80), or jkzone + jkrep so JK2 replicates are built for you (TIMSS/PIRLS ship JKZONE and JKREP). method defaults to JK2 for constructed replicates and Fay for 60+ supplied columns, which is what PISA needs.

survey_correlationA

Correlations for complex survey data, with replicate-weight standard errors and plausible-value pooling. Correlates each column in x against either variables or a plausible-value set.

Give the design one of two ways: replicate_weights (existing columns — either a list of names or a prefix such as 'W_FSTURWT' that matches W_FSTURWT1..80), or jkzone + jkrep so JK2 replicates are built for you (TIMSS/PIRLS ship JKZONE and JKREP). method defaults to JK2 for constructed replicates and Fay for 60+ supplied columns, which is what PISA needs.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ian3738/r-stats-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server