On Mar 1, 2010, at 12:12 PM, Amit Patel wrote:

Apparently the vectors that I have are lists

Then unlist them.

and when I try to conduct the Bartlett test I am getting errors. I may be using it wrong. I am not an R expert>

xbartlett2 <- c(Samp1,Samp2)
#Samp1 & 2 are lists
gbartlett24 <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)

Attempt 1
gazant <- bartlett.test(xbartlett2~gbartlett24)$p.value
Error in model.frame.default(formula = xbartlett2 ~ gbartlett24) :
 invalid type (list) for variable 'xbartlett2'

xbartlett2 <- c(Samp1,Samp2)



gazant <- bartlett.test(xbartlett2, gbartlett24)$p.value
Error in bartlett.test.default(xbartlett2, gbartlett24) :
 there must be at least 2 observations in each group

(There are at least 2 unique observations in each group)

Thanks in advance





----- Original Message ----
From: "Richardson, Patrick" <patrick.richard...@vai.org>
To: Amit Patel <amitrh...@yahoo.co.uk>; "r-help@r-project.org" <r-help@r-project.org >
Sent: Mon, 1 March, 2010 14:31:15
Subject: RE: [R] Bartlett Test

?bartlett.test

From the help page "If x is a list, its elements are taken as the samples or fitted linear models to be compared for homogeneity of variances. In this case, the elements must either all be numeric data vectors or fitted linear model objects, g is ignored, and one can simply use bartlett.test(x) to perform the test. If the samples are not yet contained in a list, use bartlett.test(list(x, ...)).

Otherwise, x must be a numeric data vector, and g must be a vector or factor object of the same length as x giving the group for the corresponding elements of x. "

Patrick

-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of Amit Patel
Sent: Monday, March 01, 2010 9:26 AM
To: r-help@r-project.org
Subject: [R] Bartlett Test

Hi

I am trying to conduct a Bartlett test between two groups Samp 1 and Samp 2, both of which are vectors of equal length. I cant find any information on how to do this. Does the data need to be in a structured list.

Thanks in advance





______________________________________________
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.
The information transmitted is intended only for the p...{{dropped:22}}

______________________________________________
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.

Reply via email to