RfastOfficial / Rfast

A collection of Rfast functions for data analysis. Note 1: The vast majority of the functions accept matrices only, not data.frames. Note 2: Do not have matrices or vectors with have missing data (i.e NAs). We do no check about them and C++ internally transforms them into zeros (0), so you may get wrong results. Note 3: In general, make sure you give the correct input, in order to get the correct output. We do no checks and this is one of the many reasons we are fast.
143 stars 19 forks source link

Update multivariate_mle.R #60

Closed JCRichstein closed 2 years ago

JCRichstein commented 2 years ago

Describe the bug The function mvlnorm.mle always throws the error message Error in det(s) : object 's' not found

To Reproduce

  1. A complete example with the same data that the function failed. (screenshots not preferred) x <- matrnorm(100, 4) res<-mvlnorm.mle(x) x <- NULL

Suggested fix

In multivariate_mle.R line 101 (https://github.com/RfastOfficial/Rfast/blob/1f14fbb7a0729b6c4122fc3ce12701ad4801f1a3/R/multivariate_mle.R#L101):

Instead of a <- n d log(2 pi) + n log(det(s)) + n d - sum(y) Should be a <- n d log(2 pi) + n log(det(sigma)) + n d - sum(y)

s is the expected value, and not defined at that point in the code.

Desktop (please complete the following information):