# [R] Re: T-test syntax question

Jessie F sfan_2004 at hotmail.com
Wed Nov 24 19:15:59 CET 2004

```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

>From: Vito Ricci <vito_ricci at yahoo.com>
>To: r-help at stat.math.ethz.ch
>CC: steven.f.freeman at verizon.net
>Subject: [R] Re: T-test syntax question
>Date: Wed, 24 Nov 2004 12:32:06 +0100 (CET)
>
>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
>
> > set.seed(13)
> > d<-rnorm(50)
> > 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
>[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/
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help