Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

Should AI-Generated Statistical Code Be Cited or Disclosed in Research?

Using AI to generate statistical code raises questions about citation, disclosure, and research transparency. Learn when AI assistance should be acknowledged, why citing statistical software differs from disclosing AI use, and what information researchers should document before submitting their work.

442
Should You Disclose AI-Generated Statistical Code? Guide 442 of 1196
01 · The Question

If AI Writes Your Statistical Code, Should You Cite the Tool or Disclose Its Contribution?

You conduct a research study using R. You understand the statistical methods but ask ChatGPT to generate the commands for data cleaning, multiple regression, and model diagnostics.

You inspect the code, correct several errors, and verify the results. The final script produces the statistical findings reported in your manuscript.

When preparing the Methods section, you wonder whether you should cite ChatGPT, acknowledge that AI helped write the code, or simply report that the analyses were conducted using R.

After all, researchers routinely use statistical software without citing every function they execute. Does AI-generated code require different treatment?

The answer depends partly on the role AI played and the policies governing the research. More importantly, citation, disclosure, and reproducibility address different aspects of scholarly transparency.

02 · The Short Answer

Material AI Assistance May Require Disclosure, but Citation and Disclosure Are Not Interchangeable

In Brief

Researchers should disclose AI-generated statistical code when required by their institution, publisher, journal, or research agreement. Material AI assistance in developing analytical scripts may warrant transparent description even where the applicable policy does not prescribe a specific format. However, citing an AI tool is not necessarily equivalent to disclosing its contribution, and neither action substitutes for documenting the statistical methods, software environment, and verification procedures.

There is no universal citation or disclosure rule applicable to every discipline and publication. Researchers should consult the current policies governing their work and distinguish routine programming assistance from substantive contributions to analytical decisions.

03 · What You Need to Know

How Citation, Disclosure, and Computational Documentation Differ

What Is the Difference Between Citing AI and Disclosing AI Use?

Citation identifies a source or resource to which scholarly attribution is given. Disclosure communicates how a tool contributed to the research process.

These activities may overlap, but they answer different questions.

Citation Identifies a source, software resource, or other material according to an applicable referencing convention.
Disclosure Explains the nature and extent of AI assistance in preparing or conducting the research.

A researcher might cite R and a statistical package while separately disclosing that generative AI helped draft portions of the analysis script.

Conversely, adding ChatGPT to the reference list without explaining its analytical contribution may not satisfy a journal's disclosure requirements.

The appropriate practice depends on the publication's instructions and the actual role of the technology.

Why AI-Generated Code Is Different From Ordinary Software Use

Using an established statistical package involves selecting and executing computational procedures. Generative AI may additionally propose which commands, transformations, and analytical options should be used.

For example, a researcher might use R's documented lm function to fit a prespecified regression model. That is different from asking AI to choose the predictors, determine how missing values should be handled, and generate the complete analytical workflow.

The distinction concerns the contribution to analytical decision-making, not merely whether AI produced programming text.

A system that helps recall syntax may contribute less substantively than one that proposes the model specification or changes the analytical sample.

However, even routine assistance may fall within an institution's or publisher's disclosure policy.

What Do Major Publication-Ethics Organizations Say?

The International Committee of Medical Journal Editors (ICMJE) addresses the use of AI-assisted technologies in scientific publication. Its recommendations require authors to disclose AI assistance according to the relevant instructions and remain responsible for the accuracy and integrity of the work.

The recommendations distinguish assistance with writing from AI use in activities such as data collection, analysis, and figure generation, which may need to be described in the Methods section.

The Committee on Publication Ethics (COPE) has also emphasized that AI tools cannot fulfill authorship responsibilities and that human authors remain accountable for submitted content.

These positions provide important guidance, but they should not be interpreted as identical disclosure rules for every publisher.

Researchers must consult the current policies of their target journal, institution, and relevant funding or ethics bodies.

Does AI-Generated Statistical Code Always Need a Reference-List Citation?

No universal rule requires every use of AI-generated statistical code to appear as a bibliographic reference.

Some publishers provide citation formats for AI-generated content or require acknowledgment of particular uses. Others request a disclosure statement without treating AI output as a conventional scholarly source.

