1
$\begingroup$

I'm trying to perform Maximum Likelihood Estimation, where the data follows a Multivariate Normal.

The problem, I think, is that in the density, we have the inverse of the covariance matrix. This seems to pose some problems when the covariance matrix is not diagonal...

For example, let's say that for the covariance I use $M \otimes K$, where K is an $T\times T$ matrix filled with constants in a way that's positive definite, and $M$ is a parametric matrix of dimensions $4\times 4$.

Even for $T=10$, I'm having difficulty for Mathematica to write out the full expression for the likelihood...

Below I give you an example of a mean and a covariance matrix with $T=10$:

mean = {0. +1.10916 c1-0.350217 c2,0. +1.10916 c3-0.350217 c4,0. +1.10916 c5-0.350217 c6,0. +1.10916 c7-0.350217 c8,0. +0.527156 c1-1.07918 c2,0. +0.527156 c3-1.07918 c4,0. +0.527156 c5-1.07918 c6,0. +0.527156 c7-1.07918 c8,0. -0.199485 c1-1.72001 c2,0. -0.199485 c3-1.72001 c4,0. -0.199485 c5-1.72001 c6,0. -0.199485 c7-1.72001 c8,0. -2.09774 c1-1.26708 c2,0. -2.09774 c3-1.26708 c4,0. -2.09774 c5-1.26708 c6,0. -2.09774 c7-1.26708 c8,0. +0.0848292 c1+0.573983 c2,0. +0.0848292 c3+0.573983 c4,0. +0.0848292 c5+0.573983 c6,0. +0.0848292 c7+0.573983 c8,0. -0.236901 c1-1.41032 c2,0. -0.236901 c3-1.41032 c4,0. -0.236901 c5-1.41032 c6,0. -0.236901 c7-1.41032 c8,0. -0.315529 c1-0.648016 c2,0. -0.315529 c3-0.648016 c4,0. -0.315529 c5-0.648016 c6,0. -0.315529 c7-0.648016 c8,0. -0.375505 c1+2.22952 c2,0. -0.375505 c3+2.22952 c4,0. -0.375505 c5+2.22952 c6,0. -0.375505 c7+2.22952 c8,0. +1.7344 c1-1.72558 c2,0. +1.7344 c3-1.72558 c4,0. +1.7344 c5-1.72558 c6,0. +1.7344 c7-1.72558 c8,0. -1.57237 c1+0.116664 c2,0. -1.57237 c3+0.116664 c4,0. -1.57237 c5+0.116664 c6,0. -1.57237 c7+0.116664 c8};

