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

______________________________________________
[email protected] 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.

Reply via email to