# HW1: Maximum Likelihood Function Optimization solution

As in HW0, the basic problem here is to determine, given an input sequence of real values, which
distribution it follows. More specifically, for this assignment you are to develop a program that reads in
a numeric table, and – for each dataset (i.e., each column in the table) – determines the distribution and
parameters that gives the closest match to it.
There are two differences between HW1 and HW0:
1. in HW1, the input data are always drawn from the Gamma distribution.
2. in HW1, you must implement the Likelihood optimization yourself;
you cannot use fitdistr().
As in HW0, your program could be given an input table like this:
D1 D2 D3 D4 D5 D6
3.3713903 6.2437282 0.2138276 0.1699299 1.5583491 0.6543210
2.7725880 5.5875745 0.4583172 0.3767378 2.8429449 1.9559299
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7.2775941 5.2902876 0.9740191 2.6121070 5.9899608 6.7003783
The columns of this table define six datasets. Your program should produce a CSV file HW1_output.csv
giving distributions that (it thinks) best fit the data. A correct output file could then look like this:
gamma,3,1
gamma,3,2
gamma,3,3
gamma,3,4
gamma,3,5
gamma,3,6
For simplicity, the parameters used in this assignment will always be integers, so the printed output should
always have integer parameter values.
Your program can determine the distribution that fits best in any way you like. However, the notebook
sketches a way to do this, and gives orientation about how to solve this problem in R.
In other words: yes, this is another simple assignment. It is intended as a warmup.
After running your program on the test input file HW1_test.csv, to complete this assignment please