where the $c1,c2,\dots, c16$ are parameters.

 covariance={{m1,0.204752 m1,0.20148 m1,0.0422875 m1,0.087142 m1,0.130031 m1,0.0851358 m1,0.179767 m1,0.0135012 m1,0.0100129 m1,m2,0.204752 m2,0.20148 m2,0.0422875 m2,0.087142 m2,0.130031 m2,0.0851358 m2,0.179767 m2,0.0135012 m2,0.0100129 m2,m3,0.204752 m3,0.20148 m3,0.0422875 m3,0.087142 m3,0.130031 m3,0.0851358 m3,0.179767 m3,0.0135012 m3,0.0100129 m3,m4,0.204752 m4,0.20148 m4,0.0422875 m4,0.087142 m4,0.130031 m4,0.0851358 m4,0.179767 m4,0.0135012 m4,0.0100129 m4},{0.204752 m1,m1,0.85242 m1,0.524803 m1,0.717493 m1,0.86846 m1,0.753967 m1,0.918808 m1,0.227762 m1,0.191276 m1,0.204752 m2,m2,0.85242 m2,0.524803 m2,0.717493 m2,0.86846 m2,0.753967 m2,0.918808 m2,0.227762 m2,0.191276 m2,0.204752 m3,m3,0.85242 m3,0.524803 m3,0.717493 m3,0.86846 m3,0.753967 m3,0.918808 m3,0.227762 m3,0.191276 m3,0.204752 m4,m4,0.85242 m4,0.524803 m4,0.717493 m4,0.86846 m4,0.753967 m4,0.918808 m4,0.227762 m4,0.191276 m4},{0.20148 m1,0.85242 m1,m1,0.528441 m1,0.468623 m1,0.602271 m1,0.524005 m1,0.977604 m1,0.242994 m1,0.145175 m1,0.20148 m2,0.85242 m2,m2,0.528441 m2,0.468623 m2,0.602271 m2,0.524005 m2,0.977604 m2,0.242994 m2,0.145175 m2,0.20148 m3,0.85242 m3,m3,0.528441 m3,0.468623 m3,0.602271 m3,0.524005 m3,0.977604 m3,0.242994 m3,0.145175 m3,0.20148 m4,0.85242 m4,m4,0.528441 m4,0.468623 m4,0.602271 m4,0.524005 m4,0.977604 m4,0.242994 m4,0.145175 m4},{0.0422875 m1,0.524803 m1,0.528441 m1,m1,0.547986 m1,0.540099 m1,0.635745 m1,0.59793 m1,0.752021 m1,0.515402 m1,0.0422875 m2,0.524803 m2,0.528441 m2,m2,0.547986 m2,0.540099 m2,0.635745 m2,0.59793 m2,0.752021 m2,0.515402 m2,0.0422875 m3,0.524803 m3,0.528441 m3,m3,0.547986 m3,0.540099 m3,0.635745 m3,0.59793 m3,0.752021 m3,0.515402 m3,0.0422875 m4,0.524803 m4,0.528441 m4,m4,0.547986 m4,0.540099 m4,0.635745 m4,0.59793 m4,0.752021 m4,0.515402 m4},{0.087142 m1,0.717493 m1,0.468623 m1,0.547986 m1,m1,0.948555 m1,0.983855 m1,0.567569 m1,0.279931 m1,0.379714 m1,0.087142 m2,0.717493 m2,0.468623 m2,0.547986 m2,m2,0.948555 m2,0.983855 m2,0.567569 m2,0.279931 m2,0.379714 m2,0.087142 m3,0.717493 m3,0.468623 m3,0.547986 m3,m3,0.948555 m3,0.983855 m3,0.567569 m3,0.279931 m3,0.379714 m3,0.087142 m4,0.717493 m4,0.468623 m4,0.547986 m4,m4,0.948555 m4,0.983855 m4,0.567569 m4,0.279931 m4,0.379714 m4},{0.130031 m1,0.86846 m1,0.602271 m1,0.540099 m1,0.948555 m1,m1,0.949142 m1,0.704131 m1,0.251512 m1,0.288572 m1,0.130031 m2,0.86846 m2,0.602271 m2,0.540099 m2,0.948555 m2,m2,0.949142 m2,0.704131 m2,0.251512 m2,0.288572 m2,0.130031 m3,0.86846 m3,0.602271 m3,0.540099 m3,0.948555 m3,m3,0.949142 m3,0.704131 m3,0.251512 m3,0.288572 m3,0.130031 m4,0.86846 m4,0.602271 m4,0.540099 m4,0.948555 m4,m4,0.949142 m4,0.704131 m4,0.251512 m4,0.288572 m4},{0.0851358 m1,0.753967 m1,0.524005 m1,0.635745 m1,0.983855 m1,0.949142 m1,m1,0.62895 m1,0.332852 m1,0.408482 m1,0.0851358 m2,0.753967 m2,0.524005 m2,0.635745 m2,0.983855 m2,0.949142 m2,m2,0.62895 m2,0.332852 m2,0.408482 m2,0.0851358 m3,0.753967 m3,0.524005 m3,0.635745 m3,0.983855 m3,0.949142 m3,m3,0.62895 m3,0.332852 m3,0.408482 m3,0.0851358 m4,0.753967 m4,0.524005 m4,0.635745 m4,0.983855 m4,0.949142 m4,m4,0.62895 m4,0.332852 m4,0.408482 m4},{0.179767 m1,0.918808 m1,0.977604 m1,0.59793 m1,0.567569 m1,0.704131 m1,0.62895 m1,m1,0.277585 m1,0.182918 m1,0.179767 m2,0.918808 m2,0.977604 m2,0.59793 m2,0.567569 m2,0.704131 m2,0.62895 m2,m2,0.277585 m2,0.182918 m2,0.179767 m3,0.918808 m3,0.977604 m3,0.59793 m3,0.567569 m3,0.704131 m3,0.62895 m3,m3,0.277585 m3,0.182918 m3,0.179767 m4,0.918808 m4,0.977604 m4,0.59793 m4,0.567569 m4,0.704131 m4,0.62895 m4,m4,0.277585 m4,0.182918 m4},{0.0135012 m1,0.227762 m1,0.242994 m1,0.752021 m1,0.279931 m1,0.251512 m1,0.332852 m1,0.277585 m1,m1,0.608161 m1,0.0135012 m2,0.227762 m2,0.242994 m2,0.752021 m2,0.279931 m2,0.251512 m2,0.332852 m2,0.277585 m2,m2,0.608161 m2,0.0135012 m3,0.227762 m3,0.242994 m3,0.752021 m3,0.279931 m3,0.251512 m3,0.332852 m3,0.277585 m3,m3,0.608161 m3,0.0135012 m4,0.227762 m4,0.242994 m4,0.752021 m4,0.279931 m4,0.251512 m4,0.332852 m4,0.277585 m4,m4,0.608161 m4},{0.0100129 m1,0.191276 m1,0.145175 m1,0.515402 m1,0.379714 m1,0.288572 m1,0.408482 m1,0.182918 m1,0.608161 m1,m1,0.0100129 m2,0.191276 m2,0.145175 m2,0.515402 m2,0.379714 m2,0.288572 m2,0.408482 m2,0.182918 m2,0.608161 m2,m2,0.0100129 m3,0.191276 m3,0.145175 m3,0.515402 m3,0.379714 m3,0.288572 m3,0.408482 m3,0.182918 m3,0.608161 m3,m3,0.0100129 m4,0.191276 m4,0.145175 m4,0.515402 m4,0.379714 m4,0.288572 m4,0.408482 m4,0.182918 m4,0.608161 m4,m4},{m2,0.204752 m2,0.20148 m2,0.0422875 m2,0.087142 m2,0.130031 m2,0.0851358 m2,0.179767 m2,0.0135012 m2,0.0100129 m2,m5,0.204752 m5,0.20148 m5,0.0422875 m5,0.087142 m5,0.130031 m5,0.0851358 m5,0.179767 m5,0.0135012 m5,0.0100129 m5,m6,0.204752 m6,0.20148 m6,0.0422875 m6,0.087142 m6,0.130031 m6,0.0851358 m6,0.179767 m6,0.0135012 m6,0.0100129 m6,m7,0.204752 m7,0.20148 m7,0.0422875 m7,0.087142 m7,0.130031 m7,0.0851358 m7,0.179767 m7,0.0135012 m7,0.0100129 m7},{0.204752 m2,m2,0.85242 m2,0.524803 m2,0.717493 m2,0.86846 m2,0.753967 m2,0.918808 m2,0.227762 m2,0.191276 m2,0.204752 m5,m5,0.85242 m5,0.524803 m5,0.717493 m5,0.86846 m5,0.753967 m5,0.918808 m5,0.227762 m5,0.191276 m5,0.204752 m6,m6,0.85242 m6,0.524803 m6,0.717493 m6,0.86846 m6,0.753967 m6,0.918808 m6,0.227762 m6,0.191276 m6,0.204752 m7,m7,0.85242 m7,0.524803 m7,0.717493 m7,0.86846 m7,0.753967 m7,0.918808 m7,0.227762 m7,0.191276 m7},{0.20148 m2,0.85242 m2,m2,0.528441 m2,0.468623 m2,0.602271 m2,0.524005 m2,0.977604 m2,0.242994 m2,0.145175 m2,0.20148 m5,0.85242 m5,m5,0.528441 m5,0.468623 m5,0.602271 m5,0.524005 m5,0.977604 m5,0.242994 m5,0.145175 m5,0.20148 m6,0.85242 m6,m6,0.528441 m6,0.468623 m6,0.602271 m6,0.524005 m6,0.977604 m6,0.242994 m6,0.145175 m6,0.20148 m7,0.85242 m7,m7,0.528441 m7,0.468623 m7,0.602271 m7,0.524005 m7,0.977604 m7,0.242994 m7,0.145175 m7},{0.0422875 m2,0.524803 m2,0.528441 m2,m2,0.547986 m2,0.540099 m2,0.635745 m2,0.59793 m2,0.752021 m2,0.515402 m2,0.0422875 m5,0.524803 m5,0.528441 m5,m5,0.547986 m5,0.540099 m5,0.635745 m5,0.59793 m5,0.752021 m5,0.515402 m5,0.0422875 m6,0.524803 m6,0.528441 m6,m6,0.547986 m6,0.540099 m6,0.635745 m6,0.59793 m6,0.752021 m6,0.515402 m6,0.0422875 m7,0.524803 m7,0.528441 m7,m7,0.547986 m7,0.540099 m7,0.635745 m7,0.59793 m7,0.752021 m7,0.515402 m7},{0.087142 m2,0.717493 m2,0.468623 m2,0.547986 m2,m2,0.948555 m2,0.983855 m2,0.567569 m2,0.279931 m2,0.379714 m2,0.087142 m5,0.717493 m5,0.468623 m5,0.547986 m5,m5,0.948555 m5,0.983855 m5,0.567569 m5,0.279931 m5,0.379714 m5,0.087142 m6,0.717493 m6,0.468623 m6,0.547986 m6,m6,0.948555 m6,0.983855 m6,0.567569 m6,0.279931 m6,0.379714 m6,0.087142 m7,0.717493 m7,0.468623 m7,0.547986 m7,m7,0.948555 m7,0.983855 m7,0.567569 m7,0.279931 m7,0.379714 m7},{0.130031 m2,0.86846 m2,0.602271 m2,0.540099 m2,0.948555 m2,m2,0.949142 m2,0.704131 m2,0.251512 m2,0.288572 m2,0.130031 m5,0.86846 m5,0.602271 m5,0.540099 m5,0.948555 m5,m5,0.949142 m5,0.704131 m5,0.251512 m5,0.288572 m5,0.130031 m6,0.86846 m6,0.602271 m6,0.540099 m6,0.948555 m6,m6,0.949142 m6,0.704131 m6,0.251512 m6,0.288572 m6,0.130031 m7,0.86846 m7,0.602271 m7,0.540099 m7,0.948555 m7,m7,0.949142 m7,0.704131 m7,0.251512 m7,0.288572 m7},{0.0851358 m2,0.753967 m2,0.524005 m2,0.635745 m2,0.983855 m2,0.949142 m2,m2,0.62895 m2,0.332852 m2,0.408482 m2,0.0851358 m5,0.753967 m5,0.524005 m5,0.635745 m5,0.983855 m5,0.949142 m5,m5,0.62895 m5,0.332852 m5,0.408482 m5,0.0851358 m6,0.753967 m6,0.524005 m6,0.635745 m6,0.983855 m6,0.949142 m6,m6,0.62895 m6,0.332852 m6,0.408482 m6,0.0851358 m7,0.753967 m7,0.524005 m7,0.635745 m7,0.983855 m7,0.949142 m7,m7,0.62895 m7,0.332852 m7,0.408482 m7},{0.179767 m2,0.918808 m2,0.977604 m2,0.59793 m2,0.567569 m2,0.704131 m2,0.62895 m2,m2,0.277585 m2,0.182918 m2,0.179767 m5,0.918808 m5,0.977604 m5,0.59793 m5,0.567569 m5,0.704131 m5,0.62895 m5,m5,0.277585 m5,0.182918 m5,0.179767 m6,0.918808 m6,0.977604 m6,0.59793 m6,0.567569 m6,0.704131 m6,0.62895 m6,m6,0.277585 m6,0.182918 m6,0.179767 m7,0.918808 m7,0.977604 m7,0.59793 m7,0.567569 m7,0.704131 m7,0.62895 m7,m7,0.277585 m7,0.182918 m7},{0.0135012 m2,0.227762 m2,0.242994 m2,0.752021 m2,0.279931 m2,0.251512 m2,0.332852 m2,0.277585 m2,m2,0.608161 m2,0.0135012 m5,0.227762 m5,0.242994 m5,0.752021 m5,0.279931 m5,0.251512 m5,0.332852 m5,0.277585 m5,m5,0.608161 m5,0.0135012 m6,0.227762 m6,0.242994 m6,0.752021 m6,0.279931 m6,0.251512 m6,0.332852 m6,0.277585 m6,m6,0.608161 m6,0.0135012 m7,0.227762 m7,0.242994 m7,0.752021 m7,0.279931 m7,0.251512 m7,0.332852 m7,0.277585 m7,m7,0.608161 m7},{0.0100129 m2,0.191276 m2,0.145175 m2,0.515402 m2,0.379714 m2,0.288572 m2,0.408482 m2,0.182918 m2,0.608161 m2,m2,0.0100129 m5,0.191276 m5,0.145175 m5,0.515402 m5,0.379714 m5,0.288572 m5,0.408482 m5,0.182918 m5,0.608161 m5,m5,0.0100129 m6,0.191276 m6,0.145175 m6,0.515402 m6,0.379714 m6,0.288572 m6,0.408482 m6,0.182918 m6,0.608161 m6,m6,0.0100129 m7,0.191276 m7,0.145175 m7,0.515402 m7,0.379714 m7,0.288572 m7,0.408482 m7,0.182918 m7,0.608161 m7,m7},{m3,0.204752 m3,0.20148 m3,0.0422875 m3,0.087142 m3,0.130031 m3,0.0851358 m3,0.179767 m3,0.0135012 m3,0.0100129 m3,m6,0.204752 m6,0.20148 m6,0.0422875 m6,0.087142 m6,0.130031 m6,0.0851358 m6,0.179767 m6,0.0135012 m6,0.0100129 m6,m8,0.204752 m8,0.20148 m8,0.0422875 m8,0.087142 m8,0.130031 m8,0.0851358 m8,0.179767 m8,0.0135012 m8,0.0100129 m8,m9,0.204752 m9,0.20148 m9,0.0422875 m9,0.087142 m9,0.130031 m9,0.0851358 m9,0.179767 m9,0.0135012 m9,0.0100129 m9},{0.204752 m3,m3,0.85242 m3,0.524803 m3,0.717493 m3,0.86846 m3,0.753967 m3,0.918808 m3,0.227762 m3,0.191276 m3,0.204752 m6,m6,0.85242 m6,0.524803 m6,0.717493 m6,0.86846 m6,0.753967 m6,0.918808 m6,0.227762 m6,0.191276 m6,0.204752 m8,m8,0.85242 m8,0.524803 m8,0.717493 m8,0.86846 m8,0.753967 m8,0.918808 m8,0.227762 m8,0.191276 m8,0.204752 m9,m9,0.85242 m9,0.524803 m9,0.717493 m9,0.86846 m9,0.753967 m9,0.918808 m9,0.227762 m9,0.191276 m9},{0.20148 m3,0.85242 m3,m3,0.528441 m3,0.468623 m3,0.602271 m3,0.524005 m3,0.977604 m3,0.242994 m3,0.145175 m3,0.20148 m6,0.85242 m6,m6,0.528441 m6,0.468623 m6,0.602271 m6,0.524005 m6,0.977604 m6,0.242994 m6,0.145175 m6,0.20148 m8,0.85242 m8,m8,0.528441 m8,0.468623 m8,0.602271 m8,0.524005 m8,0.977604 m8,0.242994 m8,0.145175 m8,0.20148 m9,0.85242 m9,m9,0.528441 m9,0.468623 m9,0.602271 m9,0.524005 m9,0.977604 m9,0.242994 m9,0.145175 m9},{0.0422875 m3,0.524803 m3,0.528441 m3,m3,0.547986 m3,0.540099 m3,0.635745 m3,0.59793 m3,0.752021 m3,0.515402 m3,0.0422875 m6,0.524803 m6,0.528441 m6,m6,0.547986 m6,0.540099 m6,0.635745 m6,0.59793 m6,0.752021 m6,0.515402 m6,0.0422875 m8,0.524803 m8,0.528441 m8,m8,0.547986 m8,0.540099 m8,0.635745 m8,0.59793 m8,0.752021 m8,0.515402 m8,0.0422875 m9,0.524803 m9,0.528441 m9,m9,0.547986 m9,0.540099 m9,0.635745 m9,0.59793 m9,0.752021 m9,0.515402 m9},{0.087142 m3,0.717493 m3,0.468623 m3,0.547986 m3,m3,0.948555 m3,0.983855 m3,0.567569 m3,0.279931 m3,0.379714 m3,0.087142 m6,0.717493 m6,0.468623 m6,0.547986 m6,m6,0.948555 m6,0.983855 m6,0.567569 m6,0.279931 m6,0.379714 m6,0.087142 m8,0.717493 m8,0.468623 m8,0.547986 m8,m8,0.948555 m8,0.983855 m8,0.567569 m8,0.279931 m8,0.379714 m8,0.087142 m9,0.717493 m9,0.468623 m9,0.547986 m9,m9,0.948555 m9,0.983855 m9,0.567569 m9,0.279931 m9,0.379714 m9},{0.130031 m3,0.86846 m3,0.602271 m3,0.540099 m3,0.948555 m3,m3,0.949142 m3,0.704131 m3,0.251512 m3,0.288572 m3,0.130031 m6,0.86846 m6,0.602271 m6,0.540099 m6,0.948555 m6,m6,0.949142 m6,0.704131 m6,0.251512 m6,0.288572 m6,0.130031 m8,0.86846 m8,0.602271 m8,0.540099 m8,0.948555 m8,m8,0.949142 m8,0.704131 m8,0.251512 m8,0.288572 m8,0.130031 m9,0.86846 m9,0.602271 m9,0.540099 m9,0.948555 m9,m9,0.949142 m9,0.704131 m9,0.251512 m9,0.288572 m9},{0.0851358 m3,0.753967 m3,0.524005 m3,0.635745 m3,0.983855 m3,0.949142 m3,m3,0.62895 m3,0.332852 m3,0.408482 m3,0.0851358 m6,0.753967 m6,0.524005 m6,0.635745 m6,0.983855 m6,0.949142 m6,m6,0.62895 m6,0.332852 m6,0.408482 m6,0.0851358 m8,0.753967 m8,0.524005 m8,0.635745 m8,0.983855 m8,0.949142 m8,m8,0.62895 m8,0.332852 m8,0.408482 m8,0.0851358 m9,0.753967 m9,0.524005 m9,0.635745 m9,0.983855 m9,0.949142 m9,m9,0.62895 m9,0.332852 m9,0.408482 m9},{0.179767 m3,0.918808 m3,0.977604 m3,0.59793 m3,0.567569 m3,0.704131 m3,0.62895 m3,m3,0.277585 m3,0.182918 m3,0.179767 m6,0.918808 m6,0.977604 m6,0.59793 m6,0.567569 m6,0.704131 m6,0.62895 m6,m6,0.277585 m6,0.182918 m6,0.179767 m8,0.918808 m8,0.977604 m8,0.59793 m8,0.567569 m8,0.704131 m8,0.62895 m8,m8,0.277585 m8,0.182918 m8,0.179767 m9,0.918808 m9,0.977604 m9,0.59793 m9,0.567569 m9,0.704131 m9,0.62895 m9,m9,0.277585 m9,0.182918 m9},{0.0135012 m3,0.227762 m3,0.242994 m3,0.752021 m3,0.279931 m3,0.251512 m3,0.332852 m3,0.277585 m3,m3,0.608161 m3,0.0135012 m6,0.227762 m6,0.242994 m6,0.752021 m6,0.279931 m6,0.251512 m6,0.332852 m6,0.277585 m6,m6,0.608161 m6,0.0135012 m8,0.227762 m8,0.242994 m8,0.752021 m8,0.279931 m8,0.251512 m8,0.332852 m8,0.277585 m8,m8,0.608161 m8,0.0135012 m9,0.227762 m9,0.242994 m9,0.752021 m9,0.279931 m9,0.251512 m9,0.332852 m9,0.277585 m9,m9,0.608161 m9},{0.0100129 m3,0.191276 m3,0.145175 m3,0.515402 m3,0.379714 m3,0.288572 m3,0.408482 m3,0.182918 m3,0.608161 m3,m3,0.0100129 m6,0.191276 m6,0.145175 m6,0.515402 m6,0.379714 m6,0.288572 m6,0.408482 m6,0.182918 m6,0.608161 m6,m6,0.0100129 m8,0.191276 m8,0.145175 m8,0.515402 m8,0.379714 m8,0.288572 m8,0.408482 m8,0.182918 m8,0.608161 m8,m8,0.0100129 m9,0.191276 m9,0.145175 m9,0.515402 m9,0.379714 m9,0.288572 m9,0.408482 m9,0.182918 m9,0.608161 m9,m9},{m4,0.204752 m4,0.20148 m4,0.0422875 m4,0.087142 m4,0.130031 m4,0.0851358 m4,0.179767 m4,0.0135012 m4,0.0100129 m4,m7,0.204752 m7,0.20148 m7,0.0422875 m7,0.087142 m7,0.130031 m7,0.0851358 m7,0.179767 m7,0.0135012 m7,0.0100129 m7,m9,0.204752 m9,0.20148 m9,0.0422875 m9,0.087142 m9,0.130031 m9,0.0851358 m9,0.179767 m9,0.0135012 m9,0.0100129 m9,m10,0.204752 m10,0.20148 m10,0.0422875 m10,0.087142 m10,0.130031 m10,0.0851358 m10,0.179767 m10,0.0135012 m10,0.0100129 m10},{0.204752 m4,m4,0.85242 m4,0.524803 m4,0.717493 m4,0.86846 m4,0.753967 m4,0.918808 m4,0.227762 m4,0.191276 m4,0.204752 m7,m7,0.85242 m7,0.524803 m7,0.717493 m7,0.86846 m7,0.753967 m7,0.918808 m7,0.227762 m7,0.191276 m7,0.204752 m9,m9,0.85242 m9,0.524803 m9,0.717493 m9,0.86846 m9,0.753967 m9,0.918808 m9,0.227762 m9,0.191276 m9,0.204752 m10,m10,0.85242 m10,0.524803 m10,0.717493 m10,0.86846 m10,0.753967 m10,0.918808 m10,0.227762 m10,0.191276 m10},{0.20148 m4,0.85242 m4,m4,0.528441 m4,0.468623 m4,0.602271 m4,0.524005 m4,0.977604 m4,0.242994 m4,0.145175 m4,0.20148 m7,0.85242 m7,m7,0.528441 m7,0.468623 m7,0.602271 m7,0.524005 m7,0.977604 m7,0.242994 m7,0.145175 m7,0.20148 m9,0.85242 m9,m9,0.528441 m9,0.468623 m9,0.602271 m9,0.524005 m9,0.977604 m9,0.242994 m9,0.145175 m9,0.20148 m10,0.85242 m10,m10,0.528441 m10,0.468623 m10,0.602271 m10,0.524005 m10,0.977604 m10,0.242994 m10,0.145175 m10},{0.0422875 m4,0.524803 m4,0.528441 m4,m4,0.547986 m4,0.540099 m4,0.635745 m4,0.59793 m4,0.752021 m4,0.515402 m4,0.0422875 m7,0.524803 m7,0.528441 m7,m7,0.547986 m7,0.540099 m7,0.635745 m7,0.59793 m7,0.752021 m7,0.515402 m7,0.0422875 m9,0.524803 m9,0.528441 m9,m9,0.547986 m9,0.540099 m9,0.635745 m9,0.59793 m9,0.752021 m9,0.515402 m9,0.0422875 m10,0.524803 m10,0.528441 m10,m10,0.547986 m10,0.540099 m10,0.635745 m10,0.59793 m10,0.752021 m10,0.515402 m10},{0.087142 m4,0.717493 m4,0.468623 m4,0.547986 m4,m4,0.948555 m4,0.983855 m4,0.567569 m4,0.279931 m4,0.379714 m4,0.087142 m7,0.717493 m7,0.468623 m7,0.547986 m7,m7,0.948555 m7,0.983855 m7,0.567569 m7,0.279931 m7,0.379714 m7,0.087142 m9,0.717493 m9,0.468623 m9,0.547986 m9,m9,0.948555 m9,0.983855 m9,0.567569 m9,0.279931 m9,0.379714 m9,0.087142 m10,0.717493 m10,0.468623 m10,0.547986 m10,m10,0.948555 m10,0.983855 m10,0.567569 m10,0.279931 m10,0.379714 m10},{0.130031 m4,0.86846 m4,0.602271 m4,0.540099 m4,0.948555 m4,m4,0.949142 m4,0.704131 m4,0.251512 m4,0.288572 m4,0.130031 m7,0.86846 m7,0.602271 m7,0.540099 m7,0.948555 m7,m7,0.949142 m7,0.704131 m7,0.251512 m7,0.288572 m7,0.130031 m9,0.86846 m9,0.602271 m9,0.540099 m9,0.948555 m9,m9,0.949142 m9,0.704131 m9,0.251512 m9,0.288572 m9,0.130031 m10,0.86846 m10,0.602271 m10,0.540099 m10,0.948555 m10,m10,0.949142 m10,0.704131 m10,0.251512 m10,0.288572 m10},{0.0851358 m4,0.753967 m4,0.524005 m4,0.635745 m4,0.983855 m4,0.949142 m4,m4,0.62895 m4,0.332852 m4,0.408482 m4,0.0851358 m7,0.753967 m7,0.524005 m7,0.635745 m7,0.983855 m7,0.949142 m7,m7,0.62895 m7,0.332852 m7,0.408482 m7,0.0851358 m9,0.753967 m9,0.524005 m9,0.635745 m9,0.983855 m9,0.949142 m9,m9,0.62895 m9,0.332852 m9,0.408482 m9,0.0851358 m10,0.753967 m10,0.524005 m10,0.635745 m10,0.983855 m10,0.949142 m10,m10,0.62895 m10,0.332852 m10,0.408482 m10},{0.179767 m4,0.918808 m4,0.977604 m4,0.59793 m4,0.567569 m4,0.704131 m4,0.62895 m4,m4,0.277585 m4,0.182918 m4,0.179767 m7,0.918808 m7,0.977604 m7,0.59793 m7,0.567569 m7,0.704131 m7,0.62895 m7,m7,0.277585 m7,0.182918 m7,0.179767 m9,0.918808 m9,0.977604 m9,0.59793 m9,0.567569 m9,0.704131 m9,0.62895 m9,m9,0.277585 m9,0.182918 m9,0.179767 m10,0.918808 m10,0.977604 m10,0.59793 m10,0.567569 m10,0.704131 m10,0.62895 m10,m10,0.277585 m10,0.182918 m10},{0.0135012 m4,0.227762 m4,0.242994 m4,0.752021 m4,0.279931 m4,0.251512 m4,0.332852 m4,0.277585 m4,m4,0.608161 m4,0.0135012 m7,0.227762 m7,0.242994 m7,0.752021 m7,0.279931 m7,0.251512 m7,0.332852 m7,0.277585 m7,m7,0.608161 m7,0.0135012 m9,0.227762 m9,0.242994 m9,0.752021 m9,0.279931 m9,0.251512 m9,0.332852 m9,0.277585 m9,m9,0.608161 m9,0.0135012 m10,0.227762 m10,0.242994 m10,0.752021 m10,0.279931 m10,0.251512 m10,0.332852 m10,0.277585 m10,m10,0.608161 m10},{0.0100129 m4,0.191276 m4,0.145175 m4,0.515402 m4,0.379714 m4,0.288572 m4,0.408482 m4,0.182918 m4,0.608161 m4,m4,0.0100129 m7,0.191276 m7,0.145175 m7,0.515402 m7,0.379714 m7,0.288572 m7,0.408482 m7,0.182918 m7,0.608161 m7,m7,0.0100129 m9,0.191276 m9,0.145175 m9,0.515402 m9,0.379714 m9,0.288572 m9,0.408482 m9,0.182918 m9,0.608161 m9,m9,0.0100129 m10,0.191276 m10,0.145175 m10,0.515402 m10,0.379714 m10,0.288572 m10,0.408482 m10,0.182918 m10,0.608161 m10,m10}}