Researchers should not assume that citing a chatbot is sufficient to document the analysis.

In particular, an AI-generated script is not an authoritative methodological reference merely because the code was produced by a named system.

The statistical procedure should be supported by appropriate methodological literature and software documentation where relevant.

Should Researchers Cite the Statistical Software Separately?

Software citation serves a different purpose from AI disclosure.

It can identify the software and computational tools used to produce the analysis, acknowledge their developers, and help readers locate the relevant implementation.

For example, researchers may cite R or a specialized R package according to its recommended citation information.

The R function citation provides citation information for R itself and, where available, installed packages.

citation
citation("stats")

Researchers should verify the recommended citation and version details for the specific software used.

Smith, Katz, and Niemeyer (2016), in Software Citation Principles, explain why research software should be treated as a legitimate scholarly product with appropriate identification and attribution.

Citing the software does not disclose that AI helped generate the code used to operate it.

Where Should AI Assistance Be Disclosed?

The appropriate location depends on the journal's requirements and the nature of the AI contribution.

When AI materially contributes to statistical analysis or code development, the Methods section may be an appropriate place to describe that role.

Some journals instead require a dedicated declaration or statement concerning generative AI use.

Where applicable, a disclosure may identify the tool, its role in drafting analytical scripts, and the verification performed by the research team.

The statement should accurately describe what occurred rather than imply that the AI conducted analyses independently when researchers actually executed and validated the code.

How Much Detail Should the Disclosure Include?

A useful disclosure communicates enough information for readers to understand the material contribution without becoming a transcript of every interaction.

Depending on the applicable requirements, relevant information may include:

  • The AI system used and its identifiable version, where available.
  • The stages of statistical programming in which AI assistance occurred.
  • Whether AI generated code, explained existing code, or suggested analytical decisions.
  • Whether the code was reviewed, corrected, and independently verified.
  • The human responsibility for the final statistical analysis.

Not every publisher requires all these details. Researchers should avoid presenting an illustrative disclosure framework as a universally mandated reporting standard.

Does Disclosure Establish That the Code Is Correct?

No. Disclosure is a transparency practice, not a statistical validation procedure.

A researcher can openly acknowledge AI assistance while reporting an inappropriate statistical model.

For example, a disclosed AI-generated script may still use an independent-samples test for paired observations or silently remove participants during data cleaning.

Such errors require computational and methodological verification.

Researchers should therefore treat verification of AI-generated statistical code as a separate responsibility.

Should Researchers Preserve AI Prompts and Outputs?

Retaining prompts and outputs that materially influenced the analysis can support auditability and help reconstruct analytical decisions.

For example, a prompt may reveal that AI suggested changing a covariance estimator or excluding observations with missing values.

However, retaining every conversational exchange is not universally required and may be unnecessary for routine assistance.

Documentation should be proportionate to the analytical contribution and consistent with institutional policies.

Researchers should also avoid retaining confidential participant information in AI conversation records when doing so would violate applicable data-governance requirements.

What If AI Suggests a Statistical Method Rather Than Merely Writing Code?

This represents a more substantive analytical contribution.

Suppose a researcher asks AI which statistical test to use, and the system recommends a mixed-effects model. The researcher then adopts that recommendation.

The choice of statistical method can affect the estimated quantities, assumptions, and conclusions.

Researchers should independently justify the method using the study design and appropriate methodological references.

Where required, the disclosure should accurately reflect AI's contribution to that decision.

AI-generated methodological suggestions should not be cited as authoritative evidence that a procedure is appropriate.

Can Publishing the Code Replace an AI Disclosure?

Not necessarily. Sharing analytical code can improve transparency and computational reproducibility, but readers may not know which portions were generated or modified using AI.

Similarly, a disclosure does not provide the executable script or information needed to reproduce the results.

Code availability, software citation, AI disclosure, and methodological reporting therefore serve complementary purposes.

The National Academies' report Reproducibility and Replicability in Science emphasizes the importance of computational transparency and the information required to reconstruct analyses.

Researchers should document the final verified implementation rather than relying exclusively on the AI conversation as the analysis record.

Can AI Be Credited as an Author for Writing Statistical Code?

