Skip to content

Data Science Tutorials

For Data Science Learners

  • Two-Way ANOVA Example in R
    Two-Way ANOVA Example in R-Quick Guide R
  • Calculating Conditional Probability in R
    Calculating Conditional Probability in R R
  • Tips for Data Scientist Interview Openings
    Tips for Data Scientist Interview Openings Course
  • How to do Pairwise Comparisons in R?
    How to do Pairwise Comparisons in R? R
  • How to copy files in R
    How to copy files in R R
  • learn Hadoop for Data Science
    Learn Hadoop for Data Science Machine Learning
  • Detecting and Dealing with Outliers
    Detecting and Dealing with Outliers: First Step R
  • Add Footnote to ggplot2 R
Calculate the p-Value from Z-Score in R

Calculate the p-Value from Z-Score in R

Posted on May 27May 27 By Admin No Comments on Calculate the p-Value from Z-Score in R

Calculate the p-Value from Z-Score in R, In statistics, we frequently want to know the p-value associated with a specific z-score obtained from a hypothesis test.

We can reject the null hypothesis of our hypothesis test if this p-value is less than a certain level of significance.

How to create contingency tables in R? – Data Science Tutorials

In R, we may use the pnorm() function to find the p-value associated with a z-score, which has the following syntax.

pnorm(q, mean = 0, sd = 1, lower.tail = TRUE)

where:

q: The z-score

mean: The normal distribution’s mean. The default value is 0.

sd: The normal distribution’s standard deviation. The default value is 1.

lower.tail: If TRUE, the probability in the normal distribution to the left of q is returned. The probability to the right is returned if FALSE. TRUE is the default value.

How to add labels at the end of each line in ggplot2? (datasciencetut.com)

For a left-tailed test, right-tailed test, and two-tailed test, the following examples show how to get the p-value associated with a z-score.

Test with one tail on the left

In a left-tailed hypothesis test, let’s say we wish to calculate the p-value associated with a z-score of -1.8.

To find p-value

pnorm(q=-1.8, lower.tail=TRUE)
0.03593032

0.03593032 is the p-value. We would reject the null hypothesis based on a significance level of = 0.05 because the p-value is less than 0.05.

Test with the right tail

In a right-tailed hypothesis test, let’s say we wish to calculate the p-value associated with a z-score of 1.8.

To find p-value

pnorm(q=1.8, lower.tail=FALSE)
0.03593032

0.03593032 is the p-value. We would reject the null hypothesis if we used a significance level of = 0.05 because the p-value is less than 0.05.

Dealing With Missing Values in R – Data Science Tutorials

Test with two tails

In a two-tailed hypothesis test, let’s say we wish to calculate the p-value associated with a z-score of 1.24.

To find the p-value for the two-tailed test

2*pnorm(q=1.24, lower.tail=FALSE)
[1] 0.2149754

We simply multiplied the one-tailed p-value by two to get the two-tailed p-value.

How to perform the Kruskal-Wallis test in R? – Data Science Tutorials

0.2149 is the p-value. We would fail to reject the null hypothesis of our hypothesis test if we used a significance level of = 0.05 because the p-value is not less than 0.05.

Check your inbox or spam folder to confirm your subscription.

R Tags:pvalue

Post navigation

Previous Post: One sample proportion test in R-Complete Guide
Next Post: Calculate the P-Value from Chi-Square Statistic in R

Related Posts

  • Checking Missing Values in R
    Checking Missing Values in R R
  • A Side-by-Side Boxplot in R
    A Side-by-Side Boxplot in R: How to Do It R
  • Dynamic data visualizations in R
    Dynamic data visualizations in R R
  • Calculating Autocorrelation in R R
  • How to create a heatmap in R
    How to create a heatmap in R R
  • glm function in R
    glm function in r-Generalized Linear Models R

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Type II Errors in R
  • Best Prompt Engineering Books
  • Understanding Machine Learning and Data Science
  • Best Git Books
  • Top 5 Books to Learn Data Engineering
  • About Us
  • Contact
  • Disclaimer
  • Privacy Policy

https://www.r-bloggers.com

  • YouTube
  • Twitter
  • Facebook
  • Course
  • Excel
  • Machine Learning
  • Opensesame
  • R
  • Statistics

Check your inbox or spam folder to confirm your subscription.

  • KPSS test in R
    KPSS Test in R With Examples R
  • Algorithm Classifications in Machine Learning
    Algorithm Classifications in Machine Learning Machine Learning
  • ggpairs in R
    ggpairs in R R
  • How to perform kruskal wallis test in r
    How to perform the Kruskal-Wallis test in R? R
  • Top Data Science Examples You Should Know 2023
    Top Data Science Applications You Should Know 2023 Machine Learning
  • How to Create an Interaction Plot in R
    How to Create an Interaction Plot in R? R
  • How do augmented analytics work
    How do augmented analytics work? R
  • Best Git Books R

Privacy Policy

Copyright © 2025 Data Science Tutorials.

Powered by PressBook News WordPress theme