limma lmFit returns different results on different computers
1
0
Entering edit mode
Guest User ★ 13k
@guest-user-4897
Last seen 10.3 years ago
I run the same program code on my laptop and on server and got different results. I found that the problem occured when I run lmFit(). I output parameters for this function and they are same on both computers, but result differs. Here is fragment of my code: ... group_names <- rep("0",length(clusters)) group_names[which(clusters %in% g)] <- "CT1" group_names[which(!(clusters %in% g))] <- "Other" names(group_names) <- group_names group_names <- factor(group_names) expr_matrix <- if (!is_log) { log2(expr) # do log transformation } else { expr } design <- model.matrix(~0+group_names) colnames(design) <- levels(group_names) colnames(expr_matrix) <- group_names print(design) print(head(expr_matrix)) print(tail(expr_matrix)) fit <- lmFit(expr_matrix, design) print(head(fit)) Last command returns me on laptop: An object of class "MArrayLM" $coefficients CT1 Other 226151_x_at 9.798801 9.317917 1552701_a_at 8.681497 8.624071 1554471_a_at 8.966830 8.452752 224703_at 9.652549 9.558388 202106_at 9.139795 8.852839 218515_at 10.088242 10.116507 and on server: An object of class "MArrayLM" $coefficients CT1 Other 226151_x_at 9.798801 9.317231 1552701_a_at 8.681497 8.624118 1554471_a_at 8.966830 8.472994 224703_at 9.652549 9.558388 202106_at 9.139795 8.869085 218515_at 10.088242 10.116605 Second collumn is slightly different in this cases. I thought that I had different versions of limma package but sessionInfo() shows me that all attached packages are similiar including limma (limma_3.18.10). Any thoughts what could it be? -- output of sessionInfo(): laptop: > sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C LC_TIME=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] compiler parallel stats graphics grDevices utils datasets methods base other attached packages: [1] corpcor_1.6.6 preprocessCore_1.24.0 limma_3.18.10 BiocInstaller_1.12.0 CellMix_1.6.1 GSEABase_1.24.0 graph_1.40.1 [8] annotate_1.40.0 AnnotationDbi_1.24.0 stringr_0.6.2 csSAM_1.2.4 NMF_0.20 cluster_1.14.4 rngtools_1.2.3 [15] pkgmaker_0.17.4 registry_0.2 Biobase_2.22.0 BiocGenerics_0.8.0 loaded via a namespace (and not attached): [1] beeswarm_0.1.6 bibtex_0.3-6 codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 dichromat_2.0-0 digest_0.6.4 doParallel_1.0.6 foreach_1.4.1 [10] genefilter_1.44.0 ggplot2_0.9.3.1 grid_3.0.2 gridBase_0.4-6 gtable_0.1.2 gtools_3.2.1 IRanges_1.20.6 iterators_1.0.6 labeling_0.2 [19] limSolve_1.5.5 lpSolve_5.6.7 MASS_7.3-29 matrixStats_0.8.14 munsell_0.4.2 plyr_1.8 proto_0.3-10 quadprog_1.5-5 RColorBrewer_1.0-5 [28] reshape2_1.2.2 R.methodsS3_1.6.1 RSQLite_0.11.4 scales_0.2.3 splines_3.0.2 stats4_3.0.2 survival_2.37-7 tools_3.0.2 XML_3.98-1.1 [37] xtable_1.7-1 server: > sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C [3] LC_TIME=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 [5] LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] compiler parallel stats graphics grDevices utils datasets [8] methods base other attached packages: [1] corpcor_1.6.6 preprocessCore_1.24.0 limma_3.18.10 [4] CellMix_1.6.1 GSEABase_1.24.0 graph_1.40.1 [7] annotate_1.40.0 AnnotationDbi_1.24.0 stringr_0.6.2 [10] csSAM_1.2.4 NMF_0.20 cluster_1.14.4 [13] rngtools_1.2.3 pkgmaker_0.17.4 registry_0.2 [16] Biobase_2.22.0 BiocGenerics_0.8.0 loaded via a namespace (and not attached): [1] beeswarm_0.1.6 bibtex_0.3-6 BiocInstaller_1.12.0 [4] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 [7] dichromat_2.0-0 digest_0.6.4 doParallel_1.0.6 [10] foreach_1.4.1 genefilter_1.44.0 ggplot2_0.9.3.1 [13] grid_3.0.2 gridBase_0.4-6 gtable_0.1.2 [16] gtools_3.2.1 IRanges_1.20.6 iterators_1.0.6 [19] labeling_0.2 limSolve_1.5.5 lpSolve_5.6.7 [22] MASS_7.3-29 matrixStats_0.8.14 munsell_0.4.2 [25] plyr_1.8 proto_0.3-10 quadprog_1.5-5 [28] R.methodsS3_1.6.1 RColorBrewer_1.0-5 reshape2_1.2.2 [31] RSQLite_0.11.4 scales_0.2.3 splines_3.0.2 [34] stats4_3.0.2 survival_2.37-7 tools_3.0.2 [37] XML_3.98-1.1 xtable_1.7-1 -- Sent via the guest posting facility at bioconductor.org.
limma limma • 616 views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 57 minutes ago
WEHI, Melbourne, Australia
This is not to with limma. To get the linear model coefficients, limma calls lm.fit() from the stats package. The fact is that not all of the underlying numerical routines in R give exactly the same results on different computer architectures. The difference is so small that it doesn't seem a serious problem to me. Indeed, it could be that your numbers are already different before they are input to limma. Have you checked that? Gordon > Date: Tue, 4 Feb 2014 14:49:42 -0800 (PST) > From: "Pavel Fedotov [guest]" <guest at="" bioconductor.org=""> > To: bioconductor at r-project.org, pavelph at ya.ru > Subject: [BioC] limma lmFit returns different results on different > computers > > > I run the same program code on my laptop and on server and got different results. I found that the problem occured when I run > lmFit(). I output parameters for this function and they are same on both computers, but result differs. > Here is fragment of my code: > ... > group_names <- rep("0",length(clusters)) > group_names[which(clusters %in% g)] <- "CT1" > group_names[which(!(clusters %in% g))] <- "Other" > names(group_names) <- group_names > group_names <- factor(group_names) > > expr_matrix <- if (!is_log) { > log2(expr) # do log transformation > } else { > expr > } > > design <- model.matrix(~0+group_names) > colnames(design) <- levels(group_names) > colnames(expr_matrix) <- group_names > > print(design) > print(head(expr_matrix)) > print(tail(expr_matrix)) > > fit <- lmFit(expr_matrix, design) > > print(head(fit)) > > Last command returns me on laptop: > > An object of class "MArrayLM" > $coefficients > CT1 Other > 226151_x_at 9.798801 9.317917 > 1552701_a_at 8.681497 8.624071 > 1554471_a_at 8.966830 8.452752 > 224703_at 9.652549 9.558388 > 202106_at 9.139795 8.852839 > 218515_at 10.088242 10.116507 > > and on server: > > An object of class "MArrayLM" > $coefficients > CT1 Other > 226151_x_at 9.798801 9.317231 > 1552701_a_at 8.681497 8.624118 > 1554471_a_at 8.966830 8.472994 > 224703_at 9.652549 9.558388 > 202106_at 9.139795 8.869085 > 218515_at 10.088242 10.116605 > > Second collumn is slightly different in this cases. > I thought that I had different versions of limma package but sessionInfo() shows me that all attached packages are similiar including limma (limma_3.18.10). > > Any thoughts what could it be? > > -- output of sessionInfo(): > > laptop: >> sessionInfo() > R version 3.0.2 (2013-09-25) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C LC_TIME=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 > [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] compiler parallel stats graphics grDevices utils datasets methods base > > other attached packages: > [1] corpcor_1.6.6 preprocessCore_1.24.0 limma_3.18.10 BiocInstaller_1.12.0 CellMix_1.6.1 GSEABase_1.24.0 graph_1.40.1 > [8] annotate_1.40.0 AnnotationDbi_1.24.0 stringr_0.6.2 csSAM_1.2.4 NMF_0.20 cluster_1.14.4 rngtools_1.2.3 > [15] pkgmaker_0.17.4 registry_0.2 Biobase_2.22.0 BiocGenerics_0.8.0 > > loaded via a namespace (and not attached): > [1] beeswarm_0.1.6 bibtex_0.3-6 codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 dichromat_2.0-0 digest_0.6.4 doParallel_1.0.6 foreach_1.4.1 > [10] genefilter_1.44.0 ggplot2_0.9.3.1 grid_3.0.2 gridBase_0.4-6 gtable_0.1.2 gtools_3.2.1 IRanges_1.20.6 iterators_1.0.6 labeling_0.2 > [19] limSolve_1.5.5 lpSolve_5.6.7 MASS_7.3-29 matrixStats_0.8.14 munsell_0.4.2 plyr_1.8 proto_0.3-10 quadprog_1.5-5 RColorBrewer_1.0-5 > [28] reshape2_1.2.2 R.methodsS3_1.6.1 RSQLite_0.11.4 scales_0.2.3 splines_3.0.2 stats4_3.0.2 survival_2.37-7 tools_3.0.2 XML_3.98-1.1 > [37] xtable_1.7-1 > > server: >> sessionInfo() > R version 3.0.2 (2013-09-25) > Platform: x86_64-unknown-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C > [3] LC_TIME=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 > [5] LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 > [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] compiler parallel stats graphics grDevices utils datasets > [8] methods base > > other attached packages: > [1] corpcor_1.6.6 preprocessCore_1.24.0 limma_3.18.10 > [4] CellMix_1.6.1 GSEABase_1.24.0 graph_1.40.1 > [7] annotate_1.40.0 AnnotationDbi_1.24.0 stringr_0.6.2 > [10] csSAM_1.2.4 NMF_0.20 cluster_1.14.4 > [13] rngtools_1.2.3 pkgmaker_0.17.4 registry_0.2 > [16] Biobase_2.22.0 BiocGenerics_0.8.0 > > loaded via a namespace (and not attached): > [1] beeswarm_0.1.6 bibtex_0.3-6 BiocInstaller_1.12.0 > [4] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 > [7] dichromat_2.0-0 digest_0.6.4 doParallel_1.0.6 > [10] foreach_1.4.1 genefilter_1.44.0 ggplot2_0.9.3.1 > [13] grid_3.0.2 gridBase_0.4-6 gtable_0.1.2 > [16] gtools_3.2.1 IRanges_1.20.6 iterators_1.0.6 > [19] labeling_0.2 limSolve_1.5.5 lpSolve_5.6.7 > [22] MASS_7.3-29 matrixStats_0.8.14 munsell_0.4.2 > [25] plyr_1.8 proto_0.3-10 quadprog_1.5-5 > [28] R.methodsS3_1.6.1 RColorBrewer_1.0-5 reshape2_1.2.2 > [31] RSQLite_0.11.4 scales_0.2.3 splines_3.0.2 > [34] stats4_3.0.2 survival_2.37-7 tools_3.0.2 > [37] XML_3.98-1.1 xtable_1.7-1 > > -- > Sent via the guest posting facility at bioconductor.org. ______________________________________________________________________ The information in this email is confidential and intend...{{dropped:4}}
ADD COMMENT
0
Entering edit mode
As Gordon says, you cannot expect the exact same numerical answers on different platforms. Having said that, these differences seems larger than I would expect. If I was the author, I would inspect this a bit more, but I would require a completely reproducible script + data. Last time I had an issue like this (in bumphunter) it was caused by what I can only describe as a really unexpected bug, where I learned something useful. Kasper On Wed, Feb 5, 2014 at 5:58 PM, Gordon K Smyth <smyth@wehi.edu.au> wrote: > This is not to with limma. To get the linear model coefficients, limma > calls lm.fit() from the stats package. > > The fact is that not all of the underlying numerical routines in R give > exactly the same results on different computer architectures. The > difference is so small that it doesn't seem a serious problem to me. > > Indeed, it could be that your numbers are already different before they > are input to limma. Have you checked that? > > Gordon > > > Date: Tue, 4 Feb 2014 14:49:42 -0800 (PST) >> From: "Pavel Fedotov [guest]" <guest@bioconductor.org> >> To: bioconductor@r-project.org, pavelph@ya.ru >> Subject: [BioC] limma lmFit returns different results on different >> computers >> >> >> I run the same program code on my laptop and on server and got different >> results. I found that the problem occured when I run >> lmFit(). I output parameters for this function and they are same on both >> computers, but result differs. >> Here is fragment of my code: >> ... >> group_names <- rep("0",length(clusters)) >> group_names[which(clusters %in% g)] <- "CT1" >> group_names[which(!(clusters %in% g))] <- "Other" >> names(group_names) <- group_names >> group_names <- factor(group_names) >> >> expr_matrix <- if (!is_log) { >> log2(expr) # do log transformation >> } else { >> expr >> } >> >> design <- model.matrix(~0+group_names) >> colnames(design) <- levels(group_names) >> colnames(expr_matrix) <- group_names >> >> print(design) >> print(head(expr_matrix)) >> print(tail(expr_matrix)) >> >> fit <- lmFit(expr_matrix, design) >> >> print(head(fit)) >> >> Last command returns me on laptop: >> >> An object of class "MArrayLM" >> $coefficients >> CT1 Other >> 226151_x_at 9.798801 9.317917 >> 1552701_a_at 8.681497 8.624071 >> 1554471_a_at 8.966830 8.452752 >> 224703_at 9.652549 9.558388 >> 202106_at 9.139795 8.852839 >> 218515_at 10.088242 10.116507 >> >> and on server: >> >> An object of class "MArrayLM" >> $coefficients >> CT1 Other >> 226151_x_at 9.798801 9.317231 >> 1552701_a_at 8.681497 8.624118 >> 1554471_a_at 8.966830 8.472994 >> 224703_at 9.652549 9.558388 >> 202106_at 9.139795 8.869085 >> 218515_at 10.088242 10.116605 >> >> Second collumn is slightly different in this cases. >> I thought that I had different versions of limma package but >> sessionInfo() shows me that all attached packages are similiar including >> limma (limma_3.18.10). >> >> Any thoughts what could it be? >> >> -- output of sessionInfo(): >> >> laptop: >> >>> sessionInfo() >>> >> R version 3.0.2 (2013-09-25) >> Platform: x86_64-pc-linux-gnu (64-bit) >> >> locale: >> [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C >> LC_TIME=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 >> LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 >> [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C LC_ADDRESS=C >> LC_TELEPHONE=C LC_MEASUREMENT=ru_RU.UTF-8 >> LC_IDENTIFICATION=C >> >> attached base packages: >> [1] compiler parallel stats graphics grDevices utils datasets >> methods base >> >> other attached packages: >> [1] corpcor_1.6.6 preprocessCore_1.24.0 limma_3.18.10 >> BiocInstaller_1.12.0 CellMix_1.6.1 GSEABase_1.24.0 >> graph_1.40.1 >> [8] annotate_1.40.0 AnnotationDbi_1.24.0 stringr_0.6.2 >> csSAM_1.2.4 NMF_0.20 cluster_1.14.4 >> rngtools_1.2.3 >> [15] pkgmaker_0.17.4 registry_0.2 Biobase_2.22.0 >> BiocGenerics_0.8.0 >> >> loaded via a namespace (and not attached): >> [1] beeswarm_0.1.6 bibtex_0.3-6 codetools_0.2-8 >> colorspace_1.2-4 DBI_0.2-7 dichromat_2.0-0 digest_0.6.4 >> doParallel_1.0.6 foreach_1.4.1 >> [10] genefilter_1.44.0 ggplot2_0.9.3.1 grid_3.0.2 >> gridBase_0.4-6 gtable_0.1.2 gtools_3.2.1 IRanges_1.20.6 >> iterators_1.0.6 labeling_0.2 >> [19] limSolve_1.5.5 lpSolve_5.6.7 MASS_7.3-29 >> matrixStats_0.8.14 munsell_0.4.2 plyr_1.8 proto_0.3-10 >> quadprog_1.5-5 RColorBrewer_1.0-5 >> [28] reshape2_1.2.2 R.methodsS3_1.6.1 RSQLite_0.11.4 >> scales_0.2.3 splines_3.0.2 stats4_3.0.2 survival_2.37-7 >> tools_3.0.2 XML_3.98-1.1 >> [37] xtable_1.7-1 >> >> server: >> >>> sessionInfo() >>> >> R version 3.0.2 (2013-09-25) >> Platform: x86_64-unknown-linux-gnu (64-bit) >> >> locale: >> [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C >> [3] LC_TIME=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 >> [5] LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 >> [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C >> [9] LC_ADDRESS=C LC_TELEPHONE=C >> [11] LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C >> >> attached base packages: >> [1] compiler parallel stats graphics grDevices utils datasets >> [8] methods base >> >> other attached packages: >> [1] corpcor_1.6.6 preprocessCore_1.24.0 limma_3.18.10 >> [4] CellMix_1.6.1 GSEABase_1.24.0 graph_1.40.1 >> [7] annotate_1.40.0 AnnotationDbi_1.24.0 stringr_0.6.2 >> [10] csSAM_1.2.4 NMF_0.20 cluster_1.14.4 >> [13] rngtools_1.2.3 pkgmaker_0.17.4 registry_0.2 >> [16] Biobase_2.22.0 BiocGenerics_0.8.0 >> >> loaded via a namespace (and not attached): >> [1] beeswarm_0.1.6 bibtex_0.3-6 BiocInstaller_1.12.0 >> [4] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 >> [7] dichromat_2.0-0 digest_0.6.4 doParallel_1.0.6 >> [10] foreach_1.4.1 genefilter_1.44.0 ggplot2_0.9.3.1 >> [13] grid_3.0.2 gridBase_0.4-6 gtable_0.1.2 >> [16] gtools_3.2.1 IRanges_1.20.6 iterators_1.0.6 >> [19] labeling_0.2 limSolve_1.5.5 lpSolve_5.6.7 >> [22] MASS_7.3-29 matrixStats_0.8.14 munsell_0.4.2 >> [25] plyr_1.8 proto_0.3-10 quadprog_1.5-5 >> [28] R.methodsS3_1.6.1 RColorBrewer_1.0-5 reshape2_1.2.2 >> [31] RSQLite_0.11.4 scales_0.2.3 splines_3.0.2 >> [34] stats4_3.0.2 survival_2.37-7 tools_3.0.2 >> [37] XML_3.98-1.1 xtable_1.7-1 >> >> -- >> Sent via the guest posting facility at bioconductor.org. >> > > ______________________________________________________________________ > The information in this email is confidential and inte...{{dropped:13}}
ADD REPLY

Login before adding your answer.

Traffic: 754 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