Skip to content

T-test syntax question

2 messages · Vito Ricci, Jessie F

#
Hi,

In case of paired data, if you have only differencies
and not original data you can get this t test based on
differencies:

Say d is the vector with differencies data and suppose
you wish to test if the mean of differency is equal to
zero:

md<-mean(d) ## sample mean of differencies
sdd<-sd(d) ## sample sd of differencies
n<-length(d) ## sample size
t.value<-(md/(sdd/sqrt(n))) ## sample t-value with n-1
df
pt(t.value,n-1,lower.tail=FALSE) ## p-value of test
n-1 df
[1] 0.5755711

Best regards,
Vito
Steven F. Freeman wrote:
I'd like to do a t-test to compare the Delta values of
items with Crit=1
with Delta values of items with Crit=0. What is the
t.test syntax?

It should produce a result like this below (I can't
get in touch with the
person who originally did this for me)

    Welch Two Sample t-test

data:  t1$Delta by Crit
t = -3.4105, df = 8.674, p-value = 0.008173
alternative hypothesis: true
difference in means is not equal to 0
95 percent confidence interval:
 -0.04506155 -0.00899827
sample estimates:
mean in group FALSE  mean in group TRUE 
         0.03331391          0.06034382 

Thanks.

=====
Diventare costruttori di soluzioni
Became solutions' constructors

"The business of the statistician is to catalyze 
the scientific learning process."  
George E. P. Box


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese  http://www.modugno.it/archivio/palese/
#
Actually, you can still use t.test with one vector of data. Say, the 
differences is d ( a vector (or an array of numbers), you can use t.test(d), 
then by default, it testing whether mu=0, you can also specify confidence 
level by adding conf.level = 0.95 etc.

You can also type ?t.test in R command to get more information with R.help.

Hope this helps!

S Fan