where $m1, \cdots, m10$ are parameters. This matrix was constructed doing KroneckerProduct[M, K], where M is a matrix with the parameters $m1, \cdots, m10$ so that it's symmetric, i.e. $\left( \begin{array}{cccc} \text{m1} & \text{m2} & \text{m3} & \text{m4} \\ \text{m2} & \text{m5} & \text{m6} & \text{m7} \\ \text{m3} & \text{m6} & \text{m8} & \text{m9} \\ \text{m4} & \text{m7} & \text{m9} & \text{m10} \\ \end{array} \right)$, and

K={{1,0.204752,0.20148,0.0422875,0.087142,0.130031,0.0851358,0.179767,0.0135012,0.0100129},{0.204752,1,0.85242,0.524803,0.717493,0.86846,0.753967,0.918808,0.227762,0.191276},{0.20148,0.85242,1,0.528441,0.468623,0.602271,0.524005,0.977604,0.242994,0.145175},{0.0422875,0.524803,0.528441,1,0.547986,0.540099,0.635745,0.59793,0.752021,0.515402},{0.087142,0.717493,0.468623,0.547986,1,0.948555,0.983855,0.567569,0.279931,0.379714},{0.130031,0.86846,0.602271,0.540099,0.948555,1,0.949142,0.704131,0.251512,0.288572},{0.0851358,0.753967,0.524005,0.635745,0.983855,0.949142,1,0.62895,0.332852,0.408482},{0.179767,0.918808,0.977604,0.59793,0.567569,0.704131,0.62895,1,0.277585,0.182918},{0.0135012,0.227762,0.242994,0.752021,0.279931,0.251512,0.332852,0.277585,1,0.608161},{0.0100129,0.191276,0.145175,0.515402,0.379714,0.288572,0.408482,0.182918,0.608161,1}}.

