Re: [R] [FORGED] Recreate for loop without using for loop

2019-02-10 Thread Rolf Turner



This list has a "no homework" policy.

On 2/11/19 5:59 AM, Rima El-zein wrote:

Hi.



Can someone please help me recreate this code without using a for loop? Idk if 
I'm supposed to use a map function or something else.


Supposed by whom?  What do you mean by "map function"?


qprob <- function(pp) {

   qq <- 1 - pp -1

   stotal <- 0.0

   for (i in 1:length(pp))

 stotal <- stotal + pp[i] * prod(qq[-i])

   return(stotal)

}


cheers,

Rolf Turner

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Recreate for loop without using for loop

2019-02-10 Thread Jeff Newmiller
There is a no-homework policy stated in the Posting Guide.

On February 10, 2019 8:59:41 AM PST, Rima El-zein  wrote:
>Hi.
>
>
>
>Can someone please help me recreate this code without using a for loop?
>Idk if I'm supposed to use a map function or something else.
>
>
>
>qprob <- function(pp) {
>
>  qq <- 1 - pp -1
>
>  stotal <- 0.0
>
>  for (i in 1:length(pp))
>
>stotal <- stotal + pp[i] * prod(qq[-i])
>
>  return(stotal)
>
>}
>
>Best regards,
>Rima
>
>
>Sendt fra Mail til
>Windows 10
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Merge multiple google xls files

2019-02-10 Thread Ross Molden


I am trying to merge a list of .xls files in google drive. I have now managed 
to create a list of all the files I need, but for some reason I still can't 
manage to merge them, this is the code I have so far:

library(googledrive) inputfiles <- drive_ls(path = "Email It In", pattern = 
"*PDOL_dataexport", n_max = 50)

library(readxl) df.list<- lapply(inputfiles,function(x) read_xls(x)) 
library(dplyr) consolidated_data<-bind_rows(df.list)

The second part of the code throws up the following error: 

Error: path must be a string 

I must be entering the path (inputfiles) incorrectly for lapply, can someone 
please help?
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] How to rum Multiple ANOVA and Multiple T-test between the same groups?

2019-02-10 Thread Boris Steipe
You need to spend more time getting clear on the fundamentals, what the 
Bioconductor project is and why its packages are useful in our domain. 
Bioconductor packages are not installed with the install.packages() function; 
that is for packages on CRAN. Instead, you use ...

  install.packages("BiocManager") # BiocManagere IS hosted on CRAN
  BiocManager::install("genefilter")  # BiocManagerinstalls "genefilter" from 
bioconductor.org

Now, _do_ read the documentation, and pay special attention to the vignettes!

https://cran.r-project.org/web/packages/BiocManager/index.html
https://bioconductor.org/packages/release/bioc/html/genefilter.html



B.




