Skip to content
Learn Plant Science

Learn Plant Science

Explore the the green world with us

  • Home
  • Statistics – Experimental Design & Data Analysis Using R
  • Z – test & T – Test in R
code, coding, web-944499.jpg

Z – test & T – Test in R

Posted on January 27, 2023March 21, 2023 By Janith Piumal No Comments on Z – test & T – Test in R
Statistics – Experimental Design & Data Analysis Using R

Assumption of Z-test

  • samples are randomly selected from the population
  • Population is normally distributed
  • population variance is known

Assumption of T-test

  • samples are randomly selected from the population
  • population is normally distributed
  • populations variance is unknown
  • sample data are continuous

Z-test VS T-test

  • Z test can be only apply when the population variance is known and sample size is 30 or more than 30, and Z-test is used in one population sampling
  • T – test only be used population variance is unknown and the sample size is less than 30 and T – test can be used in one population sampling(one sample t- test)and two population sampling. (independent and paired sample t -test)

Independent VS dependent (paired) sample t-test

  • independent sample T-test compare variable between two unrelated groups (e.g. – age of the male and female)
  • dependent sample T-test compare variable between two related groups ( e.g – body weight before and after the exercise)

Z – test in R

install.packages("TeachingDemos") 
library(TeachingDemos)
z.test(x, mu = 0, stdev, alternative = c("two.sided", "less", "greater"),
  sd = stdev, n=length(x), conf.level = 0.95)
  • x = data values
  • mu = hypothesized mean
  • stdev = standard deviation
  • alternative = alternative hypothesis
  • conf.level = level of the confident
  • n = sample size

T – test in R

1. one sample T -test

install.packages("TeachingDemos") 
library(TeachingDemos)
t.test(x, mu, alternative, conf.level, var.equal=TRUE)

  • var.equal = the assumption than variable is equal or not

2. Paired (dependent sample t -test)

t.test(x, y, alternative, conf.level, paired = TRUE, var.equal=TRUE)

3. Independent sample T-test

t.test(x, y, alternative, conf.level, paired = FALSE, var.equal=TRUE)
  • x = vector of the data values of 1st sample
  • y = vector of the data values of 2nd sample
  • paired = if samples are dependent or independent

Post navigation

❮ Previous Post: Introduction to experiment design
Next Post: ANOVA test ❯

You may also like

statistics, graph, chart-3411473.jpg
Statistics – Experimental Design & Data Analysis Using R
Introduction to experiment design
January 17, 2023
audit, chart, graph-3229739.jpg
Statistics – Experimental Design & Data Analysis Using R
Statistical Sampling Methods.
March 4, 2023
online, web, statistics-3539409.jpg
Statistics – Experimental Design & Data Analysis Using R
Sign Test
January 30, 2023
analytics, marketing, business-7168479.jpg
Statistics – Experimental Design & Data Analysis Using R
Nonparametric Statistics.
January 30, 2023

Leave a Reply Cancel reply

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

Categories

  • Blog
  • Environment science
  • Horticulture
  • Microbiology
  • Molecular Biology
  • Phylogenetic
  • Plant Breeding
  • Statistics – Experimental Design & Data Analysis Using R
  • Uncategorized

Recent Posts

  • R for Phylogenetic
  • Character based approach of phylogenetic analysis
  • Distance based approach of phylogenetic analysis
  • Phylogenetic Analysis data
  • Applications of the phylogenetic Analysis.

Services

  • Study nature
  • Nature is a gift
  • A second spring
  • Smiles of nature
  • Just let it rain

Contact

Proin gravida nibh auctor aliquet amet anean sollicitudin, lorem quis.

  • 12 Avenue, New York, NY 10160
  • +1 910-626-85255
  • contact@nature.com
  • Home
  • Statistics
  • Phylogenetics
  • Microbiology
  • Plant Breeding
  • Horticulture
  • Molecular Biology
  • Environment science

Copyright © 2026 Learn Plant Science.

Theme: Oceanly Green by ScriptsTown