# Fitting a surface to 3D data

I am building a program to predict the score in a game of twenty20 cricket. I have a series of 3D datapoints, calculated from a number of games I have data for.

Along the x axis we have number of wickets a team has lost. Up the y axis we have number of runs they end up scoring. And in the z axis we have number of overs into the innings we are.

For example, one datapoint might say, we are 10 overs into the game, the team are 2 wickets down: They end up scoring 160 runs.

From this data I want to be able to plug in how many overs into a game we are and how many wickets a team has lost, and get how many runs a team are predicted to score.

I have plotted the data here (where different colour lines refer to different overs in the z axis):

As you may or may not be able to tell, in the middle of the data the lines correlate pretty well, this is because we have far more data for "average" games (e.g. where a team is 4 wickets down after 10 overs). On the edges however the data is based on very few games (e.g. where a team is no wickets down at the 19th over), where a data point seems obviously wrong to me (an outlier), I have added a dashed line to correct it.

The question is, how do I build a smooth surface which fits these points? And how do I minimize the effect of the outliers? Is there a specific name for this kind of thing?

EDIT: Now that I think about it, it's not really outliers i'm getting on the edges, just less reliable data.

• Do you mean a smooth surface for plotting purposes, such as shown here gnu.org/software/octave/doc/interpreter/… – babelproofreader Feb 27 '13 at 17:04
• Yeah that looks about right - I'm programming in java, d'ya think there's something similar? – Duane Allman Feb 27 '13 at 17:11
• Also that doesn't contain any smoothing functions. – Duane Allman Feb 27 '13 at 17:17
• Can't help with the Java question, but within Octave it would be simple to smooth the underlying matrix prior to its 3D plotting. – babelproofreader Feb 27 '13 at 21:07
• Actually smoothing is probably the wrong word, i mean fitting! – Duane Allman Mar 2 '13 at 15:57