> On 2019-02-10, at 17:44, AbouEl-Makarim Aboueissa 
>  wrote:
> 
> Dear Prof Kohl:
> 
> 
> I am trying to install the "genefilter" package, but I got the following
> error message(s). I am not sure which R version should be used for this
> package.
> 
> 
> *For R.3.5.2:*
> 
>> install.packages("genefilter")
> Installing package into ‘C:/Users/aaboueissa/Documents/R/win-library/3.5’
> (as ‘lib’ is unspecified)
> Warning message:
> package ‘genefilter’ is not available (for R version 3.5.2)
> 
> 
> *For R.3.3.2:*
> 
>> install.packages("Bioconductor")
> Installing package into ‘C:/Users/aaboueissa/Documents/R/win-library/3.3’
> (as ‘lib’ is unspecified)
> --- Please select a CRAN mirror for use in this session ---
> Warning message:
> package ‘Bioconductor’ is not available (for R version 3.3.2)
> 
> 
> with many thanks
> abou
> __
> 
> 
> *AbouEl-Makarim Aboueissa, PhD*
> 
> *Professor, Statistics and Data Science*
> *Graduate Coordinator*
> 
> *Department of Mathematics and Statistics*
> *University of Southern Maine*
> 
> 
> 
> On Sun, Feb 10, 2019 at 10:52 AM Prof. Dr. Matthias Kohl <
> matthias.k...@stamats.de> wrote:
> 
>> Have a look at Bioconductor package genefilter, especially functions
>> colttests and colFtests.
>> Best Matthias
>> 
>> Am 10.02.19 um 10:35 schrieb AbouEl-Makarim Aboueissa:
>>> Dear All: good morning
>>> 
>>> 
>>> 
>>> 
>>> 
>>> *Re:* How to rum Multiple ANOVA and Multiple T-test between the same
>> groups.
>>> 
>>> 
>>> 
>>> Your help will be highly appreciated.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> *1.*  is there a way to run multiple t-tests on different variables
>> between
>>> the same two groups.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> *Data for t-tests:*
>>> 
>>> 
>>> 
>>> The data frame “dataTtest”  has 5 variables (x1,x2,x3,x4,x5) and one
>> factor
>>> (factor1) with 2 levels (group1, group2).
>>> 
>>> 
>>> 
>>> 
>>> 
>>> x1<-rnorm(20,1,1)
>>> 
>>> x2<-rnorm(20,2,1)
>>> 
>>> x3<-rnorm(20,3,1)
>>> 
>>> x4<-rnorm(20,4,1)
>>> 
>>> x5<-rnorm(20,5,1)
>>> 
>>> factor1<-rep(c("group1", "group2"), each = 10)
>>> 
>>> dataTtest<-data.frame(x1,x2,x3,x4,x5,factor1)
>>> 
>>> dataTtest
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> *2.* is there a way to run *multiple ANOVA* and multiple comparisons
>> *Tukey
>>> tests* on different variables between the same groups.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> *Data for ANOVA tests:*
>>> 
>>> 
>>> 
>>> The data frame “dataANOVA”  has 6 variables (x1,x2,x3,x4,x5,x6) and one
>>> factor (factor2) with 5 levels (group1, group2, group3, group4, group5).
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> x1<-rnorm(40,1,1)
>>> 
>>> x2<-rnorm(40,2,1)
>>> 
>>> x3<-rnorm(40,3,1)
>>> 
>>> x4<-rnorm(40,4,1)
>>> 
>>> x5<-rnorm(40,5,1)
>>> 
>>> x6<-rnorm(40,6,1)
>>> 
>>> factor2<-rep(c("group1", "group2", "group3", "group4", "group5"), each =
>> 8)
>>> 
>>> dataANOVA<-data.frame(x1,x2,x3,x4,x5,x6,factor2)
>>> 
>>> dataANOVA
>>> 
>>> 
>>> 
>>> 
>>> 
>>> with many thanks
>>> 
>>> abou
>>> __
>>> 
>>> 
>>> *AbouEl-Makarim Aboueissa, PhD*
>>> 
>>> *Professor, Statistics and Data Science*
>>> *Graduate Coordinator*
>>> 
>>> *Department of Mathematics and Statistics*
>>> *University of Southern Maine*
>>> 
>>>  [[alternative HTML version deleted]]
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>>> 
>> 
>> --
>> Prof. Dr. Matthias Kohl
>> www.stamats.de
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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.


Re: [R] How to rum Multiple ANOVA and Multiple T-test between the same groups?

2019-02-10 Thread AbouEl-Makarim Aboueissa
Dear Prof Kohl:


I am trying to install the "genefilter" package, but I got the following
error message(s). I am not sure which R version should be used for this
package.


*For R.3.5.2:*

> install.packages("genefilter")
Installing package into ‘C:/Users/aaboueissa/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning message:
package ‘genefilter’ is not available (for R version 3.5.2)


*For R.3.3.2:*

