Giuseppe Pagnoni
2013-Jun-07 09:01 UTC
[R-sig-Debian] Function nlme::lme in Ubuntu (but not Win or OS X): "Non-positive definite approximate variance-covariance"
Dear all, I am estimating a mixed-model in Ubuntu Raring (13.04¸ amd64), with the code: fm0 <- lme(rt ~ run + group * stim * cond, random=list( subj=pdSymm(~ 1 + run), subj=pdSymm(~ 0 + stim)), data=mydat1) When I check the approximate variance-covariance matrix, I get:> fm0$apVar[1] "Non-positive definite approximate variance-covariance" *However*, if I do the same on a Windows or a Mac OS X machine, I get:> fm0$apVarreStruct.subj1 reStruct.subj2 reStruct.subj3 reStruct.subj1 reStruct.subj1 1.952757e-01 3.130089e-01 5.766955e-01 -0.1034862377 reStruct.subj2 3.130089e-01 5.703211e-01 9.864047e-01 -0.1937902915 reStruct.subj3 5.766955e-01 9.864047e-01 1.861434e+00 -0.3303689957 reStruct.subj1 -1.034862e-01 -1.937903e-01 -3.303690e-01 0.0941652375 reStruct.subj2 -3.464557e-03 -5.933008e-03 -1.102904e-02 0.0163847582 reStruct.subj3 -6.826057e-01 -1.186231e+00 -2.122872e+00 0.3705613715 lSigma -2.058254e-06 -4.764783e-06 1.653583e-05 -0.0000146693 reStruct.subj2 reStruct.subj3 lSigma reStruct.subj1 -3.464557e-03 -6.826057e-01 -2.058254e-06 reStruct.subj2 -5.933008e-03 -1.186231e+00 -4.764783e-06 reStruct.subj3 -1.102904e-02 -2.122872e+00 1.653583e-05 reStruct.subj1 1.638476e-02 3.705614e-01 -1.466930e-05 reStruct.subj2 1.931738e-02 -2.020354e-02 -1.925015e-05 reStruct.subj3 -2.020354e-02 2.825301e+00 2.967063e-05 lSigma -1.925015e-05 2.967063e-05 6.299813e-05 attr(,"Pars") reStruct.subj1 reStruct.subj2 reStruct.subj3 reStruct.subj1 reStruct.subj2 4.570267 4.299735 1.282732 4.859346 3.206102 reStruct.subj3 lSigma -2.631377 5.308304 attr(,"natural") [1] TRUE I am unable to figure out the reason why I get such a difference in the output: all the machines are running the latest version of R (3.0.1) and nlme package (3.1-109) as of today (updated from the CRAN master site). Many thanks in advance for any suggestions, best -- Giuseppe Pagnoni Dip. Scienze Biomediche, Metaboliche e Neuroscienze Sezione Fisiologia e Neuroscienze Univ. di Modena e Reggio Emilia Via Campi 287 I-41125 Modena, Italy Tel: +39-059-205-5742 Fax: +39-059-205-5363 [[alternative HTML version deleted]]
Dirk Eddelbuettel
2013-Jun-07 11:52 UTC
[R-sig-Debian] Function nlme::lme in Ubuntu (but not Win or OS X): "Non-positive definite approximate variance-covariance"
On 7 June 2013 at 11:01, Giuseppe Pagnoni wrote: | Dear all, | | I am estimating a mixed-model in Ubuntu Raring (13.04? amd64), with the | code: | | fm0 <- lme(rt ~ run + group * stim * cond, | random=list( | subj=pdSymm(~ 1 + run), | subj=pdSymm(~ 0 + stim)), | data=mydat1) | | When I check the approximate variance-covariance matrix, I get: | | > fm0$apVar | [1] "Non-positive definite approximate variance-covariance" This comes from the BLAS / LAPACK libraries which you can switch in Debian / Ubuntu. Eg I (currently) have both defaults and openblas installed: edd at max:~$ COLUMNS=72 dpkg -l | grep -i "blas\|lapack" ii libblas-dev 1.2.20110419 amd64 Basic Linear Algebra Subroutines ii libblas-test 1.2.20110419 amd64 Basic Linear Algebra Subroutines ii libblas3 1.2.20110419 amd64 Basic Linear Algebra Reference im ii libblas3gf 1.2.20110419 all Transitional package for libblas ii liblapack-dev 3.4.2-1~exp3 amd64 Library of linear algebra routine ii liblapack-pic 3.4.2-1~exp3 amd64 Library of linear algebra routine ii liblapack3 3.4.2-1~exp3 amd64 Library of linear algebra routine ii liblapack3gf 3.4.2-1~exp3 all Transitional package for liblapac ii libopenblas-ba 0.2.6-1~exp1 amd64 Optimized BLAS (linear algebra) l ii libopenblas-de 0.2.6-1~exp1 amd64 Optimized BLAS (linear algebra) l edd at max:~$ The virtual package libblas is provided by the reference blas, atlas ("tuned") and openblas (multicore); similar for lapack. edd at max:~$ apt-cache search libblas libblas-dev - Basic Linear Algebra Subroutines 3, static library libblas-doc - Basic Linear Algebra Subroutines 3, documentation libblas3 - Basic Linear Algebra Reference implementations, shared library libatlas-base-dev - Automatically Tuned Linear Algebra Software, generic static libatlas3-base - Automatically Tuned Linear Algebra Software, generic shared libblas-test - Basic Linear Algebra Subroutines 3, testing programs libblas3gf - Transitional package for libblas libopenblas-base - Optimized BLAS (linear algebra) library based on GotoBLAS2 libopenblas-dev - Optimized BLAS (linear algebra) library based on GotoBLAS2 edd at max:~$ Try installing another package and see if that matters. The Windows and OS X versions of R will have used its internally packaged (not tuned, not multicore) BLAS/LAPACK. This can be changed there too; see the R Admin+Inst manual. Dirk | *However*, if I do the same on a Windows or a Mac OS X machine, I get: | | > fm0$apVar | reStruct.subj1 reStruct.subj2 reStruct.subj3 reStruct.subj1 | reStruct.subj1 1.952757e-01 3.130089e-01 5.766955e-01 -0.1034862377 | reStruct.subj2 3.130089e-01 5.703211e-01 9.864047e-01 -0.1937902915 | reStruct.subj3 5.766955e-01 9.864047e-01 1.861434e+00 -0.3303689957 | reStruct.subj1 -1.034862e-01 -1.937903e-01 -3.303690e-01 0.0941652375 | reStruct.subj2 -3.464557e-03 -5.933008e-03 -1.102904e-02 0.0163847582 | reStruct.subj3 -6.826057e-01 -1.186231e+00 -2.122872e+00 0.3705613715 | lSigma -2.058254e-06 -4.764783e-06 1.653583e-05 -0.0000146693 | reStruct.subj2 reStruct.subj3 lSigma | reStruct.subj1 -3.464557e-03 -6.826057e-01 -2.058254e-06 | reStruct.subj2 -5.933008e-03 -1.186231e+00 -4.764783e-06 | reStruct.subj3 -1.102904e-02 -2.122872e+00 1.653583e-05 | reStruct.subj1 1.638476e-02 3.705614e-01 -1.466930e-05 | reStruct.subj2 1.931738e-02 -2.020354e-02 -1.925015e-05 | reStruct.subj3 -2.020354e-02 2.825301e+00 2.967063e-05 | lSigma -1.925015e-05 2.967063e-05 6.299813e-05 | attr(,"Pars") | reStruct.subj1 reStruct.subj2 reStruct.subj3 reStruct.subj1 reStruct.subj2 | 4.570267 4.299735 1.282732 4.859346 3.206102 | reStruct.subj3 lSigma | -2.631377 5.308304 | attr(,"natural") | [1] TRUE | | | I am unable to figure out the reason why I get such a difference in the | output: all the machines are running the latest version of R (3.0.1) and | nlme package (3.1-109) as of today (updated from the CRAN master site). | | Many thanks in advance for any suggestions, | | best | | -- | Giuseppe Pagnoni | Dip. Scienze Biomediche, Metaboliche e Neuroscienze | Sezione Fisiologia e Neuroscienze | Univ. di Modena e Reggio Emilia | Via Campi 287 | I-41125 Modena, Italy | Tel: +39-059-205-5742 | Fax: +39-059-205-5363 | | [[alternative HTML version deleted]] | | | ---------------------------------------------------------------------- | _______________________________________________ | R-SIG-Debian mailing list | R-SIG-Debian at r-project.org | https://stat.ethz.ch/mailman/listinfo/r-sig-debian -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com