Question: Analysis using a linear model
0
gravatar for libya.tahani
3.7 years ago by
Libyan Arab Jamahiriya
libya.tahani0 wrote:

Hello,

While I Analysis data using a linear model , I faced the following error in lmfit !!

any advice please?

.....................................................................................

fit<-lmFit(dat.m, design)
Error in lmFit(dat.m, design) : 
  row dimension of design doesn't match column dimension of data object

regards,

Tahani,

 

lmfit • 1.8k views
ADD COMMENTlink modified 3.6 years ago by Gordon Smyth37k • written 3.7 years ago by libya.tahani0
Answer: Analysis using a linear model
1
gravatar for Gordon Smyth
3.6 years ago by
Gordon Smyth37k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth37k wrote:

Tahani,

The error message already tells you what the problem is, and there isn't much more that we can say.

The design matrix "design" is supposed to have a row for each column of the data matrix "dat.m", but it doesn't. Type

dim(dat.m)
dim(design)

and you will immediately see the problem.

Gordon

ADD COMMENTlink written 3.6 years ago by Gordon Smyth37k

Gordon,

Thanks for reply, but do you mean that dim(dat.m) should be equal with dim(design) ?

In my work :

> dim(dat.m)
[1] 1354896       9

> dim(design)
[1] 1354896      10

how could I fix it to get lmfit??

Tahani,

ADD REPLYlink modified 3.6 years ago by Gordon Smyth37k • written 3.6 years ago by libya.tahani0
1

Your dataset (dat.m) has 9 columns (i.e., 9 libraries) but your design has 1354896 rows. Clearly, you have set up design incorrectly - it should have 9 rows, one for each library, and less than 9 columns (one for each coefficient of the model, which should be less than the number of libraries if you want to estimate the variance properly). If you want more advice, you'll have to give more details on your experimental setup, because this is not an issue that can be fixed by lmFit.

ADD REPLYlink modified 3.6 years ago • written 3.6 years ago by Aaron Lun24k

Hi Aaron Lun,

Thanks for reply. my codes of my experimental setup as the following :

 

>getwd()
>library(affy)
>dat<-ReadAffy()
>dat

 

AffyBatch object
size of arrays=1164x1164 features (20 kb)
cdf=HG-U133_Plus_2 (54675 affyids)
number of samples=9
number of genes=54675
annotation=hgu133plus2
notes=

 

>dat2<-rma(dat)
>dat2

 

ExpressionSet (storageMode: lockedEnvironment)
assayData: 54675 features, 9 samples
  element names: exprs
protocolData
  sampleNames: GSM679719.CEL GSM679720.CEL ... GSM679727.CEL (9 total)
  varLabels: ScanDate
  varMetadata: labelDescription
phenoData
  sampleNames: GSM679719.CEL GSM679720.CEL ... GSM679727.CEL (9 total)
  varLabels: sample
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation: hgu133plus2 

 

>dat.m<-exprs(dat)
>dat.m
>dim(dat.m)
>write.table(dat.m, "matrix.txt", sep="\t")
>AffyRNAdeg(dat)
>library(simpleaffy)
>qc(dat)
>aqc<-qc(dat)
>deg<-AffyRNAdeg(dat)
>plot(aqc)
>library(genefilter)
>rsd<-rowSds(dat.m)
>rsd
>i<-rsd>=2
>i
>dat.f<-dat.m[i,]
>dat.f
>ff<-pOverA(A=1 ,p=0.5)
>i<-genefilter(dat.m, ff)
>dat.fo<-dat.m[i,]
>ff<-pOverA(A=1, p=0.5)
>i<-genefilter(-dat.m, ff)
>dat.fu<-dat.m[i,]
>dat.f<-rbinddat.fo, dat.fu)
>dat.f

I think there is some mistakes in the next step:

>ZZ<-as.factor(dat.m)

>design<-model.matrix(~ZZ)

>fit<-lmFit(dat.m, design)

 

Error in lmFit(dat.m, design) : 
  row dimension of design doesn't match column dimension of data object

 

ADD REPLYlink modified 3.6 years ago • written 3.6 years ago by libya.tahani0

Using ZZ to construct the design matrix makes no sense. The design matrix should be holding information about the experimental design (e.g., treated or untreated, cell types), and should not be dependent on the observed expression values (advanced applications excepted, e.g., when estimating batch effects). A brief look at the GEO accessions for the files (GSM679719, GSM679720, and so on) indicates that you've got a data set with three different breast cancer cell lines, with three samples for each of the cell lines. So, perhaps a good start might be:

cell.lines <- factor(rep(c("B6TC", "MDA231", "ZR75"), each=3))
design <- model.matrix(~ cell.lines)

The first coefficient will represent the average expression of the B6TC cell line, while the second and third coefficients will represent the log-fold change of the next two cell lines relative to the B6TC 'baseline'. This should be enough to get you going - check out the limma user's guide for more details on how to parametrize the design and DE contrasts.

ADD REPLYlink modified 3.6 years ago by Gordon Smyth37k • written 3.6 years ago by Aaron Lun24k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 162 users visited in the last hour