[BioC] weights in fitLM

Gordon K Smyth smyth at wehi.EDU.AU
Fri Apr 27 21:11:00 CEST 2007


Dear Nat,

> Date: Thu, 26 Apr 2007 10:15:00 +0100
> From: "Street N.R." <N.R.STREET at soton.ac.uk>
> Subject: [BioC] weights in fitLM
> To: <bioconductor at stat.math.ethz.ch>
>
> Hi
>
> I recently upgraded to R 2.4.1 and ran biocLite to install the Bioconductor packages. This
> installs version 2.9.17 of limma. I also have my old version of R (2.1.1 which has version 2.3.3
> of limma).
>
> When I run
>
> fit.O2<-lmFit(MA[isGene,], design.O2, weights=w)
>
> in R 2.4.1 I get the error message
>
> Error in asMatrixWeights(weights, dim(M)) :
>         weights is of unexpected shape

Well, the error message is already telling you what the problem is.  You weights matrix is a
different size to your data, which you can confirm by typing

   dim(w)
   dim(MA[isGene,])

It appears from the code you give that you've subsetted your data using isGene but haven't
subsetted the weights matrix in the corresponding way.  You probably need weights=w[isGene,].

This sort of error is something you should work towards trying to debug yourself.  The error code
suggests the problem, then you look closer at the arguments to see what the specific problem is.

> but this works fine in R 2.1.1

Well, not fine, it just didn't give you an error message.  It would appear that the more recent
version has done you a favour by picking up your error.

> This is how I made my weights matrix:
>
> w<-modifyWeights(RG$weights,RG$genes$status,values=c("Cy3_oligo","Cy5_oligo"), multipliers=0)
>
> excluded.spots<-spottypes[,1][spottypes[,1]!="cDNA"]
> w<-modifyWeights(RG$weights,RG$genes$status,values=excluded.spots, multipliers=0)
> # and then set anything with a weight of 0.1 to a value of 0
> w[,][w[,]=="0.1"]<-0

This seems convoluted.  Why set weights to 0.1 in the first place if you really want them to be zero?

Best wishes
Gordon

> the last four lines are using information from the spot types file.
>
> Can anyone tell me why this is happening? I really need the spot weights to be used.
>
> Thanks
>
> Nat Street
> ---
> Nathaniel Street
> ???????? University of Southampton
> ???????? Plants and Environment Lab
> ????? School of Biological Sciences
> ?? Basset Crescent East
> ?? Southampton
> ?SO16 7PX
> ?????? tel: +44 (0) 2380 594268
> ? fax: +44 (0) 2380 594269
> ?n.r.street at soton.ac.uk
>
> ??? http://www.populus.biol.soton.ac.uk/~nat
> http://del.icio.us/n.r.street



More information about the Bioconductor mailing list