> install.packages("Bioconductor")
Installing package into ‘C:/Users/aaboueissa/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning message:
package ‘Bioconductor’ is not available (for R version 3.3.2)


with many thanks
abou
__


*AbouEl-Makarim Aboueissa, PhD*

*Professor, Statistics and Data Science*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*



On Sun, Feb 10, 2019 at 10:52 AM Prof. Dr. Matthias Kohl <
matthias.k...@stamats.de> wrote:

> Have a look at Bioconductor package genefilter, especially functions
> colttests and colFtests.
> Best Matthias
>
> Am 10.02.19 um 10:35 schrieb AbouEl-Makarim Aboueissa:
> > Dear All: good morning
> >
> >
> >
> >
> >
> > *Re:* How to rum Multiple ANOVA and Multiple T-test between the same
> groups.
> >
> >
> >
> > Your help will be highly appreciated.
> >
> >
> >
> >
> >
> > *1.*  is there a way to run multiple t-tests on different variables
> between
> > the same two groups.
> >
> >
> >
> >
> >
> > *Data for t-tests:*
> >
> >
> >
> > The data frame “dataTtest”  has 5 variables (x1,x2,x3,x4,x5) and one
> factor
> > (factor1) with 2 levels (group1, group2).
> >
> >
> >
> >
> >
> > x1<-rnorm(20,1,1)
> >
> > x2<-rnorm(20,2,1)
> >
> > x3<-rnorm(20,3,1)
> >
> > x4<-rnorm(20,4,1)
> >
> > x5<-rnorm(20,5,1)
> >
> > factor1<-rep(c("group1", "group2"), each = 10)
> >
> > dataTtest<-data.frame(x1,x2,x3,x4,x5,factor1)
> >
> > dataTtest
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > *2.* is there a way to run *multiple ANOVA* and multiple comparisons
> *Tukey
> > tests* on different variables between the same groups.
> >
> >
> >
> >
> >
> > *Data for ANOVA tests:*
> >
> >
> >
> > The data frame “dataANOVA”  has 6 variables (x1,x2,x3,x4,x5,x6) and one
> > factor (factor2) with 5 levels (group1, group2, group3, group4, group5).
> >
> >
> >
> >
> >
> >
> >
> > x1<-rnorm(40,1,1)
> >
> > x2<-rnorm(40,2,1)
> >
> > x3<-rnorm(40,3,1)
> >
> > x4<-rnorm(40,4,1)
> >
> > x5<-rnorm(40,5,1)
> >
> > x6<-rnorm(40,6,1)
> >
> > factor2<-rep(c("group1", "group2", "group3", "group4", "group5"), each =
> 8)
> >
> > dataANOVA<-data.frame(x1,x2,x3,x4,x5,x6,factor2)
> >
> > dataANOVA
> >
> >
> >
> >
> >
> > with many thanks
> >
> > abou
> > __
> >
> >
> > *AbouEl-Makarim Aboueissa, PhD*
> >
> > *Professor, Statistics and Data Science*
> > *Graduate Coordinator*
> >
> > *Department of Mathematics and Statistics*
> > *University of Southern Maine*
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> >
>
> --
> Prof. Dr. Matthias Kohl
> www.stamats.de
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] (no subject)

2019-02-10 Thread Adrian Johnson
Dear group,

I have two large matrices.

Matrix one: is 24776 x 76 (example toy1 dput object given below)

Matrix two: is 12913 x 76 (example toy2 dput object given below)

Column names of both matrices are identical.

My aim is:

a. Take each row of toy2 and transform vector into UP (>0)  and DN (
<0 ) categories. (kc)
b  Test association between kc and every row of toy1.

My code, given below, although this works but is very slow.

I gave dput objects for toy1, toy2 and result matrix.

Could you suggest/help me how I can make this faster.  Also, how can I
select values in result column that are less than 0.001 (p < 0.001).

Appreciate your help. Thank you.

Code:
===



