# How do I produce a line of best fit for graphs when I know the function they are supposed to map to?

Asked by Ame_Evil (3041) October 29th, 2009

Hello, I am currently writing up my laboratory report and I am stuck on what to do with my graphs. At the moment I have just produced a scatter graph, but I want to include a line of best fit so I can find which value corresponds to the 75% threshold.

The lines are supposed to map towards this equation:

Y = 100.0—(50.0*(2.0^(-((X/A)^B))))

However when running Opcode (which runs bootstraps in order to match the values in my graph to that equation) failed in all attempts.

I am using excel, but wouldn’t mind downloading something free in order to do the lines of best fits. If anyone could recommend some simple software I can use, I would be grateful. At the moment I am just using MS Excel which i’m not sure if the trend lines are valid (nor which one I am supposed to use).

P.S. The equation given should produce something that looks like:

http://www.nature.com/neuro/journal/v8/n1/extref/nn1373-S2.gif

Problems are that my graphs all look different: the first two appear to be around random and the rest look curved but barely anything like that.

If you need any more information, please ask as I am not sure what I need to give.

Thanks.

Appendix: The results of the 5 conditions (values of Y, X axis = 0.002 to 0.02; increasement of 0.002; 10 values total).

51.333
43.667
61.349
64.000
64.667
58.167
49.778
66.333
48.762
62.952

54.814
43.286
61.000
33.944
48.429
52.500
65.333
58.750
57.545
52.762

33.500
37.381
39.952
61.667
41.333
47.500
42.000
54.833
85.143
87.143

50.000
48.500
39.127
45.000
59.000
35.556
63.333
70.556
88.000
95.000

56.095
74.762
78.667
86.786
100.000
96.000
92.626
96.364
100.000
100.000

Observing members: 0 Composing members: 0

Wow, it’s too bad you don’t have a graphing calculator. It’s a lot easier to find a line of best fit that way than with Excel. I’m not awesome at understanding math concepts in general, so I don’t really get what’s going on with your x-values, but I wouldn’t mind trying to figure out the line for you.

Haleth (19494)

I am not completely sure I understand what you want to do here.

But in short, the following bits might help:

1) In science, if your experimental data does not look like what it is “supposed to” map to, that’s just how life is. Data is what it is. Look for an explanation for why it looks like it does, not for a way to make it look like “it is supposed to”. Maybe you end up writing into your report that the data does not fit the suggested hypothetical curve, and that this could be explained by such-and-such. That should be fine.

2) In general, Excel does not plot functions, it plots value pairs. If you want to plot a particular function, you need to make two columns, one with values for X and then another that calculates the corresponding Y values, and then plot X vs Y. In your case, to calculate values of Y, you need values for “A” and “B” in your equation. Excel cannot figure these out for you.

(EDITed to add: ok, if you can give A and B in closed form, you can make Excel calculate them. But it’s still not the best tool for the job.)

3) “However when running Opcode (which runs bootstraps in order to match the values in my graph to that equation) failed in all attempts.” This is probably the key. I am not familiar with Opcode, but from the description it sounds like it is the way you use to find out A and B, and could not. What you want to ask yourself is why did it fail, not “can i use some other program”. Is Opcode buggy? Are your data so removed from the hypothesis that it is not believable for any number of A or B? Something else completely?

Janka (2182)

or