Publications by Priyank Goyal
Chi Square Test of Independence-2
Chi-Square Test of Independence in R The chi-square test of independence is used to analyze the frequency table (i.e. contengency table) formed by two categorical variables. The chi-square test evaluates whether there is a significant association between the categories of the two variables. Data format Contingency Tables Example 6.13.3. Analyt...
3753 sym R (1843 sym/27 pcs) 4 img
Chi Square Test of Independence
Chi-Square Test of Independence in R The chi-square test of independence is used to analyze the frequency table (i.e. contengency table) formed by two categorical variables. The chi-square test evaluates whether there is a significant association between the categories of the two variables. Data format Contingency Tables # Import the data file...
3936 sym R (4333 sym/27 pcs) 4 img
Chi-Square Goodness of Fit Test
What is Chi-Square Goodness of Fit The chi-square goodness of fit test is used to compare the observed distribution to an expected distribution, in a situation where we have two or more categories in a discrete data. In other words, it compares multiple observed proportions to expected probabilities. Example For example, we collected wild tulips...
2294 sym R (3283 sym/26 pcs) 2 img
Two Proportion Z Test
What is two proportion Z test The two-proportions z-test is used to compare two observed proportions. For example, we have two groups of individuals: Group A with lung cancer: n = 500 Group B, healthy individuals: n = 500 The number of smokers in each group is as follow: Group A with lung cancer: n = 500, 490 smokers, Group B, healthy individ...
2899 sym R (650 sym/8 pcs)
One Proportion Z Test
One Proportion Z Test in R What is One Proportion Z Test The One proportion Z-test is used to compare an observed proportion to a theoretical one, when there are only two categories. For example, we have a population of mice containing half male and have female (p = 0.5 = 50%). Some of these mice (n = 160) have developed a spontaneous cancer, in...
2866 sym R (655 sym/8 pcs)
Paired Sample t-test
What is paired samples t-test The paired samples t-test is used to compare the means between two related groups of samples. In this case, you have two values (i.e., pair of values) for the same samples. As an example of data, 20 mice received a treatment X during 3 months. We want to know whether the treatment X has an impact on the weight of the...
4715 sym R (3312 sym/28 pcs) 1 img
One Sample T Test
Install or load ggpubR package for data visualization library(ggpubr) ## Warning: package 'ggpubr' was built under R version 3.6.2 ## Loading required package: ggplot2 ## Registered S3 methods overwritten by 'ggplot2': ## method from ## [.quosures rlang ## c.quosures rlang ## print.quosures rlang ## Loading required p...
3518 sym R (1748 sym/22 pcs) 2 img
Z-test-mean-single Sample
lets create a funtion z.test. the first argument is the vector of data, the second is the population mean, and the third is the population variance. z.test= function(x,mu,popvar){ one.tail.p <- NULL z.score <- round((mean(x)-mu)/(popvar/sqrt(length(x))),3) one.tail.p <- round(pnorm(abs(z.score), lower.tail = FALS...
154 sym R (504 sym/2 pcs)
Chi Square Distribution Simulation
# Generate variables from # standard normal distributions Z1 <- rnorm(1000) Z2 <- rnorm(1000) Z3 <- rnorm(1000) Z4 <- rnorm(1000) # Create the sum of squares Y <- Z1^2 + Z2^2 + Z3^2 + Z4^2 # What distribution will Y have? plot(density(Y), main="Chi-sq Simulated", col="navy", lwd=2, las=1) ...
6 sym R (321 sym/1 pcs) 1 img
Histogram
Create Some Data set.seed(1234) x <- c(rnorm(200, mean=55, sd=5), rnorm(200, mean=65, sd=5)) head(x) ## [1] 48.96467 56.38715 60.42221 43.27151 57.14562 57.53028 create Histogram Plots x: a numeric vector breaks: breakpoints between histogram cells. hist(x, breaks = "Sturges") Another one hist(x, col = "steelblue", frame = FALSE) ## War...
5432 sym R (3778 sym/38 pcs) 9 img