A blog about biostatistics using R by Professor Marc Girondot, University Paris Saclay.
Subjects can be wide, from ecology to molecular phylogeny or statistics or just tricks to make life easier in R.
Flush warnings() cache and convert warnings to error for debugging
An Hessian matrix is a square matrix of partial second order derivative. From the square-root of the inverse of the diagonal, it is possible to estimate the standard error of parameters. Let take an example: val=rnorm(100, mean=20, sd=5) # Return -ln L of values in val in Gaussian distribution with mean and sd in par fitnorm<-function(par, val) { -sum(dnorm(val, par["mean"], par["sd"], log = TRUE)) } # Initial values for search p<-c(mean=20, sd=5) # fit the model result <- optim(par=p, fn=fitnorm, val=val, method="BFGS", hessian=TRUE) # Inverse the hessian matrix to get SE for each parameters mathessian <- result$hessian inversemathessian <- solve(mathessian) res <- sqrt(diag(inversemathessian)) # results data.frame(Mean=result$par, SE=res) library(MASS) (r<-fitdistr(val, "normal")) It works well. However, the inverse of the matrix cannot be calculated if the second order derivative for some paramete...
Informations are available here https://bitbucket.org/nygcresearch/treemix/downloads/ In terminal, enter for Ubuntu 20.04: wget https://bitbucket.org/nygcresearch/treemix/downloads/treemix-1.13.tar.gz tar -xvf treemix-1.13.tar.gz sudo apt-get install libgsl-dev sudo apt install libboost-dev sudo apt install libboost-all-dev cd treemix-1.13/ ./configure make sudo make install And it works: $ treemix TreeMix v. 1.13 $Revision: 231 $ Options: -h display this help -i [file name] input file -o [stem] output stem (will be [stem].treeout.gz, [stem].cov.gz, [stem].modelcov.gz) -k [int] number of SNPs per block for estimation of covariance matrix (1) -global Do a round of global rearrangements after adding all populations -tf [file name] Read the tree topology from a file, rather than estimating it -m [int] number of migration edges to add (0) -root [string] comma-delimited list of populations to set on one side of the root (for migration) -g [vertices file name] [edges file na...
Introduction Correlation iconography is a not very well known method to study multivariate data. It was developed long-time ago by Michel Lesty: Lesty M (1999) Une nouvelle approche dans le choix des régresseurs de la régression multiple en présence d'intéractions et de colinearités. La revue de Modulad 22:41-77 It is also well described in a French Wikipedia page: https://fr.wikipedia.org/wiki/Iconographie_des_corrélations After checking the possibilities of this method, I think that it deserves more attention. Let take the example of the wikipedia page: dta <- read.table(text=gsub(",", ".", "Élève Poids Âge Assiduité Note e1 52 12 12 5 e2 59 12,5 9 5 e3 55 13 15 9 e4 58 14,5 5 5 e5 66 15,5 11 13,5 e6 62 16 15 18 e7 63 17 12 18 e8 69 18 9 18"), header=TRUE) > dta Élève Poids Âge Assiduité Note 1 e1 52 12.0 12 5.0 2 e...
Commentaires
Enregistrer un commentaire