Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2023 Nov 30;18(11):e0295066.
doi: 10.1371/journal.pone.0295066. eCollection 2023.

Notes on correctness of p-values when analyzing experiments using SAS and R

Affiliations

Notes on correctness of p-values when analyzing experiments using SAS and R

Razaw Al-Sarraj et al. PLoS One. .

Erratum in

Abstract

It is commonly believed that if a two-way analysis of variance (ANOVA) is carried out in R, then reported p-values are correct. This article shows that this is not always the case. Results can vary from non-significant to highly significant, depending on the choice of options. The user must know exactly which options result in correct p-values, and which options do not. Furthermore, it is commonly supposed that analyses in SAS and R of simple balanced experiments using mixed-effects models result in correct p-values. However, the simulation study of the current article indicates that frequency of Type I error deviates from the nominal value. The objective of this article is to compare SAS and R with respect to correctness of results when analyzing small experiments. It is concluded that modern functions and procedures for analysis of mixed-effects models are sometimes not as reliable as traditional ANOVA based on simple computations of sums of squares.

PubMed Disclaimer

Conflict of interest statement

The authors have declared that no competing interests exist.

Figures

Fig 1
Fig 1. Quantiles of observed p-values, testing H0 : μ1. = μ2. = μ3. versus quantiles of the uniform distribution U(0,1).
Based on 10 000 simulated datasets using model (12) with layout {a = 3, b = 2, c = 12} and parameter values σe2=1, σb2=1 and σAB2=0.1. (A) Exact F-test. (B) R using the lmer and anova functions. (C) SAS using the mixed procedure with default settings. (D) SAS using the mixed procedure with the nobound option.

References

    1. R Core Team. R: A language and environment for statistical computing. R foundation for statistical computing, Vienna, Austria. 2017. Available from https://www.r-project.org.
    1. SAS Institute SAS/STAT 14.1 User’s Guide. Cary, NC: SAS Institute; 2015.
    1. Searle SR. Linear Models. New York: Wiley; 1971.
    1. Searle SR. Linear models for unbalanced data. New York: Wiley; 1987.
    1. Herr DG. On the history of ANOVA in unbalanced, factorial designs: The first 30 years. Am Stat. 1986;40:265–270. doi: 10.1080/00031305.1986.10475409 - DOI