hypothesis-test

trying to perform a t.test for each row and count all rows where p-value is less than 0.05

删除回忆录丶 提交于 2019-12-11 10:48:56
问题 I've been wrecking my head for the past four hours trying to find the solution to an R problem, which is driving me nuts. I've searching everywhere for a decent answer but so far I've been hitting wall after wall. I am now appealing to your good will of this fine community for help. Consider the following dataset: set.seed(2112) DataSample <- matrix(rnorm(24000),nrow=1000) colnames(DataSample) <- c(paste("Trial",1:12,sep=""),paste("Control",13:24,sep="")) I need to perform a t-test for every

Hypothesis Testing Skewness and/or Kurtosis in R

丶灬走出姿态 提交于 2019-12-07 06:22:58
问题 How do I specifically test the null and alternative hypothesis of the skewness and/or Kurtosis of a variable in hypothesis testing? Would I have to use a formula in t.test? t.test(data$variable, y = Null) Any help is appreciated. Thanks! 回答1: You have many options. Two of the best ways to test skewness and kurtosis using the moments or e1071 package: duration <- data$variable # I'm going to call it duration library(moments) kurtosis(duration) skewness(duration) library(e1071) skewness

doing t.test for columns for each row in data set

て烟熏妆下的殇ゞ 提交于 2019-12-06 15:30:25
I have a set of data x which consists of 12 columns and 167 rows. The first column is compound Id for each row. I want to run a t.test for 3 column as one group and the other 3 groups as the second group, separately for each row. My code is as below but it does not work. for (i in 1:nrow(x)) { function(i)c(compound=i, t.test(x[2:4],x[8:10], x[x$compound==i, ], alternative='two.sided',conf.level=0.95) ) } print(c(compound=i,t.test(x[2:4],x[8:10],x[x$compound==i,], alternative='two.sided',conf.level=0.95))) My intention was doing a t.test for each metabolite (compound) between AC groups and SC

Hypothesis Testing Skewness and/or Kurtosis in R

孤街醉人 提交于 2019-12-05 11:43:33
How do I specifically test the null and alternative hypothesis of the skewness and/or Kurtosis of a variable in hypothesis testing? Would I have to use a formula in t.test? t.test(data$variable, y = Null) Any help is appreciated. Thanks! You have many options. Two of the best ways to test skewness and kurtosis using the moments or e1071 package: duration <- data$variable # I'm going to call it duration library(moments) kurtosis(duration) skewness(duration) library(e1071) skewness(duration) kurtosis(duration) I should mention that skewness and kurtosis are almost always present (only in an

paired t-test crashes apply-loop (edited)

╄→гoц情女王★ 提交于 2019-12-05 03:44:15
问题 In response to the helpful comments, I have edited the original question (where I had assumed that a for-loop and an apply-loop give different results). I am using R to run a large number of 2-group t-tests, using input from a delimited table. Following recommendations from here and elsewhere, I tried either 'for-loops' and 'apply' to accomplish that. For 'normal' t.test, both work nicely and give the same results. However, for a paired t-test, the for-look appears to works while the apply

paired t-test crashes apply-loop (edited)

烈酒焚心 提交于 2019-12-03 20:54:56
In response to the helpful comments, I have edited the original question (where I had assumed that a for-loop and an apply-loop give different results). I am using R to run a large number of 2-group t-tests, using input from a delimited table. Following recommendations from here and elsewhere, I tried either 'for-loops' and 'apply' to accomplish that. For 'normal' t.test, both work nicely and give the same results. However, for a paired t-test, the for-look appears to works while the apply-loop does not. Later, i found out that both loops suffer from the same problem (see below) but the for

Get p-value for group mean difference without refitting linear model with a new reference level

隐身守侯 提交于 2019-12-02 11:14:23
问题 When we have a linear model with a factor variable X (with levels A , B , and C ) y ~ factor(X) + Var2 + Var3 The result shows the estimate XB and XC which is differences B - A and C - A . (suppose that the reference is A ). If we want to know the p-value of the difference between B and C : C - B , we should designate B or C as a reference group and re-run the model. Can we get the p-values of the effect B - A , C - A , and C - B at one time? 回答1: You are looking for linear hypothesis test by

Get p-value for group mean difference without refitting linear model with a new reference level

孤街浪徒 提交于 2019-12-02 05:30:34
When we have a linear model with a factor variable X (with levels A , B , and C ) y ~ factor(X) + Var2 + Var3 The result shows the estimate XB and XC which is differences B - A and C - A . (suppose that the reference is A ). If we want to know the p-value of the difference between B and C : C - B , we should designate B or C as a reference group and re-run the model. Can we get the p-values of the effect B - A , C - A , and C - B at one time? 李哲源 You are looking for linear hypothesis test by check p-value of some linear combination of regression coefficients. Based on my answer: How to conduct

Confidence Interval for t-test (difference between means) in Python

眉间皱痕 提交于 2019-11-30 11:19:22
I am looking for a quick way to get the t-test confidence interval in Python for the difference between means. Similar to this in R: X1 <- rnorm(n = 10, mean = 50, sd = 10) X2 <- rnorm(n = 200, mean = 35, sd = 14) # the scenario is similar to my data t_res <- t.test(X1, X2, alternative = 'two.sided', var.equal = FALSE) t_res Out: Welch Two Sample t-test data: X1 and X2 t = 1.6585, df = 10.036, p-value = 0.1281 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.539749 17.355816 sample estimates: mean of x mean of y 43.20514 35.79711 Next: >>

Confidence Interval for t-test (difference between means) in Python

做~自己de王妃 提交于 2019-11-29 17:01:04
问题 I am looking for a quick way to get the t-test confidence interval in Python for the difference between means. Similar to this in R: X1 <- rnorm(n = 10, mean = 50, sd = 10) X2 <- rnorm(n = 200, mean = 35, sd = 14) # the scenario is similar to my data t_res <- t.test(X1, X2, alternative = 'two.sided', var.equal = FALSE) t_res Out: Welch Two Sample t-test data: X1 and X2 t = 1.6585, df = 10.036, p-value = 0.1281 alternative hypothesis: true difference in means is not equal to 0 95 percent