That's a scoping problem, I think a bug in oneway_test. Because the formula var ~ group is created with the anonymous function within lapply, its environment should be the evaluation frame of that function call and var should be visible. If I replace oneway_test() with lm() it works.

I think a workaround is to construct the data argument explicitly, i.e.

lapply(y, function(var) oneway_test(var ~ group, data.frame(var=var, group=group)))


yes, that would be the fix:

R> lapply(y, function(var) oneway_test(var ~ group,
          data = data.frame(var = var, group = group)))
$V1

        Asymptotic 2-Sample Permutation Test

data:  var by group (1, 2)
Z = -1.2054, p-value = 0.2280
alternative hypothesis: true mu is not equal to 0


$V2

        Asymptotic 2-Sample Permutation Test

data:  var by group (1, 2)
Z = 0.5672, p-value = 0.5706
alternative hypothesis: true mu is not equal to 0

Thanks, Duncan.

Torsten


I've cc'd Torsten Hothorn, the maintainer of coin.

Duncan Murdoch


Thank you,

Matthieu

Matthieu Dubois
Post-doctoral fellow

Psychology and NeuroCognition Lab (CNRS UMR 5105)
Université Pierre Mendès-France
BP47 --- 38040 Grenoble Cedex 9 --- France

Email: matthieu.dub...@upmf-grenoble.fr
Gmail: matth...@gmail.com
http://web.upmf-grenoble.fr/LPNC/membre_matthieu_dubois





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