Re: working with likelihood functions



> I continue to have problems solving for zeroes of the
> derivatives, apparently because the summation is not being 
> broken up into multiple summations.

Yes, that is the problem.  Try declare(sum,linear), then resimplifying
using expand, and *then* solving.  See transcript below.

By the way, it is best to remove tabs from Maxima displays in email,
since different systems display tabs differently, and then when your
text is quoted with ">", it gets even more garbled.  Alternatively, show
the linear form in Maxima (using display2d:false).

--------------------------------------------

(C1) declare(sum,linear);
(D1)                               DONE
(C2) loglik_1 : 'log(1/sqrt(2 * %pi) * 1 / sigma * exp(-1/(2*sigma^2) *
(x[i] - mu)^2));
                                            2
                                   (x  - MU)
                                     i
                                 - ----------
                                           2
                                    2 SIGMA
                               %E
(D2)                   LOG(-----------------------)
                           SQRT(2) SQRT(%PI) SIGMA
(C3) loglik : 'sum(loglik_1, i, 1, n);
                                               2
                                      (x  - MU)
                                        i
                                    - ----------
                     n                        2
                    ====               2 SIGMA
                    \             %E
(D3)                 >    LOG(-----------------------)
                    /         SQRT(2) SQRT(%PI) SIGMA
                    ====
                    i = 1
(C4) diff(loglik,mu);
                              n
                             ====
                             \
                              >    x  - MU n
                             /      i
                             ====
                             i = 1
(D4)                         ---------------
                                      2
                                 SIGMA
(C5) solve(%,mu);
                                    n
                                   ====
                                   \
                                    >    x
                                   /      i
                                   ====
                                   i = 1
(D5)                         [MU = --------]
                                      n
(C6) diff(loglik,sigma);
                                                            2
                                                   (x  - MU)
                                                     i
                                                 - ----------
                                                           2
                              n              2      2 SIGMA
                             ====   (x  - MU)  %E
                             \        i
(D6) SQRT(2) SQRT(%PI) SIGMA  >    (-------------------------
                             /                             4
                             ====   SQRT(2) SQRT(%PI) SIGMA
                             i = 1

                                                     2
                                            (x  - MU)
2
                                              i                (x  - MU)
                                          - ----------           i
                                                    2
----------
                                             2 SIGMA                   2
                                        %E                      2 SIGMA
                                 - ------------------------) %E
                                                          2
                                   SQRT(2) SQRT(%PI) SIGMA

(C8) expand(d7);
                                     n              n
                                    ====           ====
                                    \              \      2
                                 2 ( >    x ) MU    >    x
                                    /      i       /      i
                          2         ====           ====
                  n     MU  n       i = 1          i = 1
(D8)          - ----- + ------ - --------------- + --------
                SIGMA        3            3              3
                        SIGMA        SIGMA          SIGMA
(C9) solve([d8,d4],[mu,sigma]);
             n                         n              n
            ====                      ====           ====
            \                         \      2       \        2
             >    x             SQRT(( >    x ) n - ( >    x ) )
            /      i                  /      i       /      i
            ====                      ====           ====
            i = 1                     i = 1          i = 1
(D9) [[MU = --------, SIGMA = - --------------------------------], 
               n                               n

                       n                       n              n
                      ====                    ====           ====
                      \                       \      2       \        2
                       >    x           SQRT(( >    x ) n - ( >    x ) )
                      /      i                /      i       /      i
                      ====                    ====           ====
                      i = 1                   i = 1          i = 1
                [MU = --------, SIGMA =
--------------------------------]]
                         n                             n
(C10)