result <- matrix(NA,nrow=nrow(toy1),ncol=nrow(toy2))

rownames(result) <- rownames(toy1)
colnames(result) <- rownames(toy2)

for(i in 1:nrow(toy2)){
for(j in 1:nrow(toy1)){
kx = toy2[i,]
kc <- rep('NC',length(kx))
kc[ kx >0] <- 'UP'
kc[ kx <=0 ] <- 'DN'
xpv <- fisher.test(table(kc,toy1[j,]),simulate.p.value = TRUE)$p.value
result[j,i] <- xpv
}
}

===


===


> dput(toy1)
structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1), .Dim = c(10L, 7L), .Dimnames = list(c("ACAP3",
"ACTRT2", "AGRN", "ANKRD65", "ATAD3A", "ATAD3B", "ATAD3C", "AURKAIP1",
"B3GALT6", "C1orf159"), c("a", "b", "c", "d", "e", "f", "g")))



> dput(toy2)
structure(c(-0.242891119688613, -0.0514058216682132, 0.138447212993773,
-0.312576648033122, 0.271489918720452, -0.281196468299486, -0.0407160143344565,
-0.328353812845287, 0.151667836674511, 0.408596843743938, -0.049351944902924,
0.238586287349249, 0.200571558784821, -0.0737604184858411, 0.245971526254877,
0.24740263959845, -0.161528943131908, 0.197521973013793, 0.0402668125708444,
0.376323735212088, 0.0731550871764204, 0.385270176969893, 0.28953042756208,
0.062587289401188, -0.281187168932979, -0.0202298984561554, -0.0848696970309447,
0.0349676726358973, -0.520484215644868, -0.481991414222996,
-0.00698099201388211,
0.135503878341873, 0.156983081312087, 0.320223832092661, 0.34582193394074,
0.0844455960468667, -0.157825604090972, 0.204758250510969, 0.261796072978612,
-0.19510450641405, 0.43196474472874, -0.211155577453175, -0.0921641871215187,
0.420950361292263, 0.390261862151936, -0.422273930504427, 0.344653684951627,
0.0378273248838503, 0.197782027324611, 0.0963124876309569, 0.332093167080656,
0.128036554821915, -0.41338065859335, -0.409470440033177, 0.371490567256253,
-0.0912549189140141, -0.247451812684234, 0.127741739114639, 0.0856254238844557,
0.515282940316031, -0.25675759521248, 0.333943163209869, 0.604141413840881,
0.0824942299510931, -0.179605710473021, -0.275604207054643, -0.113251154591898,
0.172897837449258, -0.329808795076691, -0.239255324324506), .Dim = c(10L,
7L), .Dimnames = list(c("chr5q23", "chr16q24", "chr8q24", "chr13q11",
"chr7p21", "chr10q23", "chr13q13", "chr10q21", "chr1p13", "chrxp21"
), c("a", "b", "c", "d", "e", "f", "g")))
>


> dput(result)
structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.532733633183408,
0.511244377811094, 0.528235882058971, 0.526736631684158, 0.51424287856072,
0.530734632683658, 0.513243378310845, 0.533233383308346, 0.542228885557221,
0.517241379310345, 0.532733633183408, 0.521739130434783, 0.529235382308846,
0.530234882558721, 0.548725637181409, 0.525737131434283, 0.527236381809095,
0.532733633183408, 0.530234882558721, 0.520739630184908, 0.15592203898051,
0.142928535732134, 0.140929535232384, 0.150924537731134, 0.160419790104948,
0.139430284857571, 0.152923538230885, 0.146426786606697, 0.149425287356322,
0.145427286356822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.282358820589705,
0.293853073463268, 0.262868565717141, 0.290854572713643, 0.276861569215392,
0.288855572213893, 0.282358820589705, 0.292853573213393, 0.286356821589205,
0.271364317841079, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1), .Dim = c(10L, 10L), .Dimnames = list(c("ACAP3",
"ACTRT2", "AGRN", "ANKRD65", "ATAD3A", "ATAD3B", "ATAD3C", "AURKAIP1",
"B3GALT6", "C1orf159"), c("chr5q23", "chr16q24", "chr8q24", "chr13q11",
"chr7p21", "chr10q23", "chr13q13", "chr10q21", "chr1p13", "chrxp21"
)))

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] (no subject)

