6/23/2023 0 Comments T.test in r studio![]() ![]() If you prefer to use this, will be good to read the code in detail since it is not very well documented how the standard errors etc are calculated. Weight=df$Score1,weighty=df$Score1,samedata=FALSE)Īpparently it is a frequency weight in this weighted t-test but I am not sure. more towards the higher weight samples.įor the weighted t-test offered in package weights: library(weights) ![]() You can see that the coefficients are estimated differently. Now for a weighted linear regression: coefficients(summary(lm(Score1~ Group,data=df,weight=df$PopDens))) For the t.test 0.05007, it's not crazily different. You get a p-value of 0.0589470215 for the effect of difference of B from A. T = -2.404, df = 6.463, p-value = 0.05007Īlternative hypothesis: true difference in means is not equal to 0 T.test(df$Score1,df$Score1,data=df)ĭata: df$Score1 and df$Score1 We subset on only A and B: df = subset(df,Group %in% c("A","B"))Īnd we can compare the results of a t-test and lm: coefficients(summary(lm(Score1~ Group,data=df))) T-tests work on normally distributed data. Label = c("A", "B", "C", "F"), class = "factor")), class = "ame", row.names = c(NA, They are used to determine whether two given samples are different from each other or not. Allowed value is one of two.sided (default), greater or less. You can check out this discussion and maybe this paper on weights in linear regression. The issue lies with how to use weights in estimating the error because that is the basis of your t-test. There is no clear definition for what would make a weighted t-test. I have never used a weighted t.test before, only weights in linear regression. Welch Two Sample t-test data: vara and varb t -3.3773, df 1.9245, p-value 0.08182 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -55.754265 7.754265 sample estimates: mean of x mean of y 27.5 51. Below is more like a small summary of my thoughts and quick search.
0 Comments
Leave a Reply. |