Articles

Affichage des articles du janvier, 2022

Install broom and spdep from source in MacOSX 12.2

I'm having trouble with : install.packages("broom", type = "source") and install.packages("spdep", type = "source") in R 4.12 in MacOSX 12.2 The error message is: Erreur dans dyn.load(file, DLLpath = DLLpath, ...) :    impossible de charger l'objet partagé '/Library/Frameworks/R.framework/Versions/4.1/Resources/library/glue/libs/glue.so':   dlopen(/Library/Frameworks/R.framework/Versions/4.1/Resources/library/glue/libs/glue.so, 0x0006): Library not loaded: /usr/local/opt/gsl/lib/libgsl.25.dylib   Referenced from: /Library/Frameworks/R.framework/Versions/4.1/Resources/library/glue/libs/glue.so   Reason: tried: '/usr/local/opt/gsl/lib/libgsl.25.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libgsl.25.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/server/libgsl.25.dylib' (no such file), '/usr/local/Cellar/gsl/2.7.1/lib/libgsl.25.dylib

Install mixcat package in MacOSX and Ubuntu

 In ubuntu 20.04: sudo apt-get install libgsl0-dev install.packages("mixcat") In MacOSX: brew install gsl   Create a directory ~/.R/ if it does not exist and a file Makervars with PKG_LIBS=-L/usr/local/opt/gettext/lib CFLAGS=-I/usr/local/opt/gsl/include LDFLAGS=-L/usr/local/opt/gsl/lib -lgsl -lgslcblas Then in R: install.packages("mixcat") After the installation, remove the Makervars file or it will create interference with other installation, for example nloptr. Thanks to aymeric.stamm at math.cnrs.fr to have found this solution to install the nloptr package !

Install sf and spdep from source in MacOSX

I had problem to install new version of spdep from source. I get this answer from maintainer of the package: This is not an spdep issue. See r-spatial/sf#1848, and the resolution of never installing from source unless you know how to do it and need to do it to access the development versions of packages, or more recent versions of external software. I don't agree at all with this answer. When you build a package from source, it is exactly fitted for your configuration. Here is the solution: In terminal brew install gdal brew install proj brew install geos brew install sqlite3 or brew reinstall *** in R with intel processor install.packages("sf",configure.args = "--with-gdal-config=/usr/local/bin/gdal-config", type="source") install.packages("spdep",configure.args = "--with-gdal-config=/usr/local/bin/gdal-config", type="source") And it works In R with ARM64 processor install.packages("sf", type = "source"

Fit observations with skew normal distribution or two truncated normal distributions

Image
 The skew normal distribution is based on the work of: Azzalini, A., 1985. A class of distributions which includes the normal ones. Scand. J. Statist. 12, 171-178. The two truncated normal distributions is based on the work of: Sicard, O., 2013. La loi normale asymétrique. Définition, premières propriétés, estimation des paramètres. Pour que l’asymétrie ne soit plus considérée comme anormale... Laboratoire d'informatique et de mathématiques, La Réunion. The skew normal distribution is available in sn package in CRAN. The asymetric Gaussian distribution is not available. It is easy to create this function; it has 3 parameters, mean, sdlow and sdhigh. If sdlow==sdhigh, the asymetric Gaussian distribution is equal to Gaussian distribution. dnorm2 <- function(x, mean = 0, sdlow = 1, sdhigh = 1, sd=NULL, log = FALSE) {   if (!is.null(sd)) {     sdlow <- sd     sdhigh <- sd   }   return(dnorm(x = x, mean=mean, sd=ifelse(x < mean, sdlow, sdhigh), log = log)) } fitnorm2 <- f