2019-02-10 Thread Hasan Diwan
This is spam, right? -- H

On Sun, 10 Feb 2019 at 12:36, Diego Miro  wrote:

> 4 xxx ff
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>


-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] (no subject)

2019-02-10 Thread Diego Miro
4 xxx ff

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Unexpected errors in sparse Matrix arithmetic with zero-length dimensions

2019-02-10 Thread Aaron Lun
Dear list,

The Matrix package exhibits some unexpected behaviour in its arithmetic
methods for the edge case of a sparse matrix with a dimension of zero
length. The example below is the most illustrative, where changing the
contents of the vector causes the subtraction to fail for a sparse
matrix with no columns: 

> library(Matrix)
> x <- rsparsematrix(10, 0, density=0.1)
> 
> x - rep(1, nrow(x)) # OK 
> x - rep(0, nrow(x)) # fails
Error in .Ops.recycle.ind(e1, len = l2) : 
  vector too long in Matrix - vector operation

This is presumably because Matrix recognizes that subtraction of zero
preserves sparsity and thus uses a different method in the second case.
However, I would have expected subtraction of a zero vector to work if
subtraction of a general vector is permissible. This is accompanied by
a host of related errors for sparsity-preserving arithmetic:

> x / 1 # OK
> x / rep(1, nrow(x)) # fails 
Error in .Ops.recycle.ind(e1, len = l2) : 
  vector too long in Matrix - vector operation
> 
> x * 1 # OK
> x * rep(1, nrow(x)) # fails
Error in .Ops.recycle.ind(e1, len = l2) : 
  vector too long in Matrix - vector operation
  
A different error is raised for a sparse matrix with no rows:

> y <- rsparsematrix(0, 10, density=0.1)
> 
> y - numeric(1) # OK
> y - numeric(0) # fails
Error in y - numeric(0) :  - numeric(0) is undefined

I would have expected to just get 'y' back, given that the same code
works fine for other Matrix classes:

> z <- as(y, "dgeMatrix")
> z - numeric(0) # OK

Correct behaviour of zero-dimension sparse matrices is practically
important to me; I develop a number of packages that rely on Matrix
classes, and in those packages, I do a lot of unit testing with zero-
dimension inputs. This ensures that my functions return sensible
results or fail gracefully in edge cases that might be encountered by
users. The current behaviour of sparse Matrix arithmetic causes my unit
tests to fail for no (obvious) good reason.

Best,

Aaron Lun

Research Associate
CRUK Cambridge Institute
University of Cambridge

> sessionInfo()
R Under development (unstable) (2019-01-14 r75992)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

Matrix products: default
BLAS: /home/cri.camres.org/lun01/Software/R/trunk/lib/libRblas.so
LAPACK: /home/cri.camres.org/lun01/Software/R/trunk/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C  
 [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8   LC_NAME=C 
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats graphics  grDevices
utils datasets  methods   base 

other attached packages:
[1] Matrix_1.2-15

loaded via a namespace (and not attached):
[1] compiler_3.6.0  grid_3.6.0  lattice_0.20-38

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] How to rum Multiple ANOVA and Multiple T-test between the same groups?

2019-02-10 Thread Prof. Dr. Matthias Kohl
Have a look at Bioconductor package genefilter, especially functions 
colttests and colFtests.

Best Matthias

Am 10.02.19 um 10:35 schrieb AbouEl-Makarim Aboueissa:

Dear All: good morning





*Re:* How to rum Multiple ANOVA and Multiple T-test between the same groups.



