1 MAT013 Coursework

Deadline: 8/5/2013 at 0900

1.1 Instructions

The outputs of this coursework will be:

1.2 Coursework

  1. Using both SAS and R (in other words attempt this question using SAS and then using R):

    Write code (in SAS: a macro, in R: a function) that will reproduce a mathematical procedure covered in MAT001 or MAT002. Clearly document this procedure in your report.


  2. Using SAS:

    The data files Greedy.csv, Random.csv, Longest.csv and Shortest.csv contain data relevant to the experimental play of 4 strategies for the game Shut the Box (you do not necessarily need to know of this game to complete this coursework).

    The four strategies will be referred to as:

    The data file contains two variables for each strategy: Score and Length. The aim of the game is to have the lowest score (a minimum of 0).

    1. Obtain plots of the distribution of the Score variable for each strategy (represent these distributions on the same graph);
    2. Obtain plots of the distribution of the Length variable for each strategy (represent these distributions on the same graph);
    3. For each method are Score and Length related?
    4. Do the strategies give different outcomes and if so which strategy seems to be the best?


  3. Using R:

    Write a function that will return the \(n\)th Fibonacci number, \(F(n)\).

    Modify the function so that it returns the \(n\)th number of the sequence defined by:

    \[\begin{aligned} K(0)&=a\\ K(1)&=b\\ K(n)&=\alpha K(n-1)+\beta K(n-2)\\ \end{aligned}\]

    Where \(a,b,\alpha\) and \(\beta\) are input parameters.

    Adapt your function so that it will write all numbers of the form \(K(n)\) less than some number \(k\) to a csv file. The name of the csv file must not be an input parameter to the function but include the parameters \(a,b,\alpha\) and \(\beta\) as well as the date on which the code was run. For example: general_fib_for-a=2-b=3-alpha=10-beta=-2_1984-14-02.csv.


  4. Using SAS or R.

    The file Solution_Space_Exploration.csv contains experimental results pertaining to two approaches to solving an optimisation problem (aiming to minimize a cost function). These two approaches will be referred to as approach A and approach B. Approach B involves searching a space that contains the solution space that approach A searches. Thus approach B can at least match approach A.

    Every row of the data file corresponds to a given instance of the optimisation problem and contains 6 variables which are (in order):

  1. Give summary statistics for all the variables. [5]
  2. Obtain a 3 dimensional representation (eg surface or contour) showing the proportion of times that method B finds a better solution based on the dimensions of the problem. [5]
  3. Obtain a distribution of the gains made by method B over method A. [10]
  4. Explore and attempt to indicate parameters that influence the performance of either method (and when method B is better). [10]