Problem with lmfit
2
0
Entering edit mode
David ▴ 860
@david-3335
Last seen 6.0 years ago
Hello, I have a strange problem while fitting a design to my data. Here is the output code. You can reproduce the problem by copy paste the code below. > design HEALTHY DISEASE 1 1 0 2 1 0 3 1 0 4 1 0 5 1 0 6 0 1 7 0 1 attr(,"assign") [1] 1 1 attr(,"contrasts") attr(,"contrasts")$groups [1] "contr.treatment" > exprs(mydata.eset) healthy1 healthy2 healthy3 healthy4 N25 disease1 disease2 1 25.92 25.66667 23.14667 26.28667 25.48667 21.19 20.81 > lmFit(exprs(mydata.eset), design=design) Error in fit$effects[(fit$rank + 1):narrays, , drop = FALSE] : incorrect number of dimensions ### Here is the code to reproduce the error library(Biobase) library(limma) design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) design <- rbind(design,c(0,1),c(0,1)) colnames(design) <- c("HEALTHY","DISEASE") data <- matrix(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 ,21.19000, 20.81000),nrow=1,ncol=7) mydata.eset=new("ExpressionSet",exprs=data) colnames(exprs(mydata.eset)) <- c("healthy1","healthy2","healthy3","healthy4","healthy5","disease1","d isease2") lmFit(mydata.eset, design=design) thanks for leting me know,
• 1.1k views
ADD COMMENT
0
Entering edit mode
@paolo-innocenti-2191
Last seen 9.6 years ago
Hi, I can reproduce the error, which seems to be caused by your expressionset having only one feature. If you try with 2 lines, it works: library(Biobase) library(limma) design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) design <- rbind(design,c(0,1),c(0,1)) colnames(design) <- c("HEALTHY","DISEASE") # 2 (identical) features data <- matrix(rep(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 ,21.19000, 20.81000),2),nrow=2,ncol=7, byrow=T) mydata.eset=new("ExpressionSet",exprs=data) lmFit(mydata.eset, design=design) I have no idea if lmFit is meant to work with 1 feature (I guess it yield the same result as "lm"), but the error seem to be caused by the function "nonEstimable" called by limma (but I am no expert, someone else might want to comment on this). Hope this helps. paolo # lm code: y <- c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 ,21.19000, 20.81000) treat <- factor(c(rep("healthy",5),rep("dis",2))) summary(lm(y ~ treat)) On 08/09/2010 02:59 PM, David martin wrote: > Hello, > I have a strange problem while fitting a design to my data. Here is the > output code. You can reproduce the problem by copy paste the code below. > > > > design > HEALTHY DISEASE > 1 1 0 > 2 1 0 > 3 1 0 > 4 1 0 > 5 1 0 > 6 0 1 > 7 0 1 > attr(,"assign") > [1] 1 1 > attr(,"contrasts") > attr(,"contrasts")$groups > [1] "contr.treatment" > > > exprs(mydata.eset) > healthy1 healthy2 healthy3 healthy4 N25 disease1 disease2 > 1 25.92 25.66667 23.14667 26.28667 25.48667 21.19 20.81 > > > lmFit(exprs(mydata.eset), design=design) > Error in fit$effects[(fit$rank + 1):narrays, , drop = FALSE] : > incorrect number of dimensions > > > ### Here is the code to reproduce the error > library(Biobase) > library(limma) > design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) > design <- rbind(design,c(0,1),c(0,1)) > colnames(design) <- c("HEALTHY","DISEASE") > data <- matrix(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 > ,21.19000, 20.81000),nrow=1,ncol=7) > mydata.eset=new("ExpressionSet",exprs=data) > colnames(exprs(mydata.eset)) <- > c("healthy1","healthy2","healthy3","healthy4","healthy5","disease1", "disease2") > > lmFit(mydata.eset, design=design) > > > thanks for leting me know, > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Paolo Innocenti Department of Animal Ecology, EBC Uppsala University Norbyv?gen 18D 75236 Uppsala, Sweden
ADD COMMENT
0
Entering edit mode
Thanks Paolo, You are indeed right, limma is behaving strange with only 1 feature. The thing is that i'm testing a single gene over a large panel of samples (this is only a subset).. thanks for letting me know On 09/08/10 15:29, Paolo Innocenti wrote: > Hi, > > I can reproduce the error, which seems to be caused by your > expressionset having only one feature. If you try with 2 lines, it works: > > library(Biobase) > library(limma) > design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) > design <- rbind(design,c(0,1),c(0,1)) > colnames(design) <- c("HEALTHY","DISEASE") > > # 2 (identical) features > > data <- matrix(rep(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 > ,21.19000, 20.81000),2),nrow=2,ncol=7, byrow=T) > mydata.eset=new("ExpressionSet",exprs=data) > lmFit(mydata.eset, design=design) > > I have no idea if lmFit is meant to work with 1 feature (I guess it > yield the same result as "lm"), but the error seem to be caused by the > function "nonEstimable" called by limma (but I am no expert, someone > else might want to comment on this). > > Hope this helps. > paolo > > # lm code: > y <- c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 ,21.19000, > 20.81000) > treat <- factor(c(rep("healthy",5),rep("dis",2))) > summary(lm(y ~ treat)) > > > On 08/09/2010 02:59 PM, David martin wrote: >> Hello, >> I have a strange problem while fitting a design to my data. Here is the >> output code. You can reproduce the problem by copy paste the code below. >> >> >> > design >> HEALTHY DISEASE >> 1 1 0 >> 2 1 0 >> 3 1 0 >> 4 1 0 >> 5 1 0 >> 6 0 1 >> 7 0 1 >> attr(,"assign") >> [1] 1 1 >> attr(,"contrasts") >> attr(,"contrasts")$groups >> [1] "contr.treatment" >> >> > exprs(mydata.eset) >> healthy1 healthy2 healthy3 healthy4 N25 disease1 disease2 >> 1 25.92 25.66667 23.14667 26.28667 25.48667 21.19 20.81 >> >> > lmFit(exprs(mydata.eset), design=design) >> Error in fit$effects[(fit$rank + 1):narrays, , drop = FALSE] : >> incorrect number of dimensions >> >> >> ### Here is the code to reproduce the error >> library(Biobase) >> library(limma) >> design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) >> design <- rbind(design,c(0,1),c(0,1)) >> colnames(design) <- c("HEALTHY","DISEASE") >> data <- matrix(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 >> ,21.19000, 20.81000),nrow=1,ncol=7) >> mydata.eset=new("ExpressionSet",exprs=data) >> colnames(exprs(mydata.eset)) <- >> c("healthy1","healthy2","healthy3","healthy4","healthy5","disease1" ,"disease2") >> >> >> lmFit(mydata.eset, design=design) >> >> >> thanks for leting me know, >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >
ADD REPLY
0
Entering edit mode
@gordon-smyth
Last seen 20 minutes ago
WEHI, Melbourne, Australia
Dear David, limma doesn't work with only one gene. In principle, it should give the same results as lm when there is only one row of data. In practice, it fails for a purely technical programming issue -- R by default converts single row matrices into vectors, and this confuses limma which is expecting to get matrices. We could fix this, but no one has ever asked for it before! Best wishes Gordon > Date: Mon, 09 Aug 2010 15:50:33 +0200 > From: David martin <vilanew at="" gmail.com=""> > To: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Problem with lmfit > Message-ID: <i3p14l$unk$2 at="" dough.gmane.org=""> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Thanks Paolo, > You are indeed right, limma is behaving strange with only 1 feature. The > thing is that i'm testing a single gene over a large panel of samples > (this is only a subset).. > thanks for letting me know > > On 09/08/10 15:29, Paolo Innocenti wrote: >> Hi, >> >> I can reproduce the error, which seems to be caused by your >> expressionset having only one feature. If you try with 2 lines, it works: >> >> library(Biobase) >> library(limma) >> design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) >> design <- rbind(design,c(0,1),c(0,1)) >> colnames(design) <- c("HEALTHY","DISEASE") >> >> # 2 (identical) features >> >> data <- matrix(rep(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 >> ,21.19000, 20.81000),2),nrow=2,ncol=7, byrow=T) >> mydata.eset=new("ExpressionSet",exprs=data) >> lmFit(mydata.eset, design=design) >> >> I have no idea if lmFit is meant to work with 1 feature (I guess it >> yield the same result as "lm"), but the error seem to be caused by the >> function "nonEstimable" called by limma (but I am no expert, someone >> else might want to comment on this). >> >> Hope this helps. >> paolo >> >> # lm code: >> y <- c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 ,21.19000, >> 20.81000) >> treat <- factor(c(rep("healthy",5),rep("dis",2))) >> summary(lm(y ~ treat)) >> >> >> On 08/09/2010 02:59 PM, David martin wrote: >>> Hello, >>> I have a strange problem while fitting a design to my data. Here is the >>> output code. You can reproduce the problem by copy paste the code below. >>> >>> >>>> design >>> HEALTHY DISEASE >>> 1 1 0 >>> 2 1 0 >>> 3 1 0 >>> 4 1 0 >>> 5 1 0 >>> 6 0 1 >>> 7 0 1 >>> attr(,"assign") >>> [1] 1 1 >>> attr(,"contrasts") >>> attr(,"contrasts")$groups >>> [1] "contr.treatment" >>> >>>> exprs(mydata.eset) >>> healthy1 healthy2 healthy3 healthy4 N25 disease1 disease2 >>> 1 25.92 25.66667 23.14667 26.28667 25.48667 21.19 20.81 >>> >>>> lmFit(exprs(mydata.eset), design=design) >>> Error in fit$effects[(fit$rank + 1):narrays, , drop = FALSE] : >>> incorrect number of dimensions >>> >>> >>> ### Here is the code to reproduce the error >>> library(Biobase) >>> library(limma) >>> design <- matrix(c(1,0),ncol=2,nrow=5,byrow=T) >>> design <- rbind(design,c(0,1),c(0,1)) >>> colnames(design) <- c("HEALTHY","DISEASE") >>> data <- matrix(c(25.92000, 25.66667, 23.14667, 26.28667, 25.48667 >>> ,21.19000, 20.81000),nrow=1,ncol=7) >>> mydata.eset=new("ExpressionSet",exprs=data) >>> colnames(exprs(mydata.eset)) <- >>> c("healthy1","healthy2","healthy3","healthy4","healthy5","disease1 ","disease2") >>> >>> >>> lmFit(mydata.eset, design=design) >>> >>> >>> thanks for leting me know, ______________________________________________________________________ The information in this email is confidential and intend...{{dropped:4}}
ADD COMMENT

Login before adding your answer.

Traffic: 676 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6