With K // PositiveDefiniteMatrixQ returning True. So, Det[K] is greater than zero, and since Kronecker Product preserves positive 'definiteness', the covariance matrix will also be positive definite if M is. Even if we add an Identity matrix to the main diagonal to improve the positive 'definiteness', the problems is maintained...

(*Below is the pdf for Multivariate Normal*)
    pdfMN[mean_, covmat_, x_] := 
      Det[2*Pi*covmat]^(-0.5)*
       E^(-0.5*((x - mean).Inverse[covmat].(x - mean)));

For the x, we can use a vector of RandomReal's of conformable size (40).

How is someone supposed to maximize this then, when even Mathematica cannot write the likelihood? In my problem, I'll need to use T greater 150...

$\endgroup$
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – Kuba Dec 10 '18 at 21:03
  • $\begingroup$ Doing that does not seem appropriate ... we have now lost the context within the question. Absent same, I think it is best to vote to close. $\endgroup$ – wolfies Dec 11 '18 at 13:17
  • $\begingroup$ @wolfies I understand that at the begining it was unclear, but how come it is still unclear what I'm asking? $\endgroup$ – An old man in the sea. Dec 11 '18 at 13:53
2
$\begingroup$

This is an answer and an extended comment. I think you need to take another look at your parameterization: The covariance matrix you now have is singular.