Your help will be highly appreciated.





*1.*  is there a way to run multiple t-tests on different variables between
the same two groups.





*Data for t-tests:*



The data frame “dataTtest”  has 5 variables (x1,x2,x3,x4,x5) and one factor
(factor1) with 2 levels (group1, group2).





x1<-rnorm(20,1,1)

x2<-rnorm(20,2,1)

x3<-rnorm(20,3,1)

x4<-rnorm(20,4,1)

x5<-rnorm(20,5,1)

factor1<-rep(c("group1", "group2"), each = 10)

dataTtest<-data.frame(x1,x2,x3,x4,x5,factor1)

dataTtest









*2.* is there a way to run *multiple ANOVA* and multiple comparisons *Tukey
tests* on different variables between the same groups.





*Data for ANOVA tests:*



The data frame “dataANOVA”  has 6 variables (x1,x2,x3,x4,x5,x6) and one
factor (factor2) with 5 levels (group1, group2, group3, group4, group5).







x1<-rnorm(40,1,1)

x2<-rnorm(40,2,1)

x3<-rnorm(40,3,1)

x4<-rnorm(40,4,1)

x5<-rnorm(40,5,1)

x6<-rnorm(40,6,1)

factor2<-rep(c("group1", "group2", "group3", "group4", "group5"), each = 8)

dataANOVA<-data.frame(x1,x2,x3,x4,x5,x6,factor2)

dataANOVA





with many thanks

abou
__


*AbouEl-Makarim Aboueissa, PhD*

*Professor, Statistics and Data Science*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



--
Prof. Dr. Matthias Kohl
www.stamats.de

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Randomization Test

2019-02-10 Thread Ogbos Okike
Dear Michael,
This is great! Thank you.

I have not really got any response other than yours.

I have long before now included what I have in a paper submitted to a journal.

I am awaiting the feedback of the reviewer. I will compare the
comments with your input here and determine the corrections to make
and probably return to the list for additional help.

Best wishes
Ogbos