Under ICMJE and COPE authorship principles, AI tools cannot fulfill the responsibilities required of scholarly authors.

Generating a substantial amount of code does not independently confer authorship status on an AI system.

Human researchers must remain accountable for the analytical decisions, reported findings, and integrity of the work.

The contribution of human programmers, statisticians, and collaborators should be evaluated under the applicable authorship and contributorship criteria.

AI disclosure should not obscure the contributions or responsibilities of human collaborators.

04 · A Practical Example

How to Report AI Assistance in a Statistical Analysis Without Overstating Its Role

Hypothetical Example

Using ChatGPT to Draft R Code for Educational Research

A researcher conducts a study involving 350 university students to examine associations between AI tutoring usage, study hours, and examination performance.

The researcher independently specifies the multiple regression model and asks ChatGPT to generate R code for data preparation, estimation, and diagnostics.

The researcher reviews the script, corrects a factor-coding error, checks missing-data exclusions, and reproduces the main estimates using a separately verified implementation.

The target journal requires disclosure of material generative AI assistance.

An Inadequate Disclosure

Incomplete Statement

"ChatGPT was used in this research."

This statement identifies a tool but does not explain its role.

Readers cannot determine whether AI helped edit the manuscript, generated statistical code, selected the analytical model, or interpreted the findings.

A More Informative Disclosure

Illustrative Disclosure

"ChatGPT (OpenAI) was used to assist in drafting portions of the R code for data preparation, multiple regression, and model diagnostics. The statistical model was specified by the researcher. All generated code was reviewed and revised where necessary, and the main analytical results were independently verified. The researcher retained responsibility for the statistical procedures, interpretations, and conclusions."

This statement distinguishes AI's programming contribution from the researcher's methodological decisions and verification.

The exact wording, location, and additional identifying details should follow the target journal's current requirements.

What Should the Methods Section Still Report?

Even with an AI disclosure, the manuscript should describe the statistical methods sufficiently for readers to understand and evaluate the analysis.

For example, the Methods section may identify the regression model, outcome, predictors, analytical sample, missing-data approach, estimation procedure, and relevant software information.

The AI disclosure does not replace these details.

A Practical Reporting Sequence

1. Identify the actual AI contribution. Determine whether AI drafted syntax, suggested methods, transformed data, or assisted with interpretation.
2. Verify the analysis. Confirm that the final code implements the intended statistical procedures and produces defensible results.
3. Check the publication policy. Identify the required disclosure location, wording, and information.
4. Report the computational methods. Document the statistical procedures, software, relevant dependencies, and analytical decisions.
5. Preserve appropriate records. Retain the verified code and documentation of material AI contributions under applicable requirements.

The purpose of disclosure is to make the research process understandable, not to transfer responsibility for the analysis to the technology.

05 · What Researchers Often Get Wrong

Common Misconceptions About Citing and Disclosing AI-Generated Statistical Code

Misconception

Must Every AI-Generated Code Snippet Be Cited in the Reference List?

Not under a universal scholarly rule. Citation and disclosure requirements depend on the relevant publication and institutional policies, as well as the nature of the contribution.

Misconception

Does Citing ChatGPT Automatically Satisfy AI Disclosure Requirements?

No. A citation may identify the tool without explaining how it contributed to the statistical analysis. Disclosure requirements may call for a separate description.

Misconception

Does Disclosing AI Assistance Make Incorrect Statistical Code Acceptable?

No. Disclosure does not replace verification. Researchers remain responsible for the accuracy and methodological appropriateness of their analyses.

Misconception

Is Citing R or Python the Same as Disclosing AI-Generated Code?

No. Software citation identifies computational resources, while AI disclosure describes the contribution of generative AI to the research process.

Misconception

Does Publishing the Final Script Eliminate the Need for Disclosure?

Not necessarily. Code availability supports transparency but may not satisfy a journal's requirements concerning AI assistance.

Misconception

Can AI Be Listed as a Coauthor Because It Wrote the Analysis Script?

Not under ICMJE and COPE authorship principles. AI systems cannot fulfill the accountability requirements of scholarly authorship.

06 · What This Means for You

How to Decide What to Cite, Disclose, and Document

