OSCR

A method of compensating for the excitability of spinal motoneurones when estimating the magnitude of potentials evoked in skeletal muscles.

Code ↔ Paper

11 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

7 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 11 matches
  1. [1] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_QR_example_code.R, lines 53 to 93 · score 0.90 · vertical position, uncertainty concerning, intercept coincides, variation inherent, uncertainty increases, predictor variable · block oscr:b:HJ3MFW9PYT2Z3-2 · Report a mismatch
  2. [2] § Results and analyses › Implementation using quantile regression ↔ annotated_QR_example_code.R, lines 1 to 51 · score 0.90 · samples conform, quantreg package, constant variance, linear combination, squares regression, quantile regression · block oscr:b:8BD8GB3QCGQRQ-2 · Report a mismatch
  3. [3] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_LSR_example_code.R, lines 95 to 134 · score 0.87 · vertical position, intercept coincides, variation inherent, uncertainty increases, predictor variable, linear regression model · block oscr:b:Z6CME3KZHPQVV-D · Report a mismatch
  4. [4] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_LSR_example_code.R, lines 42 to 93 · score 0.80 · idealised scenario, necessarily equates, linear relationship, amplitude accounts, original MEP, contingent · block oscr:b:YJHSR49QY4X3M-T · Report a mismatch
  5. [5] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_QR_example_code.R, lines 53 to 93 · score 0.80 · idealised scenario, necessarily equates, linear relationship, amplitude accounts, original MEP, contingent · block oscr:b:HJ3MFW9PYT2Z3-2 · Report a mismatch
  6. [6] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_QR_example_code.R, lines 1 to 51 · score 0.78 · unadjusted residuals, negative residual, residual indicates, linear regression model, affords, smaller · block oscr:b:8BD8GB3QCGQRQ-2 · Report a mismatch
  7. [7] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_LSR_example_code.R, lines 42 to 93 · score 0.78 · unadjusted residuals, negative residual, residual indicates, linear regression model, affords, smaller · block oscr:b:YJHSR49QY4X3M-T · Report a mismatch
  8. [8] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_LSR_example_code.R, lines 95 to 134 · score 0.74 · varies inversely, relative weighting, residuals differs, intercept tends, accuracy, infinity · block oscr:b:Z6CME3KZHPQVV-D · Report a mismatch
  9. [9] § Results and analyses › Generation of adjusted MEP amplitudes ↔ annotated_QR_example_code.R, lines 95 to 133 · score 0.74 · varies inversely, relative weighting, residuals differs, intercept tends, accuracy, infinity · block oscr:b:BH3K0HEBM9315-S · Report a mismatch
  10. [10] § Results and analyses › Compensation for the association ↔ LSR_example_code.R, lines 1 to 40 · score 0.57 · symmetric heavy tailed, LambertW, hh, skewed, Gaussianise, transformation · block oscr:b:1JCMPJ6EBJT5Z-J · Report a mismatch
  11. [11] § Results and analyses › Compensation for the association ↔ annotated_LSR_example_code.R, lines 1 to 40 · score 0.57 · symmetric heavy tailed, LambertW, hh, skewed, Gaussianise, transformation · block oscr:b:HY32KXBGPGY08-K · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 191 lines · 9.7 KB · CC-BY-4.0 · 5 matches

  1. #!/usr/bin/Rscript --slave
  2. # annotated_QR_example_code.R
  3. # 5th May 2026
  4. # Modified: 5th May 2026
  5. # Author: Richard G. Carson ([email hidden])
  6. #################
  7. # Read the data file
  8. data <- read.csv("example_data.csv", header=TRUE, stringsAsFactors=FALSE)
  9. # Ensure data are numeric
  10. data["mep_amplitude"] <- as.numeric(unlist(data["mep_amplitude"]))
  11. data["rms_emg"] <- as.numeric(unlist(data["rms_emg"]))
  12. ###################################
  13. # Whereas least-squares regression (LSR) estimates the conditional mean as a linear
  14. # combination of the predictors, quantile regression (QR) estimates a conditional quantile
  15. # function (such as the 0.5 quantile, i.e., the median) as a linear combination of the
  16. # predictors.
  17. # Unlike least squares regression, QR does not entail an assumption that the outcome
  18. # variable has constant variance or that samples conform to a particular parametric
  19. # distribution. It is also robust to the presence of outliers. It was implemented here
  20. # by means of the rq() function from the quantreg package (Koenker, 2022).
  21. # The “tau” parameter was specified as 0.5, indicating that the conditional quantile
  22. # for the median was to be used.
  23. ###################################
  24. library(quantreg)
  25. # Estimate the quantile regression model for the median (tau = 0.5)
  26. qr_model <- rq(mep_amplitude ~ rms_emg, data = data, tau = 0.5)
  27. # Generate residuals
  28. data$qr_residuals <- qr_model$residuals
  29. ###################################
  30. # A positive value of a residual indicates that an estimate of MEP amplitude is larger
  31. # than that which would be predicted by r.m.s. EMG alone – to an extent corresponding
  32. # to its magnitude. A negative residual value indicates an estimate of MEP amplitude
  33. # that is smaller than would be predicted for the r.m.s. EMG recorded in the period
  34. # preceding the stimulation.
  35. # The use of the unadjusted residuals as the basis for further analysis is however
  36. # limited by the fact that for a given sample the sum of the residuals necessarily tends
  37. # to zero. It is therefore desirable that the residuals are expressed relative
  38. # to an appropriate reference value.
  39. # The parameters of the linear regression model used to generate each set of residuals
  40. # affords a means of addressing this requirement.
  41. ###################################
  42. ###################################
  43. # Extract key information from the fitted model
  44. # y = mx + c
  45. # y - c = mx
  46. # (y-c)/m = x
  47. # m = lm.mod_Ch5$coeff[["rms_emg"]]
  48. # c = lm.mod_Ch5$coeff[["(Intercept)"]]
  49. qr.mod_slope <- qr_model$coeff[["rms_emg"]]
  50. qr.mod_intercept <- qr_model$coeff[["(Intercept)"]]
  51. ###################################
  52. ###################################
  53. # In an idealised scenario in which a linear relationship between r.m.s. EMG and MEP
  54. # amplitude accounts for 100% of the variance present in the data, the appropriate
  55. # reference is obtained as the value of the intercept (i.e., with the ordinate (y) axis).
  56. # This corresponds to the predicted value of the MEP amplitude when the r.m.s. EMG is
  57. # equal to zero. In this idealised case, the adjusted MEP amplitudes for the sample are
  58. # simply obtained by adding the value of the intercept to each of the residuals.
  59. # If there is no relationship between r.m.s. EMG and MEP amplitude, the best estimate
  60. # for all values of r.m.s. EMG is the central tendency of the original MEP amplitude
  61. # values.
  62. # That is. if the slope of the regression line is equal to zero, the reference value is
  63. # provided by the central tendency of the actual values (which necessarily equates to the
  64. # central tendency of the predicted values and, in this specific case only, to the value
  65. # of the intercept).
  66. # Thus, the extent to which the appropriate reference value differs from the central
  67. # tendency of the actual values is contingent on the slope of the regression line.
  68. # With respect to real data however, a linear model will not typically account for
  69. # all variation inherent to the sample. The use of a linear regression model
  70. # dictates that there is no uncertainty about the estimated slope at the central tendency
  71. # of the “predictor” variable (the r.m.s. EMG in the present instance). Even though
  72. # prediction will also be most precise at the estimate of central tendency, there will
  73. # nonetheless be some uncertainty concerning the true vertical position of the regression
  74. # line at this point.
  75. # The degree of uncertainty increases with separation from the centre of the distribution
  76. # of the predictor variable. That is, unless the value of the intercept coincides with
  77. # the value of the estimate of central tendency, the standard error of the ordinate at
  78. # the intercept will always be larger than the standard error of the ordinate at the
  79. # central tendency of the “predictor” variable.
  80. # Since the standard error of the estimate is a measure of the accuracy of prediction,
  81. # we wish to accord to the intercept (in its contribution to the generation of a
  82. # reference value) a weighting that varies inversely with its standard error.
  83. # Specifically, as the standard error of the estimate at the intercept tends to infinity,
  84. # the contribution of the intercept to the generation of a reference value should tend
  85. # towards zero. As noted above, as the slope of the regression line approaches zero,
  86. # the reference value derived from the intercept will converge upon that of the central
  87. # tendency of the original values. Accordingly, therefore, the relative weighting of the
  88. # intercept should also be such that, with increases in its standard error, the reference
  89. # value converges on the central tendency. In summary, the extent to which the reference
  90. # value used to adjust the residuals differs from the central tendency of the
  91. # predicted/actual values, will depend on the slope of the regression line and the
  92. # uncertainty with which its intercept can be estimated.
  93. ###################################
  94. ###################################
  95. # Determine the value of x (i.e., the r.m.s. EMG) that corresponds to
  96. # the median of the predicted values.
  97. qr_predicted_values <- fitted(qr_model)
  98. qr_predicted_median <- median(qr_predicted_values)
  99. qr_rms_emg_at_median <- (qr_predicted_median - qr_model$coeff[["(Intercept)"]] )/qr_model$coeff[["rms_emg"]]
  100. # Determine the "quasi" standard error of the fit when the y value (MEP amplitude)
  101. # is predicted by means of the qr model when the x value (r.m.s. EMG)
  102. # is that at which the median of the predicted values is obtained.
  103. qr_predict_at_median <- predict(qr_model, newdata=data.frame(rms_emg = qr_rms_emg_at_median), interval = "confidence")
  104. qr_predict_at_median_ci <- qr_predict_at_median[1,"higher"] - qr_predict_at_median[1,"lower"]
  105. # As confidence intervals (i.e., 95%) for prediction are reported by the rq() function
  106. # rather than standard errors, the values were first converted to the equivalent
  107. # standard errors
  108. qr_predict_at_median_SE <- qr_predict_at_median_ci / qnorm(0.975)
  109. # Determine the "quasi" standard error of the fit when the y value (MEP amplitude)
  110. # is predicted by means of the linear model when the x value (r.m.s. EMG)
  111. # is equal to zero, i.e. the intercept.
  112. qr_predict_at_intercept <- predict(qr_model, newdata=data.frame(rms_emg=0.0), interval = "confidence")
  113. qr_predict_at_intercept_ci <- qr_predict_at_intercept[1,"higher"] - qr_predict_at_intercept[1,"lower"]
  114. # As confidence intervals (i.e., 95%) for prediction are reported by the rq() function
  115. # rather than standard errors, the values were first converted to the equivalent
  116. # standard errors
  117. qr_predict_at_intercept_SE <- qr_predict_at_intercept_ci / qnorm(0.975)
  118. # Calculate the sum of the SE for the predicted value of y at the median and at the
  119. # intercept.
  120. qr_predict_at_median_AND_intercept_SE_sum <- qr_predict_at_median_SE + qr_predict_at_intercept_SE
  121. # Express the SE for the predicted value of y at the median and at the intercept as a
  122. # proportion of the sum.
  123. qr_predict_at_median_proportion <- qr_predict_at_median_SE / qr_predict_at_median_AND_intercept_SE_sum
  124. qr_predict_at_intercept_proportion <- qr_predict_at_intercept_SE / qr_predict_at_median_AND_intercept_SE_sum
  125. # Calculate median weighting and weighted values
  126. qr_median_weight <- (qr_predict_at_intercept_SE/qr_predict_at_median_AND_intercept_SE_sum) - (qr_predict_at_median_SE/qr_predict_at_median_AND_intercept_SE_sum)
  127. qr_median_weighted_value <- qr_median_weight * qr_predicted_median
  128. # Calculate intercept weighting and weighted values
  129. qr_intercept_weight <- (1 - (qr_predict_at_intercept_SE/qr_predict_at_median_AND_intercept_SE_sum)) + (qr_predict_at_median_SE/qr_predict_at_median_AND_intercept_SE_sum)
  130. qr_intercept_weighted_value <- qr_intercept_weight * qr.mod_intercept
  131. # Generate final estimate of the reference value
  132. qr_weighted_reference_amplitude <- qr_median_weighted_value + qr_intercept_weighted_value
  133. # Add the final estimate to the residuals generated using the quantile regression
  134. data$qr_adjusted_mep_amplitude <- qr_model$residuals + qr_weighted_reference_amplitude
  135. detach("package:quantreg")
  136. ###################################
  137. ###################################
  138. # Write the data to an .xlsx format file
  139. ###################################
  140. # load the openxlsx package
  141. library(openxlsx)
  142. # In order to permit data to be written to an .xlsx file, create a workbook
  143. wbOut<-createWorkbook()
  144. # Add worksheets to the workbook object
  145. addWorksheet(wbOut, "adjusted")
  146. # Write the summarised data to the workbook object
  147. writeData(wbOut, "adjusted", data, startCol = 1, startRow = 1, xy = NULL, colNames = TRUE, rowNames = FALSE, headerStyle = NULL, keepNA = TRUE)
  148. # Save the summary data workbook - overwriting the original file (if it exists)
  149. saveWorkbook(wbOut, "example_data_qr_adjusted.xlsx", overwrite = TRUE)
  150. detach("package:openxlsx")
  151. ###################################

