{"id":11695,"date":"2019-12-26T10:36:48","date_gmt":"2019-12-26T08:36:48","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?post_type=dt_lessons&#038;p=11695"},"modified":"2019-12-26T10:36:48","modified_gmt":"2019-12-26T08:36:48","slug":"how-to-do-a-one-sample-t-test-in-r","status":"publish","type":"dt_lessons","link":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/","title":{"rendered":"How To Do a One-Sample T-test in R"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This article describes how to do a <strong>one-sample t-test in R<\/strong> (or in <em>Rstudio<\/em>). You will learn how to:<\/p>\n<ul>\n<li><em>Perform a one-sample t-test in R<\/em> using the following functions :\n<ul>\n<li><code>t_test()<\/code> [rstatix package]: the result is a data frame for easy plotting using the <code>ggpubr<\/code> package.<\/li>\n<li><code>t.test()<\/code> [stats package]: R base function.<\/li>\n<\/ul>\n<\/li>\n<li><em>Interpret and report the one-sample t-test<\/em><\/li>\n<li><em>Add p-values and significance levels to a plot<\/em><\/li>\n<li><em>Calculate and report the one-sample t-test effect size<\/em> using <em>Cohen\u2019s d<\/em>. The <code>d<\/code> statistic redefines the difference in means as the number of standard deviations that separates those means. T-test conventional effect sizes, proposed by Cohen, are: 0.2 (small effect), 0.5 (moderate effect) and 0.8 (large effect) <span class=\"citation\">(Cohen 1998)<\/span>.<\/li>\n<\/ul>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#demo-data\">Demo data<\/a><\/li>\n<li><a href=\"#summary-statistics\">Summary statistics<\/a><\/li>\n<li><a href=\"#calculation\">Calculation<\/a>\n<ul>\n<li><a href=\"#using-the-r-base-function\">Using the R base function<\/a><\/li>\n<li><a href=\"#using-the-rstatix-package\">Using the rstatix package<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#interpretation\">Interpretation<\/a><\/li>\n<li><a href=\"#effect-size\">Effect size<\/a><\/li>\n<li><a href=\"#reporting\">Reporting<\/a>\n<ul>\n<li><a href=\"#box-plot\">Box Plot<\/a><\/li>\n<li><a href=\"#density-plot\">Density plot<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#summary\">Summary<\/a><\/li>\n<li><a href=\"#references\">References<\/a><\/li>\n<\/ul>\n<\/div>\n<div class='dt-sc-hr-invisible-medium  '><\/div>\n<div class='dt-sc-ico-content type1'><div class='custom-icon' ><a href='https:\/\/www.datanovia.com\/en\/product\/practical-statistics-in-r-for-comparing-groups-numerical-variables\/' target='_blank'><span class='fa fa-book'><\/span><\/a><\/div><h4><a href='https:\/\/www.datanovia.com\/en\/product\/practical-statistics-in-r-for-comparing-groups-numerical-variables\/' target='_blank'> Related Book <\/a><\/h4>Practical Statistics in R II - Comparing Groups: Numerical Variables<\/div>\n<div class='dt-sc-hr-invisible-medium  '><\/div>\n<div id=\"prerequisites\" class=\"section level2\">\n<h2>Prerequisites<\/h2>\n<p>Make sure you have installed the following R packages:<\/p>\n<ul>\n<li><code>tidyverse<\/code> for data manipulation and visualization<\/li>\n<li><code>ggpubr<\/code> for creating easily publication ready plots<\/li>\n<li><code>rstatix<\/code> provides pipe-friendly R functions for easy statistical analyses.<\/li>\n<li><code>datarium<\/code>: contains required data sets for this chapter.<\/li>\n<\/ul>\n<p>Start by loading the following required packages:<\/p>\n<pre class=\"r\"><code>library(tidyverse)\r\nlibrary(ggpubr)\r\nlibrary(rstatix)<\/code><\/pre>\n<\/div>\n<div id=\"demo-data\" class=\"section level2\">\n<h2>Demo data<\/h2>\n<p>Demo dataset: <code>mice<\/code> [in datarium package]. Contains the weight of 10 mice:<\/p>\n<pre class=\"r\"><code># Load and inspect the data\r\ndata(mice, package = \"datarium\")\r\nhead(mice, 3)<\/code><\/pre>\n<pre><code>## # A tibble: 3 x 2\r\n##   name  weight\r\n##   &lt;chr&gt;  &lt;dbl&gt;\r\n## 1 M_1     18.9\r\n## 2 M_2     19.5\r\n## 3 M_3     23.1<\/code><\/pre>\n<div class=\"block\">\n<p>We want to know, whether the average weight of the mice differs from 25g (two-tailed test)?<\/p>\n<\/div>\n<\/div>\n<div id=\"summary-statistics\" class=\"section level2\">\n<h2>Summary statistics<\/h2>\n<p>Compute some summary statistics: count (number of subjects), mean and sd (standard deviation)<\/p>\n<pre class=\"r\"><code>mice %&gt;% get_summary_stats(weight, type = \"mean_sd\")<\/code><\/pre>\n<pre><code>## # A tibble: 1 x 4\r\n##   variable     n  mean    sd\r\n##   &lt;chr&gt;    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\r\n## 1 weight      10  20.1  1.90<\/code><\/pre>\n<\/div>\n<div id=\"calculation\" class=\"section level2\">\n<h2>Calculation<\/h2>\n<div id=\"using-the-r-base-function\" class=\"section level3\">\n<h3>Using the R base function<\/h3>\n<pre class=\"r\"><code># One-sample t-test\r\nres &lt;- t.test(mice$weight, mu = 25)\r\n\r\n# Printing the results\r\nres <\/code><\/pre>\n<pre><code>## \r\n##  One Sample t-test\r\n## \r\n## data:  mice$weight\r\n## t = -8, df = 9, p-value = 2e-05\r\n## alternative hypothesis: true mean is not equal to 25\r\n## 95 percent confidence interval:\r\n##  18.8 21.5\r\n## sample estimates:\r\n## mean of x \r\n##      20.1<\/code><\/pre>\n<p>In the result above :<\/p>\n<ul>\n<li><code>t<\/code> is the t-test statistic value (t = -8.105),<\/li>\n<li><code>df<\/code> is the degrees of freedom (df= 9),<\/li>\n<li><code>p-value<\/code> is the significance level of the t-test (p-value = 1.99510^{-5}).<\/li>\n<li><code>conf.int<\/code> is the confidence interval of the mean at 95% (conf.int = [18.7835, 21.4965]);<\/li>\n<li><code>sample estimates<\/code> is the mean value of the sample (mean = 20.14).<\/li>\n<\/ul>\n<\/div>\n<div id=\"using-the-rstatix-package\" class=\"section level3\">\n<h3>Using the rstatix package<\/h3>\n<p>We\u2019ll use the pipe-friendly <code>t_test()<\/code> function [rstatix package], a wrapper around the R base function <code>t.test()<\/code>. The results can be easily added to a plot using the <code>ggpubr<\/code> R package.<\/p>\n<pre class=\"r\"><code>stat.test &lt;- mice %&gt;% t_test(weight ~ 1, mu = 25)\r\nstat.test<\/code><\/pre>\n<pre><code>## # A tibble: 1 x 7\r\n##   .y.    group1 group2         n statistic    df       p\r\n## * &lt;chr&gt;  &lt;chr&gt;  &lt;chr&gt;      &lt;int&gt;     &lt;dbl&gt; &lt;dbl&gt;   &lt;dbl&gt;\r\n## 1 weight 1      null model    10     -8.10     9 0.00002<\/code><\/pre>\n<p>The results above show the following components:<\/p>\n<ul>\n<li><code>.y.<\/code>: the outcome variable used in the test.<\/li>\n<li><code>group1,group2<\/code>: generally, the compared groups in the pairwise tests. Here, we have null model (one-sample test).<\/li>\n<li><code>statistic<\/code>: test statistic (t-value) used to compute the p-value.<\/li>\n<li><code>df<\/code>: degrees of freedom.<\/li>\n<li><code>p<\/code>: p-value.<\/li>\n<\/ul>\n<div class=\"warning\">\n<p>You can obtain a detailed result by specifying the option <code>detailed = TRUE<\/code> in the function <code>t_test()<\/code>.<\/p>\n<\/div>\n<pre class=\"r\"><code>mice %&gt;% t_test(weight ~ 1, mu = 25, detailed = TRUE)<\/code><\/pre>\n<pre><code>## # A tibble: 1 x 12\r\n##   estimate .y.    group1 group2         n statistic       p    df conf.low conf.high method alternative\r\n## *    &lt;dbl&gt; &lt;chr&gt;  &lt;chr&gt;  &lt;chr&gt;      &lt;int&gt;     &lt;dbl&gt;   &lt;dbl&gt; &lt;dbl&gt;    &lt;dbl&gt;     &lt;dbl&gt; &lt;chr&gt;  &lt;chr&gt;      \r\n## 1     20.1 weight 1      null model    10     -8.10 0.00002     9     18.8      21.5 T-test two.sided<\/code><\/pre>\n<\/div>\n<\/div>\n<div id=\"interpretation\" class=\"section level2\">\n<h2>Interpretation<\/h2>\n<p>The p-value of the test is 210^{-5}, which is less than the significance level alpha = 0.05. We can conclude that the mean weight of the mice is significantly different from 25g with a <strong>p-value<\/strong> = 210^{-5}.<\/p>\n<\/div>\n<div id=\"effect-size\" class=\"section level2\">\n<h2>Effect size<\/h2>\n<p>To calculate an effect size, called <code>Cohen's d<\/code>, for the one-sample t-test you need to divide the mean difference by the standard deviation of the difference, as shown below. Note that, here: <code>sd(x-mu) = sd(x)<\/code>.<\/p>\n<p><strong>Cohen\u2019s d formula<\/strong>:<\/p>\n<p><span class=\"math display\">\\[<br \/>\nd = \\frac{m-\\mu}{s}<br \/>\n\\]<\/span><\/p>\n<ul>\n<li><span class=\"math inline\">\\(m\\)<\/span> is the sample mean<\/li>\n<li><span class=\"math inline\">\\(s\\)<\/span> is the sample standard deviation with <span class=\"math inline\">\\(n-1\\)<\/span> degrees of freedom<\/li>\n<li><span class=\"math inline\">\\(\\mu\\)<\/span> is the theoretical mean against which the mean of our sample is compared (default value is mu = 0).<\/li>\n<\/ul>\n<p><strong>Calculation<\/strong>:<\/p>\n<pre class=\"r\"><code>mice %&gt;% cohens_d(weight ~ 1, mu = 25)<\/code><\/pre>\n<pre><code>## # A tibble: 1 x 6\r\n##   .y.    group1 group2     effsize     n magnitude\r\n## * &lt;chr&gt;  &lt;chr&gt;  &lt;chr&gt;        &lt;dbl&gt; &lt;int&gt; &lt;ord&gt;    \r\n## 1 weight 1      null model    10.6    10 large<\/code><\/pre>\n<div class=\"success\">\n<p>Recall that, t-test conventional effect sizes, proposed by Cohen J. (1998), are: 0.2 (small effect), 0.5 (moderate effect) and 0.8 (large effect) (Cohen 1998). As the effect size, d, is 2.56 you can conclude that there is a large effect.<\/p>\n<\/div>\n<\/div>\n<div id=\"reporting\" class=\"section level2\">\n<h2>Reporting<\/h2>\n<p>We could report the result as follow:<\/p>\n<p>A one-sample t-test was computed to determine whether the recruited mice average weight was different to the population normal mean weight (25g).<\/p>\n<p>The measured mice mean weight (20.14 +\/- 1.94) was statistically significantly lower than the population normal mean weight 25 (<code>t(9) = -8.1, p &lt; 0.0001, d = 2.56<\/code>); where t(9) is shorthand notation for a t-statistic that has 9 degrees of freedom.<\/p>\n<p>The results can be visualized using either a box plot or a density plot.<\/p>\n<div id=\"box-plot\" class=\"section level3\">\n<h3>Box Plot<\/h3>\n<p>Create a boxplot to visualize the distribution of mice weights. Add also jittered points to show individual observations. The big dot represents the mean point.<\/p>\n<pre class=\"r\"><code># Create the box-plot\r\nbxp &lt;- ggboxplot(\r\n  mice$weight, width = 0.5, add = c(\"mean\", \"jitter\"), \r\n  ylab = \"Weight (g)\", xlab = FALSE\r\n  )\r\n# Add significance levels\r\nbxp + labs(subtitle = get_test_label(stat.test, detailed = TRUE))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-statistics-2-comparing-groups-means\/figures\/085-how-to-do-one-sample-t-test-in-r-one-sample-box-plot-with-p-value-1.png\" width=\"336\" \/><\/p>\n<\/div>\n<div id=\"density-plot\" class=\"section level3\">\n<h3>Density plot<\/h3>\n<p>Create a density plot with p-value:<\/p>\n<ul>\n<li>Red line corresponds to the observed mean<\/li>\n<li>Blue line corresponds to the theoretical mean<\/li>\n<\/ul>\n<pre class=\"r\"><code>ggdensity(mice, x = \"weight\", rug = TRUE, fill = \"lightgray\") +\r\n  scale_x_continuous(limits = c(15, 27)) +\r\n  stat_central_tendency(type = \"mean\", color = \"red\", linetype = \"dashed\") +\r\n  geom_vline(xintercept = 25, color = \"blue\", linetype = \"dashed\") + \r\n  labs(subtitle = get_test_label(stat.test,  detailed = TRUE))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-statistics-2-comparing-groups-means\/figures\/085-how-to-do-one-sample-t-test-in-r-one-sample-density-with-p-value-1.png\" width=\"384\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"summary\" class=\"section level2\">\n<h2>Summary<\/h2>\n<p>This article shows how to perform the one-sample t-test in R\/Rstudio using two different ways: the R base function <code>t.test()<\/code> and the <code>t_test()<\/code> function in the rstatix package. We also describe how to interpret and report the t-test results.<\/p>\n<\/div>\n<div id=\"references\" class=\"section level2 unnumbered\">\n<h2>References<\/h2>\n<div id=\"refs\" class=\"references\">\n<div id=\"ref-cohen1998\">\n<p>Cohen, J. 1998. <em>Statistical Power Analysis for the Behavioral Sciences<\/em>. 2nd ed. Hillsdale, NJ: Lawrence Erlbaum Associates.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen&#8217;s d, interpretation and reporting.<\/p>\n","protected":false},"author":1,"featured_media":8994,"parent":11693,"menu_order":85,"comment_status":"open","ping_status":"closed","template":"","class_list":["post-11695","dt_lessons","type-dt_lessons","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Do a One-Sample T-test in R : Best Tutorial You Need - Datanovia<\/title>\n<meta name=\"description\" content=\"Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen&#039;s d, interpretation and reporting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Do a One-Sample T-test in R : Best Tutorial You Need - Datanovia\" \/>\n<meta property=\"og:description\" content=\"Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen&#039;s d, interpretation and reporting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/\",\"name\":\"How To Do a One-Sample T-test in R : Best Tutorial You Need - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg\",\"datePublished\":\"2019-12-26T08:36:48+00:00\",\"description\":\"Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen's d, interpretation and reporting.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lessons\",\"item\":\"https:\/\/www.datanovia.com\/en\/lessons\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Do a T-test in R: Calculation and Reporting\",\"item\":\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How To Do a One-Sample T-test in R\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Do a One-Sample T-test in R : Best Tutorial You Need - Datanovia","description":"Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen's d, interpretation and reporting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/","og_locale":"en_US","og_type":"article","og_title":"How To Do a One-Sample T-test in R : Best Tutorial You Need - Datanovia","og_description":"Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen's d, interpretation and reporting.","og_url":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/","og_site_name":"Datanovia","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/","url":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/","name":"How To Do a One-Sample T-test in R : Best Tutorial You Need - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg","datePublished":"2019-12-26T08:36:48+00:00","description":"Describes how to do a one-sample t-test in R\/Rstudio. You will learn the calculation, visualization, effect size measure using the Cohen's d, interpretation and reporting.","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/X42287188_725137297826217_3261641689780977664_n.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/how-to-do-a-one-sample-t-test-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"Lessons","item":"https:\/\/www.datanovia.com\/en\/lessons\/"},{"@type":"ListItem","position":3,"name":"How to Do a T-test in R: Calculation and Reporting","item":"https:\/\/www.datanovia.com\/en\/lessons\/how-to-do-a-t-test-in-r-calculation-and-reporting\/"},{"@type":"ListItem","position":4,"name":"How To Do a One-Sample T-test in R"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/11695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/dt_lessons"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=11695"}],"version-history":[{"count":1,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/11695\/revisions"}],"predecessor-version":[{"id":15322,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/11695\/revisions\/15322"}],"up":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/11693"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/8994"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=11695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}