Researchers should distinguish the attribution of computational tools from transparency about AI assistance and the documentation needed for reproducibility.

Each responsibility should be addressed according to its purpose and applicable requirements.

A Practical Reporting Framework

If AI only helped recall programming syntax
Check whether the applicable policy requires disclosure of routine programming assistance.
If AI drafted substantial portions of the analysis code
Describe its contribution where required and document how the generated implementation was verified.
If AI suggested statistical methods or analytical decisions
Independently justify those decisions and accurately disclose the role of AI under applicable policies.
If specialized statistical software was used
Follow the relevant software citation recommendations and document the computational environment.
If the journal requires a dedicated AI declaration
Provide the required statement in the prescribed location rather than relying solely on a reference-list citation.

Use AI to Draft a Disclosure, but Verify Its Accuracy

A useful prompt is:

"Draft a concise disclosure describing how generative AI assisted with statistical code development in this study. Distinguish code drafting from statistical method selection, data analysis, verification, and interpretation. Use only the activities I confirm actually occurred. Do not claim that the code was independently validated unless I provide evidence of that verification. Leave any policy-specific requirements for confirmation against the target journal's instructions."

This may help prepare a transparent statement, but researchers must ensure that the disclosure accurately reflects the work performed.

Maintain an Appropriate Computational Record

Retain the final verified script, software versions, relevant dependencies, and records of consequential analytical decisions.

Where AI materially influenced the analysis, preserve appropriate information about that contribution under applicable requirements.

Researchers should also understand who remains responsible when AI-generated research code contains errors.

Transparency strengthens the credibility of the research process, but it does not establish statistical validity by itself.

07 · A Quick Checklist

Before Submitting Research That Used AI-Generated Statistical Code

Verify these points:
Identify which parts of the statistical workflow involved AI assistance.
Distinguish programming assistance from substantive analytical decisions.
Check the target journal's current AI disclosure requirements.
Determine whether a citation, disclosure statement, or both are required.
Cite statistical software and packages where appropriate.
Ensure the Methods section adequately describes the statistical analysis.
Verify that all reported results were checked against the final code and output.
Preserve appropriate computational and AI-assistance records.
Confirm that the disclosure accurately describes what occurred.
08 · Frequently Asked Questions

Frequently Asked Questions About AI Statistical Code Disclosure

Do I need to cite ChatGPT if it wrote my statistical code?

Not under a universal rule. Requirements vary by journal, publisher, and institution. Some require disclosure of AI assistance rather than a conventional reference-list citation.

Should AI-generated R or Python code be disclosed in a research paper?

Material assistance may require disclosure under applicable policies. Researchers should describe the contribution accurately and distinguish it from the independently justified statistical methods.

Where should I disclose AI assistance with statistical programming?

Depending on the journal, the Methods section or a dedicated AI-use declaration may be appropriate. Follow the current instructions of the target publication.

Is citing statistical software enough?

No, when separate AI disclosure is required. Software citation and AI disclosure address different aspects of the research process.

Do I need to publish every prompt used to generate code?

Not necessarily. Requirements vary. Retaining prompts that materially influenced analytical decisions may support auditability, subject to confidentiality and institutional rules.

Can AI-generated code be included in supplementary materials?

Potentially, subject to journal requirements, intellectual-property considerations, confidentiality, and applicable software licensing. The code should be verified before publication.

Does disclosing AI-generated code protect researchers from responsibility for errors?

No. Authors remain accountable for the statistical analysis and conclusions they report, regardless of whether AI assistance was disclosed.

09 · The Bottom Line

Disclose the Contribution, Cite the Relevant Tools, and Verify the Analysis

The Bottom Line

AI-generated statistical code may require disclosure under applicable publication and institutional policies, but citation, disclosure, and computational documentation serve different purposes. Researchers should accurately describe material AI contributions, cite relevant software where appropriate, and independently verify the statistical procedures and results. Transparency does not transfer responsibility for the analysis to AI.

The objective is not to acknowledge every programming suggestion indiscriminately. It is to provide an accurate account of how the analysis was conducted, what technology contributed, and how the resulting scientific claims were established.

10 · Sources and Further Reading

Authoritative References on AI Disclosure and Research Software Citation

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes