Hi, 

If you mean if the t.test is done as if the samples where paired, the answer is 
yes if you write argument paired = TRUE; and the pairs are done in order, that 
is 1º with 1º, 2º with 2º, etc.

As you wrote, (paired = FALSE) the t.test is unpaired, and the order of 
elements in the vectors are not taken into account.

Regards

Patricia


> Date: Thu, 29 Jan 2009 13:59:41 +0000
> From: amitrh...@yahoo.co.uk
> To: r-help@r-project.org
> Subject: [R] t-test
> 
> When doing the t-test in the below manner will r compare each element of the 
> array with the relevant one. I.e. if i was comparing x and y would (1 and 0) 
> and (1 and 9) be treated as separate variables. Or does it just assume one 
> variable. 
> 
> 
> # test data
> 
> x <- c(1,1.1,1.15,1.2,1.21,1.23)
> 
> y <- c(0.9,1,1.16,1.18,1.19,1.2)
> 
> z <- c(1.4,1.42,1.43,1.44,1.45,1.46)
> 
> 
> ###Â  Student's t-test
> 
> # for help in R type ?t.test()
> 
> # defaults are:
> # alternative = "two.sided" i.e. two-sided t-test
> # var.equal = FALSE i.e. unequal variance
> 
> # note:
> # na.rm = TRUE removes missing values
> # $p.value gives the p-value for the test
> 
> t.test(x, y, na.rm=TRUE, paired=FALSE)$p.value
> 
> # gives 0.5026467
> 
> t.test(x, z, na.rm=TRUE, paired=FALSE)$p.value
> 
> # gives 0.0003166352
> 
> 
> 
>       
>       [[alternative HTML version deleted]]
> 

_________________________________________________________________


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  • [R] t-test Amit Patel
    • Re: [R] t-test patricia garcía gonzález

Reply via email to