t-test

How do I make a t-test across several groups in one column in R?

邮差的信 提交于 2019-12-14 02:26:49
问题 I'd like to kindly ask you, how to perform a t-test in R when I have a column with the group levels and a column with the values like this: group value north 1.1 north 1.6 north 1.4 east 1.3 east 1.5 east 1.7 south 1.2 south 1.5 south 1.8 west 1.6 west 1.7 west 1.9 to get a result like this: north east south west north p-value p-value p-value east p-value p-value p-value south p-value p-value p-value west p-value p-value p-value I searched a lot in the internet but the descriptions that I

T-test for multiple rows in R

99封情书 提交于 2019-12-12 06:56:43
问题 I have a table with 40+ columns and 200.000+ rows. Something like this: ID GROUP-A1 GROUP-A2 GROUP A3...A20 GROUP-B1 GROUP-B2 GROUP-B3...B20 1 5 6 3 5....3 10 21 9 15 2 3 4 6 2....13 23 42 34 23 3 5 3 1 0....12 10 12 43 15 4 0 0 2 5....3 10 21 23 15 I would like to run a t-test for the two groups A (1..20) and B (1..20) for every measurement I have (each row), which are independent. And possibly, have the resulting stats in the table next to each row or in a separate table, so I can easily

Test for significance of specific multiple groups in R

a 夏天 提交于 2019-12-12 05:49:46
问题 The data looks as follows: > data <- read.csv("data.csv") > head(data) ï..class.1 rev.1 class.2 rev.2 1 7 136.9900 1318 31.9900 2 1223 24.0984 1001 0.0000 3 1318 61.9900 6851 104.2655 4 1014 39.9800 1318 29.9800 5 7 32.9800 7 52.9900 6 291 107.6674 797 31.2741 I want to perform a significance test to compare the means of rev.1 and rev.2 ONLY where groups class.1=class.2. I tried doing this with ANOVA but am having issues only comparing the groups that I want. Any guidance would be greatly

Group by groups to Pandas Series/Dataframe

主宰稳场 提交于 2019-12-08 20:48:26
Apologies in advance if this question is naive. I am new to Python. I am trying to perform a t-test on two columns of my dataframe. It only makes sense to do the t-test after having grouped the columns by another column in the same dataframe. I am dealing with something like this: rand_array = np.random.randint(low=10, high=30, size=9) rand_array2 = np.random.randint(low=10, high=30, size=9) d = {'key1':[0,0,1,0,1,1,1,0,1], 'key2': rand_array, 'key3': rand_array2} df1 = pd.DataFrame(d) print df1 The output I get is: key1 key2 key3 0 0 20 18 1 0 22 16 2 1 21 26 3 0 21 13 4 1 11 21 5 1 23 10 6 1

Group by groups to Pandas Series/Dataframe

こ雲淡風輕ζ 提交于 2019-12-08 04:07:38
问题 Apologies in advance if this question is naive. I am new to Python. I am trying to perform a t-test on two columns of my dataframe. It only makes sense to do the t-test after having grouped the columns by another column in the same dataframe. I am dealing with something like this: rand_array = np.random.randint(low=10, high=30, size=9) rand_array2 = np.random.randint(low=10, high=30, size=9) d = {'key1':[0,0,1,0,1,1,1,0,1], 'key2': rand_array, 'key3': rand_array2} df1 = pd.DataFrame(d) print

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

R: t tests on rows of 2 dataframes

好久不见. 提交于 2019-12-03 21:08:06
问题 I have two dataframes and I would like to do independent 2-group t-tests on the rows (i.e. t.test(y1, y2) where y1 is a row in dataframe1 and y2 is matching row in dataframe2) whats best way of accomplishing this? EDIT: I just found the format: dataframe1[i,] dataframe2[i,]. This will work in a loop. Is that the best solution? 回答1: The approach you outlined is reasonable, just make sure to preallocate your storage vector. I'd double check that you really want to compare the rows instead of

How to calculate (statistical) power function vs. sample size in python?

十年热恋 提交于 2019-12-03 20:27:00
How can this be done in python? Calculate sample size for a given power and alpha? Calculate power for a given sample size and alpha? Note: I am totally confused :( with the functions that python gives for (statistical) power function calculation. Can someone help me to make an order here? There are two functions under statsmodels: from statsmodels.stats.power import ttest_power, tt_ind_solve_power() We have: tt_ind_solve_power(effect_size=effect_size, alpha=alpha, power=0.8, ratio=1, alternative='two-sided') And we have also: ttest_power(0.2, nobs=sampleSize, alpha=alpha, alternative='two

Multiple t-test comparisons

本秂侑毒 提交于 2019-12-03 14:04:49
问题 I would like to know how I can use t.test or pairwise.t.test to make multiple comparisons between gene combinations. First, how can I compare all combinations Gene 1 vs. Gene 3, Gene 3 vs Gene 4, etc.? Second, how would I be able to only compare combinations of Gene 1 with the other genes? Do I need to make a function for this? Assuming I have the dataset below, when "arguments are not the same length", what can I do? Thanks. Gene S1 S2 S3 S4 S5 S6 S7 1 20000 12032 23948 2794 5870 782 699 3

Perform multiple paired t-tests based on groups/categories

廉价感情. 提交于 2019-11-29 02:32:11
I am stuck at performing t.tests for multiple categories in Rstudio. I want to have the results of the t.test of each product type, comparing the online and offline prices. I have over 800 product types so that's why don't want to do it manually for each product group. I have a dataframe (more than 2 million rows) named data that looks like: > Product_type Price_Online Price_Offline 1 A 48 37 2 B 29 22 3 B 32 40 4 A 38 36 5 C 32 27 6 C 31 35 7 C 28 24 8 A 47 42 9 C 40 36 Ideally I want R to write the result of the t.test to another data frame called product_types: > Product_type 1 A 2 B 3 C 4