Re: [R-sig-Geo] logLik value of the spml spatial panel model

2018-11-17 Thread Danlin Yu
Dear Dr. Piras: This is great. Thank you very much for the response.

Best,

Danlin


On 2018/11/14 16:32, Gianfranco Piras wrote:
> Sorry for the very slow reply. I was  looking back at the email exchange and 
> this problem sounded familiar.
>
> I have had another user contacting me because he was experiencing the same 
> issue with the pooled model. He also compared the value of the likelihood 
> from R with the value that he was obtaining with codes in Matlab (in the 
> spatial econometrics toolbox).  Anyway, Roger was right when he said that the 
> log-likelihood  from the "fix” was calculated omitting constants. I fixed 
> this specific problem a long time ago, but since the email that was sent to 
> me by the other user had several  other questions (which I didn’t had time to 
> address),  I never committed the new version on R-forge.
>
> Anyway, here is a script and the updated package. I will try to get to the 
> other questions asap and finally upload to CRAN.
>
> Sorry  for any inconvenience related to my delay!
>
> Best,
> G.
>
>
>
>
>  
>
>
>
>> On Oct 25, 2018, at 10:56 AM, Millo Giovanni  
>> wrote:
>>
>> Correct. It should not be used for comparing FE to anything else. In 
>> particular, comparisons between FE and RE specifications have to concentrate 
>> on the treatment of the individual effects.
>>
>> Best, Giovanni
>>
>> -Messaggio originale-
>> Da: Danlin Yu [mailto:y...@mail.montclair.edu]
>> Inviato: giovedì 25 ottobre 2018 16:54
>> A: Millo Giovanni; Jeremie Juste; Roger Bivand
>> Cc: r-sig-geo@r-project.org; Gianfranco Piras
>> Oggetto: Re: R: [R-sig-Geo] logLik value of the spml spatial panel model
>>
>> This is great response. Thank you all, Giovanni, Roger and Jeremie.
>> Based on the response, it seems that the LL element for fixed effect
>> model is only useful for optimization, but not cross model comparison?
>> The fixed effect spatial lag panel model, however, does produce the LL
>> value. Does that mean this LL value shall not be used for model
>> comparison purpose as well?
>>
>> Thank you all.
>>
>> Best,
>>
>> Danlin
>>
>>
>> On 2018/10/25 8:46, Millo Giovanni wrote:
>>> Hello. Thanks for keeping us posted.
>>>
>>> As was aptly observed, while RE and pooled models do actually have a logLik 
>>> element, FE ones don't but there's a reason. While it is not difficult to 
>>> output the  LL for the FE models too, like Jeremie did (or perhaps even 
>>> setting quiet=FALSE and taking the last loglikelihood value from 
>>> optimization), we never managed to decide whether outputting this is 
>>> appropriate or not. In fact the LL element from the procedure is relative 
>>> to the "pooled" model on demeaned data, so it is sort of a crossbred 
>>> likelihood; most people asking for it want it to compare to the LL of the 
>>> random effects model or similar uses, which I would not advise.
>>>
>>> Gianfranco (author of the FE stuff) do please step in if appropriate.
>>> Best,
>>> Giovanni
>>>
>>> -Messaggio originale-
>>> Da: Jeremie Juste [mailto:jeremieju...@gmail.com]
>>> Inviato: giovedì 25 ottobre 2018 11:21
>>> A: Roger Bivand
>>> Cc: Danlin Yu; r-sig-geo@r-project.org; Millo Giovanni; Gianfranco Piras
>>> Oggetto: Re: [R-sig-Geo] logLik value of the spml spatial panel model
>>>
>>>
>>> Hello,
>>>
>>> Thanks for the feedback.
>>>
>>> Here is the diff. It is my first one so I'm not sure I'm doing everything 
>>> right. :-)
>>>
>>>
>>> modified   R/likelihoodsFE.R
>>> @@ -459,7 +459,7 @@ if(Hess) asyv <- NULL  else asyv <- asyv
>>>
>>>
>>> -   return<-list(coeff=betas, rho = rho, s2 = s2, rest.se = rest.se, 
>>> rho.se = rho.se, s2.se = s2.se, asyvar1=asyvar1, residuals = r, asyv = asyv)
>>> +return<-list(coeff=betas, rho = rho, s2 = s2, rest.se = rest.se,
>>> + rho.se = rho.se, s2.se = s2.se, ll=LL, asyvar1=asyvar1, residuals = r,
>>> + asyv = asyv)
>>>   }
>>>
>>> I have compressed splm with the modification with the .git inside. I have 
>>> installed the modified package again and checked that the modification 
>>> worked.
>>>
 fespaterr <- spml(fm, data = Produc, listw = mat2listw(usaww),
 model="within", spatial.error="b", Hess = FALSE) fespaterr$logLik
 It may be,however, that there was a reason for omitting it, so checks
 to verify that it actually is a logLik value on the same basis as
 other logLik values (not from an abbreviated log-likelihood function
 used for fitting by omitting constants) would be helpful. It would be
 good to provide logLik methods for the ML fitted model objects.
>>> I have checked that it is the logLik that correspond to the estimation of 
>>> the rho.
>>>
>>> Best regards,
>>>
>>> Jeremie
>>>
>>>
>>>
>>>
>>> Ai sensi del Reg. UE 2016/679 e normativa vigente si precisa che le 
>>> informazioni contenute in questo messaggio sono riservate ed a uso 
>>> esclusivo del destinatario. Qualora il messaggio in parola Le fosse 
>>> pervenuto per errore, La invitiamo ad eliminarlo senza copiarlo e 

