Skip to content

Data Science Tutorials

  • Home
  • R
  • Statistics
  • Course
  • Machine Learning
  • Guest Blog
  • Contact
  • About Us
  • Toggle search form
  • how to create a hexbins chart in R
    How to create a hexbin chart in R R
  • Change ggplot2 Theme Color in R
    Change ggplot2 Theme Color in R ggthemr Package R
  • Remove Columns from a data frame
    How to Remove Columns from a data frame in R R
  • How to Replace Inf Values with NA in R
    How to Replace Inf Values with NA in R R
  • Best Data Science YouTube Tutorials
    Best Data Science YouTube Tutorials Free to Learn Course
  • How To Become a Business Intelligence Analyst
    How To Become a Business Intelligence Analyst Course
  • Separate a data frame column into multiple columns
    Separate a data frame column into multiple columns-tidyr Part3 R
  • Quantiles by Group calculation in R
    Quantiles by Group calculation in R with examples 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 Jim No Comments on Calculate the p-Value from Z-Score in R
Tweet
Share
Share
Pin

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.

Tweet
Share
Share
Pin
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

  • Get the first value in each group in R
    Get the first value in each group in R? R
  • How to Use “not in” operator in Filter
    How to Use “not in” operator in Filter R
  • How to Add a title to ggplot2 Plots in R
    How to Add a caption to ggplot2 Plots in R? R
  • Rounded corner bar plot in R
    How to make a rounded corner bar plot in R? R
  • Error in sum(List) : invalid 'type' (list) of argument
    Error in sum(List) : invalid ‘type’ (list) of argument R
  • Arrange the rows in a specific sequence in R
    Arrange the rows in a specific sequence in R R

Leave a Reply Cancel reply

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

  • About Us
  • Contact
  • Disclaimer
  • Guest Blog
  • Privacy Policy
  • YouTube
  • Twitter
  • Facebook
  • Top 7 Skills Required to Become a Data Scientist
  • Learn Hadoop for Data Science
  • How Do Online Criminals Acquire Sensitive Data
  • Top Reasons To Learn R in 2023
  • Linear Interpolation in R-approx

Check your inbox or spam folder to confirm your subscription.

 https://www.r-bloggers.com
  • 5 Free Books to Learn Statistics For Data Science
    5 Free Books to Learn Statistics For Data Science Course
  • How to apply a transformation to multiple columns in R?
    How to apply a transformation to multiple columns in R? R
  • Survival Plot in R
    How to Perform a Log Rank Test in R R
  • Separate a data frame column into multiple columns
    Separate a data frame column into multiple columns-tidyr Part3 R
  • Credit Card Fraud detection in R
    Credit Card Fraud Detection in R R
  • Hypothesis Testing Examples
    Hypothesis Testing Examples-Quick Overview Statistics
  • Top 10 Data Visualisation Tools
    Top 10 Data Visualisation Tools Every Data Science Enthusiast Must Know Course
  • How to Rank by Group in R?
    How to Rank by Group in R? R

Copyright © 2023 Data Science Tutorials.

Powered by PressBook News WordPress theme