Hi Paulo, I complete Michael's answer below:
"1) How to extract model parameters from models fitted using mvgls?" Model parameters (e.g., alpha for OU, or lambda for Pagel's lambda model) can be obtained from object$param. The covariance matrix 'Sigma' is located in object$sigma$Pinv. The inverse of this matrix is object$sigma$P (since P stands for the 'precision' matrix, which is the inverse of the covariance matrix. Pinv is the inverse of P, i.e., the covariance matrix). The ancestral states/optima are given in object$coefficients. "2) I understand that mvgls incorporates penalized likelihood, whereas mvOU does not. Does that explain the discrepancy in the results? Which approach would be more appropriate in my case?" Yes, this could explain the differences. When the number of variables (and thus estimated parameters) grows relative to the number of species, model selection using maximum likelihood can be severely biased compared to penalized likelihood (see Fig. 3 in https://doi.org/10.1093/sysbio/syy045). You could also use the EIC (extended information criterion) to compare model fit with varying levels of complexity, although it may be time-consuming. "3) When I fit the mvOU (OU1) model, it says it has converged, but it also says "Unreliable solution (Likelihood at a saddle point)". Does anyone know how serious this is and how to deal with it?" This issue can arise for several reasons, including data scaling, too many zero branch lengths, or poor starting values. Limited data combined with highly parameterized models can exacerbate these problems. You might try providing different starting values through the param = list(alpha, sigma) argument, although these values depend on the parameterization used (see section 10 of the package vignette). You can also try a different optimizer ('optimization' argument). Another option is to reduce the model’s complexity (for example, by imposing constraints on the parameter matrices), as suggested by Michael. This can be done using the decomp and decompSigma arguments, with examples provided in the package vignette. However, when dealing with a limited sample size and multiple variables, I would recommend using the penalized likelihood approach in 'mvgls' instead, and directly on the data rather than on PC axes. This would help minimize biases in model selection and parameter estimation that can arise from using a subset of principal components. Additionally, the PL approach is designed for high-dimensional datasets and is less prone to the likelihood issues you're encountering (although the models make some simplifying assumptions). Hope this helps. Regards, Julien ________________________________________ De : R-sig-phylo <[email protected]> de la part de Michael Zyphur via R-sig-phylo <[email protected]> Envoyé : jeudi 7 novembre 2024 22:55 À : Paulo Mateus Martins <[email protected]> Cc : [email protected] <[email protected]> Objet : Re: [R-sig-phylo] mvMORPH: mvgls parameter extraction and unreliable solution in mvOU Hi Paulo For extracting model parameters from mvgls, unfortunately, mvgls does not provide a straightforward way to extract all model parameters as mvBM, mvEB, and mvOU do. If you are specifically looking to retrieve sigma, beta, r, and alfa parameters, you might need to use custom functions or consult the package documentation to see if they’re accessible via model$par or similar components of the model object. Alternatively, you may continue using mvBM, mvEB, and mvOU for a more direct approach, as you’ve started to do. In terms of differences between mvgls and mvOU, you're right that mvgls incorporates penalized likelihood, which can influence model selection outcomes. Penalized likelihood methods, like those used in mvgls, typically account for model complexity differently from the AIC used in mvOU. This may contribute to the discrepancy in model performance (OU1 vs. OUM) between the two methods. The choice of approach depends on your specific research question and how you want to handle model complexity. For comparative purposes across models, mvOU might be more consistent if AIC is the preferred metric. As for convergence issues with mvOU (OU1), the “Likelihood at a saddle point” warning suggests that the optimization process may have reached a point that is not a true maximum, making the solution potentially unstable or unreliable. This can happen due to flat likelihood surfaces or local optima in complex models. To address this: consider trying different starting values or optimization methods, if available, within the mvMORPH functions; reducing the parameter space or simplifying the model might help achieve a more stable solution; and/or exploring alternative packages or methods for fitting OU models if this issue persists. Hope this helps! Best wishes Michael Zyphur Director Institute for Statistical and Data Science *instats.org* <http://instats.org> On Fri, 8 Nov 2024 at 08:37, Paulo Mateus Martins <[email protected]> wrote: > Dear all, > > I'm using the mvMORPH package to fit the BM, EB, OU1, and OUM > macroevolutionary models to the PCA axes of the log-shape ratios of > whip-spiders. The simmap tree contains 69 species and 4 habitat states > (cave = 24, cave/forest = 6, city = 5, forest = 34). > > At first, I used mvgls but couldn't find a way of extracting model > parameters (e.g., sigma, beta, r, and alfa), so I moved to the separate > functions for each model (mvBM, mvEB, and mvOU). > > The two approaches produced different results, with the best mvgls model > (according to GIC) being OU1, and the best mvOU model (according to AIC) > being OUM. > > Could someone please help me with the following questions? > > 1) How to extract model parameters from models fitted using mvgls? > 2) I understand that mvgls incorporates penalized likelihood, whereas mvOU > does not. Does that explain the discrepancy in the results? Which approach > would be more appropriate in my case? > 3) When I fit the mvOU (OU1) model, it says it has converged, but it also > says "Unreliable solution (Likelihood at a saddle point)". Does anyone know > how serious this is and how to deal with it? > > Thank you! > > Paulo > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-phylo mailing list - [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at > http://www.mail-archive.com/[email protected]/ > [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/[email protected]/ _______________________________________________ R-sig-phylo mailing list - [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/[email protected]/