Det[covariance]
(* 0 *)

If you had used the Likelihood or LogLikelihood function, an error message to that effect would been produced (even without checking the determinant).

Also you've given the resulting covariance matrix rather than giving $M$ and $K$ (which would seem to be an integral part of the analysis - but if not, why even mention the Kronecker product of $M$ and $K$?). Maybe the issue is with $M$ or $K$ or KroneckerProduct[M,K]. One shouldn't have to figure that out. (And giving $M$ and $K$ would take up less space than giving the covariance matrix.)

If the covariance matrix was not singular, here's one way how you could estimate the parameters:

n = 300;
SeedRandom[12345];
x = RandomVariate[NormalDistribution[0, 1], {n, 40}];
logL = LogLikelihood[MultinormalDistribution[mean, covariance], x];
FindMaximum[{logL, m1 > 0 && m2 > 0 && m3 > 0 && m4 > 0 && m5 > 0 && m6 > 0 && m7 > 0 && 
  m8 > 0 && m9 > 0 && m10 > 0},
  {c1, c2, c3, c4, c5, c6, c7, c8, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10}]

(Generally maximizing the log of the likelihood is more numerically stable than maximizing the likelihood.) But you would likely have to give starting values (other than the default starting value of 1) for at least some of the parameters.

$\endgroup$
  • $\begingroup$ JimB I hope I'm not being too forward, but it cannot be singular. The kronecker product preserves the matrices' Positive 'definiteness', i.e. if $M$ and $K$ are PD, then so will $M\otimes K$. I can assure you that K is PD. If M is a matrix full of parameters, how can mathematica say that it's singular?? $\endgroup$ – An old man in the sea. Dec 10 '18 at 17:21
  • $\begingroup$ No need to be subtle with me (although I admire and appreciate your diplomacy). I simply used Det to get the determinant of covariance and it was zero. Because you don't give specific examples (in the current version) of $M$ and $K$, one can't tell if positive definiteness is there to preserve. $\endgroup$ – JimB Dec 10 '18 at 17:26
  • $\begingroup$ JimB I've just added the K which was used. Thank you for not giving up on this question, after so many mistakes in giving you a working example. $\endgroup$ – An old man in the sea. Dec 10 '18 at 17:27
  • $\begingroup$ Good. I see $K$ but I don't see $M$. $\endgroup$ – JimB Dec 10 '18 at 17:29
  • $\begingroup$ M is just {{m1, m2, m3, m4}, {m2, m5, m6, m7}, {m3, m6, m8, m9}, {m4, m7, m9, m10}} $\endgroup$ – An old man in the sea. Dec 10 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.