On Fri, Feb 8, 2019 at 4:31 PM Meyners, Michael  wrote:
>
> Ogbos,
>
> You do not seem to have received a reply over the list yet, which might be 
> due to the fact that this seems rather a stats than an R question. Neither 
> got your attachment (Figure) through - see posting guide.
>
> I'm not familiar with epoch analysis, so not sure what exactly you are doing 
> / trying to achieve, but some general thoughts:
>
> * You do NOT want to restrict your re-randomizations in a way that "none of 
> the dates corresponds with the ones in the real event" - actually, as a 
> general principle, the true data must be an admissible re-randomization as 
> well. You seem to have excluded that (and a lot of other randomizations at 
> the same time which might have occurred, i.e. dates 1 and 2 reversed but all 
> others the same), thereby rendering the test invalid. Any restrictions you 
> have on your re-randomizations must've applied to the original randomization 
> as well.
> * If you have rather observational data (which I suspect, but not sure), 
> Edgington & Onghena (2007) would rather refer to this as a permutation test - 
> the difference being that you have to make strong assumptions (similar to 
> parametric tests) on the nature of the data, which are designed-in to be true 
> for randomization tests. It might be a merely linguistic discrimination, but 
> it is important to note which assumptions have to be (implicitly) made.
> * I'm not sure what you mean by "mean differences" of the events - is that 
> two groups you are comparing? If so, that seems reasonable, but just make 
> sure the test statistic you use is reasonable and sensitive against the 
> alternatives you are mostly interested in. The randomization/permutation test 
> will never proof that, e.g., means are significantly different, but only that 
> there is SOME difference. By selecting the appropriate test statistic, you 
> can influence what will pop up more easily and what not, but you can never be 
> sure (unless you make strong assumptions about everything else, like in many 
> parametric tests).
> * For any test statistic, you would then determine the proportion of its 
> values among the 5000 samples where it is as large or larger than the one 
> observed (or as small or smaller, or either, depending on the nature of the 
> test statistic and whether you aim for a one- or a two-sided test). That is 
> your p value. If small enough, conclude significance. At least conceptually 
> important: The observed test statistic is always part of the re-randomization 
> (i.e. your 5000) - so you truly only do 4999 plus the one you observed. 
> Otherwise the test may be more or less liberal. Your p value is hence no 
> smaller than 1/n, where n is the total number of samples you looked at 
> (including the observed one), a p value of 0 is not possible in randomization 
> tests (nor in other tests, of course).
>
> I hope this is helpful, but you will need to go through these and refer to 
> your own setup to check whether you adhered to the principles or not, which 
> is impossible for me to judge based on the information provided (and I won't 
> be able to look at excessive code to check either).
>
> Michael
>
> > -Original Message-
> > From: R-help  On Behalf Of Ogbos Okike
> > Sent: Montag, 28. Januar 2019 19:42
> > To: r-help 
> > Subject: [R] Randomization Test
> >
> > Dear Contributors,
> >
> > I conducting epoch analysis. I tried to test the significance of my result 
> > using
> > randomization test.
> >
> > Since I have 71 events, I randomly selected another 71 events, making sure
> > that none of the dates in the random events corresponds with the ones in
> > the real event.
> >
> > Following the code I found here
> > (https://www.uvm.edu/~dhowell/StatPages/R/RandomizationTestsWithR/R
> > andom2Sample/TwoIndependentSamplesR.html),
> > I combined these two data set and used them to generate another 5000
> > events. I then plotted the graph of the mean differences for the 5000
> > randomly generated events. On the graph, I indicated the region of the
> > mean difference between the real 71 epoch and the randomly selected 71
> > epoch.
> >
> > Since the two tail test shows that the mean difference falls at the extreme 
> > of
> > the randomly selected events, I concluded that my result is statistically
> > significant.
> >
> >
> >
> > I am attaching the graph to assistance you in you suggestions.
> >
> > I can attach both my code and the real and randomly generated events if you
> > ask for it.
> >
> > My request is that you help me to understand if I am on the righ

[R] How to rum Multiple ANOVA and Multiple T-test between the same groups?

2019-02-10 Thread AbouEl-Makarim Aboueissa
Dear All: good morning





*Re:* How to rum Multiple ANOVA and Multiple T-test between the same groups.



Your help will be highly appreciated.





*1.*  is there a way to run multiple t-tests on different variables between
the same two groups.





*Data for t-tests:*



The data frame “dataTtest”  has 5 variables (x1,x2,x3,x4,x5) and one factor
(factor1) with 2 levels (group1, group2).





x1<-rnorm(20,1,1)

x2<-rnorm(20,2,1)

x3<-rnorm(20,3,1)

x4<-rnorm(20,4,1)

x5<-rnorm(20,5,1)

factor1<-rep(c("group1", "group2"), each = 10)

dataTtest<-data.frame(x1,x2,x3,x4,x5,factor1)

dataTtest









*2.* is there a way to run *multiple ANOVA* and multiple comparisons *Tukey
tests* on different variables between the same groups.





*Data for ANOVA tests:*



The data frame “dataANOVA”  has 6 variables (x1,x2,x3,x4,x5,x6) and one
factor (factor2) with 5 levels (group1, group2, group3, group4, group5).







x1<-rnorm(40,1,1)

x2<-rnorm(40,2,1)

x3<-rnorm(40,3,1)

x4<-rnorm(40,4,1)

x5<-rnorm(40,5,1)

x6<-rnorm(40,6,1)

factor2<-rep(c("group1", "group2", "group3", "group4", "group5"), each = 8)

dataANOVA<-data.frame(x1,x2,x3,x4,x5,x6,factor2)

dataANOVA





with many thanks

abou
__


*AbouEl-Makarim Aboueissa, PhD*

*Professor, Statistics and Data Science*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.