annotated_QR_example_code.R, under CC-BY-4.0 · at the source

Overview

  1. Trinity College Institute of Neuroscience and School of Psychology Trinity College Dublin Dublin Ireland
Institutions: Trinity College Dublin (Ireland)
Journal: The Journal of physiology, volume 604, issue 14, pages 5731-5757
Dates: received 20 January 2025; accepted 21 May 2026; published online 8 June 2026; in print 15 July 2026
Type: Methods article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1113/jp290979 · PMID 42260716 · PMCID PMC13370687 · OpenAlex W7164020686
Open access: hybrid, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: other (modality), human (organism), methods / tools (subfield)
Methods: Spectral & time-frequency, Statistics, Preprocessing, Evoked potentials, Connectivity, fMRI & imaging, Single-unit activity, calcium imaging, Physiology & signal measures, Smoothing, state filtering, decompositions
Keywords: brain stimulation, compensate, electromyography, modelling, motor evoked potentials, statistics
MeSH: Evoked Potentials, Motor*, Motor Neurons*, Muscle, Skeletal*, Spinal Cord*, Adult, Electromyography, Female, Humans, Male, Transcranial Magnetic Stimulation (* major topic)
Journal subjects: Technique
Topic: Transcranial Magnetic Stimulation Studies (Neurology, Neuroscience), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 80 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 11 matches between paragraphs and lines of code.

