Quantcast

levene.test

classic Classic list List threaded Threaded
4 messages Options
mnr
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

levene.test

mnr
I am trying to use Levene's test (of package car), but I do
not understand quite well how to use it. '?levene.test' does
not unfortunately provide any example. My data are in a data
frame and correspond to 1 factor plus response. Could
someone please give me an example about how to use the command
 
levene.test(y, group)

Thanks in advance,
 
marta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: levene.test

Bernardo Rangel tura
On Wed, 2010-07-14 at 01:37 -0700, martanair wrote:

> I am trying to use Levene's test (of package car), but I do
> not understand quite well how to use it. '?levene.test' does
> not unfortunately provide any example. My data are in a data
> frame and correspond to 1 factor plus response. Could
> someone please give me an example about how to use the command
>  
> levene.test(y, group)
>
> Thanks in advance,
>  
> marta

Hi Marta,

levene.test is deprecated functions in car package as say the help of
command (?levene.test). Instead this use leveneTest (?levene.test
again)If you type ?leveneTest you get examples


--
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: levene.test

Gavin Simpson
In reply to this post by mnr
On Wed, 2010-07-14 at 01:37 -0700, martanair wrote:
> I am trying to use Levene's test (of package car), but I do
> not understand quite well how to use it. '?levene.test' does
> not unfortunately provide any example.

Err, yes it does, several examples in fact.

>  My data are in a data
> frame and correspond to 1 factor plus response. Could
> someone please give me an example about how to use the command
>  
> levene.test(y, group)
>
> Thanks in advance,
>  
> marta

Here is an example where data aren't in a data.frame.

require(car)
## dummy data with know different variances
set.seed(123)
Y <- c(rnorm(20, sd = 6), rnorm(20, sd = 1))
G <- gl(2, 20, labels = paste("Group", 1:2, sep = ""))
## Y is the thing we measured on our two groups,
## G is the group indicator

## levene test of different variances
levene.test(y = Y, group = G)

## Gives:
Levene's Test for Homogeneity of Variance
      Df F value    Pr(>F)    
group  1  21.033 4.792e-05 ***
      38                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

If Y and G were in a data frame, then the easiest way to run it is:

## put data above in to a data frame
dat <- data.frame(Y = Y, G = G)
head(dat)
str(dat)
## ok so G is a factor within data frame

## run levene's test
with(dat, leven.test(y = Y, group = G))

?leven.test even shows you this usage!

## or if you like $
levene.test(dat$Y, dat$G)

Just replace dat Y and G with the relevant objects and components of the
data frame holding your data.

HTH

G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: levene.test

Gavin Simpson
In reply to this post by Bernardo Rangel tura
On Wed, 2010-07-14 at 06:50 -0300, Bernardo Rangel Tura wrote:

> On Wed, 2010-07-14 at 01:37 -0700, martanair wrote:
> > I am trying to use Levene's test (of package car), but I do
> > not understand quite well how to use it. '?levene.test' does
> > not unfortunately provide any example. My data are in a data
> > frame and correspond to 1 factor plus response. Could
> > someone please give me an example about how to use the command
> >  
> > levene.test(y, group)
> >
> > Thanks in advance,
> >  
> > marta
>
> Hi Marta,
>
> levene.test is deprecated functions in car package as say the help of
> command (?levene.test). Instead this use leveneTest (?levene.test
> again)If you type ?leveneTest you get examples

It is only deprecated in the r-forge, unreleased(to CRAN) version. The
one on CRAN (1.2-16) still uses levene.test and there is no leveneTest
there.

G

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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