Re: [R-sig-Geo] rgdal segmentation fault during installation

2018-11-17 Thread Edzer Pebesma
It looks like you have multiple versions of GDAL and/or PROJ installed
on your system; see https://github.com/r-spatial/sf the section on
"Multiple GDAL, GEOS and/or PROJ versions on your system" and there the
link to https://github.com/r-spatial/sf/issues/844 which contains a very
ugly solution (setting LD_LIBRARY_PATH from within R).

On 11/17/18 1:57 PM, Emanuele Cordano wrote:
> Dear list,
> 
> I got the following segmentation fault error when I try to install rgdal on
> my local Ubuntu 16.04 LTS machine. Did anyone encounter something similar?
> Please below the error message with traceback and R session info.
> Similar problems appears on
> https://stackoverflow.com/questions/50064673/cannot-install-rgdal-package-in-local-server-an-irrecoverable-exception-occurre
> which remains unsolved . In my case (see below)  all checks, PROJ4
> included,  were OK!
> 
> Thank you for any kind of feedback
> Best
> Emanuele Cordano
> 
> user@machine:~$ R
> 
> R version 3.5.1 (2018-07-02) -- "Feather Spray"
> Copyright (C) 2018 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>   Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
> [Previously saved workspace restored]
> 
>> install.packages("rgdal")
> Installing package into ‘/home/ecor/R/x86_64-pc-linux-gnu-library/3.5’
> (as ‘lib’ is unspecified)
> trying URL 'http://cran.r-project.org/src/contrib/rgdal_1.3-6.tar.gz'
> Content type 'application/x-gzip' length 1666975 bytes (1.6 MB)
> ==
> downloaded 1.6 MB
> 
> * installing *source* package ‘rgdal’ ...
> ** package ‘rgdal’ successfully unpacked and MD5 sums checked
> configure: R_HOME: /usr/lib/R
> configure: CC: gcc -std=gnu99
> configure: CXX: g++
> configure: C++11 support available
> configure: rgdal: 1.3-6
> checking for /usr/bin/svnversion... yes
> configure: svn revision: 773
> checking for gdal-config... /usr/bin/gdal-config
> checking gdal-config usability... yes
> configure: GDAL: 2.1.3
> checking GDAL version >= 1.11.4... yes
> checking gdal: linking with --libs only... yes
> checking GDAL: /usr/share/gdal/2.1/pcs.csv readable... yes
> configure: pkg-config proj exists, will use it
> configure: PROJ version: 4.9.2
> checking proj_api.h presence and usability... yes
> checking PROJ version >= 4.8.0... yes
> checking projects.h presence and usability... yes
> checking PROJ.4: epsg found and readable... yes
> checking PROJ.4: conus found and readable... yes
> configure: Package CPP flags:  -I/usr/include/gdal
> configure: Package LIBS:  -L/usr/lib -lgdal -lproj
> configure: creating ./config.status
> config.status: creating src/Makevars
> ** libs
> g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
> -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g -c OGR_write.cpp -o OGR_write.o
> g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
> -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g -c gdal-bindings.cpp -o gdal-bindings.o
> gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
> -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
> gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
> -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g  -c inverser.c -o inverser.o
> gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
> -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g  -c local_stubs.c -o local_stubs.o
> g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
> -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g -c ogr_geom.cpp -o ogr_geom.o
> gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
> -I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include" 

[R-sig-Geo] rgdal segmentation fault during installation

2018-11-17 Thread Emanuele Cordano
Dear list,

I got the following segmentation fault error when I try to install rgdal on
my local Ubuntu 16.04 LTS machine. Did anyone encounter something similar?
Please below the error message with traceback and R session info.
Similar problems appears on
https://stackoverflow.com/questions/50064673/cannot-install-rgdal-package-in-local-server-an-irrecoverable-exception-occurre
which remains unsolved . In my case (see below)  all checks, PROJ4
included,  were OK!

Thank you for any kind of feedback
Best
Emanuele Cordano

user@machine:~$ R

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> install.packages("rgdal")
Installing package into ‘/home/ecor/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'http://cran.r-project.org/src/contrib/rgdal_1.3-6.tar.gz'
Content type 'application/x-gzip' length 1666975 bytes (1.6 MB)
==
downloaded 1.6 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: R_HOME: /usr/lib/R
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: C++11 support available
configure: rgdal: 1.3-6
checking for /usr/bin/svnversion... yes
configure: svn revision: 773
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.1.3
checking GDAL version >= 1.11.4... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/2.1/pcs.csv readable... yes
configure: pkg-config proj exists, will use it
configure: PROJ version: 4.9.2
checking proj_api.h presence and usability... yes
checking PROJ version >= 4.8.0... yes
checking projects.h presence and usability... yes
checking PROJ.4: epsg found and readable... yes
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags:  -I/usr/include/gdal
configure: Package LIBS:  -L/usr/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g -c OGR_write.cpp -o OGR_write.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g -c gdal-bindings.cpp -o gdal-bindings.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c inverser.c -o inverser.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c local_stubs.c -o local_stubs.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g -c ogr_geom.cpp -o ogr_geom.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c ogr_polygons.c -o ogr_polygons.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g -c ogr_proj.cpp -o ogr_proj.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal
-I"/home/ecor/R/x86_64-pc-linux-gnu-library/3.5/sp/include"-fpic  -g
-O2