Zenodo 20037178

License: CC-BY-4.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: R (4)
Size: 5 files, 4 scripts
Software Heritage: not checked
Found in: “Data availability statement”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
4 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 4 scripts, each with its path and the digest of its content;
  • 11 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1113/jp290979.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 2, 28 September 2026

  • Publisher: n/a → Wiley

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 1 author, 6 keywords, 10 MeSH terms, 67 references.

Cite

This paper

Carson, R. G. (2026). A method of compensating for the excitability of spinal motoneurones when estimating the magnitude of potentials evoked in skeletal muscles. The Journal of physiology, 604(14), 5731-5757. https://doi.org/10.1113/jp290979

BibTeX

@article{carson2026method,
author = {Carson, Richard G.},
title = {{A method of compensating for the excitability of spinal motoneurones when estimating the magnitude of potentials evoked in skeletal muscles}},
journal = {The Journal of physiology},
year = {2026},
month = jun,
volume = {604},
number = {14},
pages = {5731--5757},
publisher = {Wiley},
issn = {0022-3751},
doi = {10.1113/jp290979},
url = {https://doi.org/10.1113/jp290979},
pmid = {42260716},
pmcid = {PMC13370687}
}

RIS

TY - JOUR
AU - Carson, Richard G.
TI - A method of compensating for the excitability of spinal motoneurones when estimating the magnitude of potentials evoked in skeletal muscles
T2 - The Journal of physiology
J2 - J Physiol
PY - 2026
DA - 2026/06/08
VL - 604
IS - 14
SP - 5731
EP - 5757
SN - 0022-3751
PB - Wiley
DO - 10.1113/jp290979
UR - https://doi.org/10.1113/jp290979
LA - en
ER -

CSL-JSON

{
"id": "10.1113/jp290979",
"type": "article-journal",
"title": "A method of compensating for the excitability of spinal motoneurones when estimating the magnitude of potentials evoked in skeletal muscles",
"container-title": "The Journal of physiology",
"author": [
{
"family": "Carson",
"given": "Richard G."
}
],
"container-title-short": "J Physiol",
"volume": "604",
"issue": "14",
"page": "5731-5757",
"DOI": "10.1113/jp290979",
"PMID": "42260716",
"PMCID": "PMC13370687",
"ISSN": "0022-3751",
"publisher": "Wiley",
"URL": "https://doi.org/10.1113/jp290979",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
8
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1113/ep093276 [code]
Correlated amplitudes of potentials evoked in homologous muscles by magnetic stimulation reveal positive covariation of corticospinal output.
Journal: Experimental physiology
In common: other, 30 references, author Richard G. Carson
[2] doi:10.1016/j.brs.2025.09.008 [code]
Hierarchical Bayesian estimation of motor-evoked potential recruitment curves yields accurate and robust estimates.
Journal: Brain stimulation
In common: other, 4 references
[3] doi:10.1007/s10548-025-01113-2 [code]
Stimulation Parameters Recruit Distinct Cortico-Cortical Pathways: Insights from Microstate Analysis on TMS-Evoked Potentials.
Journal: Brain topography
In common: other, 5 references
[4] doi:10.7554/elife.92088 [code]
Kilohertz transcranial magnetic perturbation (kTMP) as a new non-invasive method to modulate cortical excitability.
Journal: eLife
In common: other, 4 references
[5] doi:10.1016/j.ibneur.2025.03.005
Height-dependent variation in corticospinal excitability modulation after active but not sham intermittent theta burst stimulation.
Journal: IBRO neuroscience reports
In common: other, 5 references
[6] doi:10.1088/1741-2552/ae4382 [code]
Optimization, implementation, and performance of TMS coils with maximum focality and various stimulation depths.
Journal: Journal of neural engineering
In common: other, 4 references
[7] doi:10.1007/s00429-024-02854-9
Quantitative metrics commonly derived from diffusion tractography covary with streamline length: a characterization and method of adjustment.
Journal: Brain structure & function
In common: methods / tools, author Richard G. Carson
[8] doi:10.1177/09226028251410014 [code]
A Brief Mindfulness Intervention for Pain Management in Fibromyalgia: A Single-arm Open-Label Study.
Journal: Restorative neurology and neuroscience
In common: other, 4 references
[9] doi:10.1038/s41598-022-14221-x [code]
Evidence for non-selective response inhibition in uncertain contexts revealed by combined meta-analysis and Bayesian analysis of fMRI data.
Journal: Scientific reports
In common: 4 references
[10] doi:10.1186/s12938-025-01393-6
Design, construction, and deployment of a multi-locus transcranial magnetic stimulation system for clinical use.
Journal: Biomedical engineering online
In common: other, 4 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1113/jp290979.svg)](https://openscicode.org/badge/doi/10.1113/jp290979)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1113/jp290979.svg
   :target: https://openscicode.org/badge/doi/10.1113/jp290979
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1113/jp290979"><img src="https://openscicode.org/badge/doi/10.1113/jp290979.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.