Skip to content
Prev 17385 / 20628 Next

R: gls() funcion after R upgrade

Dear Phillip,

thanks for the reply

I tried both to re-install the package nlme (and all its dependencies) and to re-install R as a whole but I always get the same error message

The problem seems to be related to the varExp() variance function structures on a 32-bit windows platform
With 64-bit windows platform, the old version 3.3.2 and the new version 3.5.2 produce the same results
At the same time, the varPower() function always produces the same results regardless of the windows platform or version of R
The following table shows the coefficients obtained according to the platform (32 bit / 62 bit), version of R and variance function

Platform	Version	weights	   	ITOD	   	EU_CH
windows 32 bit	3.3.2	varExp()	-0.1053291	-0.4406068
windows 32 bit	3.5.2	varExp()	<NA>	         <NA>
windows 64 bit	3.3.2	varExp()	-0.3011427	-0.5537158
windows 64 bit	3.5.2	varExp()	-0.3011427	-0.5537158
windows 32 bit	3.3.2	varPower()	-0.3138869	-0.5010393
windows 32 bit	3.5.2	varPower()	-0.3138869	-0.5010393
windows 64 bit	3.3.2	varPower()	-0.3138868	-0.5010394
windows 64 bit	3.5.2	varPower()	-0.3138868	-0.5010394
				
linux 64 bit	3.5.2	varExp()	-0.3123153 	-0.4979789

These values differ from what I reported in the previous e-mail. For a ?copy and paste? mistake, in the previous e-mail I reported the results obtained with the varPower() function instead of varExp() function. 

Here is the correct output
Generalized least squares fit by maximum likelihood
  Model: as.formula(f) 
  Data: db 
  Log-likelihood: 12.11128

Coefficients:
      ITOD      EU_CH 
-0.1053291 -0.4406068 

Correlation Structure: ARMA(2,3)
 Formula: ~1 
 Parameter estimate(s):
      Phi1       Phi2     Theta1     Theta2     Theta3 
 0.6485554 -0.1750409  0.9450232  0.9566344  0.9566288 
Variance function:
 Structure: Exponential of variance covariate
 Formula: ~fitted(.) 
 Parameter estimates:
        expon 
-0.0007047246 
Degrees of freedom: 71 total; 69 residual
Residual standard error: 0.7740528

On the 3.5.2 version of R, the sessionInfo() show "Matrix products: default" whereas in the 3.3.2 version this message does not appear. 

If I set options(matprod="internal") on the 3.5.2 I avoid the error but the results I get are very different from those of version 3.3.2

If I use the REML method instead of the ML I get much more similar results but, at the same time, very different from those I would get with the same method on the version 3.2.2

Maybe these clues can inspire a solution?


Fabio





-----Messaggio originale-----
Da: Alday, Phillip <Phillip.Alday at mpi.nl> 
Inviato: marted? 19 febbraio 2019 00:44
A: Fabio Fanoni <fabio.fanoni at popso.it>; r-sig-mixed-models at r-project.org
Oggetto: Re: [R-sig-ME] gls() funcion after R upgrade

Dear Fabio,

Your example runs fine on my machine, and I have a comparable R and nlme version. Have you tried re-installing nlme and all its dependencies?

install.packages("nlme",dependencies=TRUE)

Sometimes dependencies can get out of sync and this can lead to weird errors. (I've had this happen when lme4 was compiled against a different Rcpp version than Matrix.)

As a sidebar, I get different estimates than your old output had:
gls(as.formula(f),correlation=corARMA(p=2,q=3,fixed=FALSE),data=db,weights=varExp(),method="ML")
Generalized least squares fit by maximum likelihood
? Model: as.formula(f)
? Data: db
? Log-likelihood: 11.74371

Coefficients:
????? ITOD????? EU_CH
-0.3123153 -0.4979789

Correlation Structure: ARMA(2,3)
?Formula: ~1
?Parameter estimate(s):
????? Phi1?????? Phi2???? Theta1???? Theta2???? Theta3
?0.7542011 -0.2467866? 0.8989841? 0.9444138? 0.9092150 Variance function:
?Structure: Exponential of variance covariate
?Formula: ~fitted(.)
?Parameter estimates:
????? expon
-0.01497128
Degrees of freedom: 71 total; 69 residual Residual standard error: 0.817064

(Note that "power" is now called "expon" for "exponent".) The small differences in the exponent and the coefficients could be numerical issues, but the big differences in ARMA seem a bit worrying. The log-likelihood of 'my' fit is better, but the residual standard error is worse.

Best,

Phillip
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.1

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

::snip::


attached base packages:
[1] stats???? graphics? grDevices utils???? datasets? methods?? base

other attached packages:
[1] nlme_3.1-137

loaded via a namespace (and not attached):
[1] compiler_3.5.2? grid_3.5.2????? lattice_0.20-38
On 11/2/19 9:40 am, Fabio Fanoni wrote: