is it possible to show a best fit line

i am plotting percent fructose V.S density and trying to do a best fit line. A connect the dots jagged line would not be appropreate. Is it possibleto do this?

Black MacBook, Mac OS X (10.4.10)

Posted on Sep 15, 2007 12:32 PM

Reply
7 replies

Sep 15, 2007 3:51 PM in response to sm0thmove

Short answer: No. Wait to see what the next version brings. The only real work-around is to add a data set using the same x values and new y values, predicted from the linear regression. You would then have to draw a line over the resulting plot points manually. Then, "hide" the extra data set by eliminating the data point fill and outline.

Only help I can offer is to look in your Utilities folder for an app named "Grapher." It can do everything you ask (and then some) and also produces high quality graphs as well (which can be copied and pasted into other apps in a variety of formats). Best of all, it's free and you probably already have it. It plots both discrete data sets as well as true functions. And yes, it will do linear regressions (and power, exponential, polynomial, and "custom" ones as well).

Unfortunately, iWork's charting abilities are best described as "laughably pathetic." In stead of revolutionizing the charting aspect of spreadsheets, Apple chose to follow in M$'s footsteps, aka the path of a sado-masochistic CPA or "the Excel way." In essence, Numbers is only capable of producing what I call "bin count" charts (as in pie charts, bar graphs, and line/area charts). The "scatterplots" Numbers produces are really a hacked version of bin count charts. As such, they are basically useless for real scientific/engineering/mathematic plots. In fact, it does them so badly, I'm surprised the "scatterplot" option even made the cut for the final release.

Things that breaks/cripples Numbers' "scatterplot":
• No control over range of axis. "Value Axis Format" controls don't function properly/always remain blank and there is only one set of values for both axis (just like a bin count chart, whose "x axis" has no real, numerical value; so, doesn't need any controls). And there is no way to lock the scale of the axis so, for example, 10 units on the x axis is the same physical distance as 10 units on the y axis.
• Axis grid divisions are only allow to be integers between 1 and 10 (which only makes sense for a bin count plot).
• No 3D, log, log-log, ln, ln-ln, cylindrical, or spherical plots.
• No true function plots. And there is no way to connect points, it only plots discrete data sets.
• No control of data point marker sizes, only the fill/outline color and outline thickness.
• Chart legend gets it's text from the independant variable (aka x values) column title, not the dependant (y value) column title, like it should. (Something that only makes sense on a bin count chart, which usually only have one column of data per data set.)
• Each data set must come from adjacent pairs of columns. (You can't have one set of x values for a table of multiple y values.)
• No way to control the size of the plot area itself (only the overall size of the chart rectangular area, which includes the axis text). So you can't fake a line chart as an overlay over a scatterplot, there's no way to align them.
• Only does linear regressions directly (and then you have to put it together from pieces). No exponential, log, ln, power, or polynomial fits.
• Charting brings Numbers to it's knees as far as speed is concerned.
• I haven't found a way to ADD a data set to chart, it always seems to replace the data already plotted (or am I missing something or fighting a bug?).

Heck, there isn't even error bars on it's financial charts, so you can't even do a simple high-low-close stock price tracking, line chart. Other than that, it you want a 2 1/2D pie chart with wood grain texturing, Apple's got you covered!

Scott

P.S. Just in case those of you reading this think I'm an Apple/Numbers hater, you couldn't be more wrong. I'm a huge fan of Numbers and it has permanently bumped Excel off of my dock. (I just don't use it for charting.) I call'em like I see 'em. And Apple can't fix it if they don't know it's broken.

Sep 17, 2007 9:42 AM in response to sm0thmove

Heres the basic equations you need. You need to cerate a line in the form of y=mx+b

n=count of data points

m=(n(sum(X*Y)-(sum x)(sum y))/(n(Sum (x^2)-(sum x)^2)
b=((sum y)- m(Sum x))/n

Set y=0 and solve for x then make a table with the number of data points you want to plot (two is fine) and plot it on top of the other in a scatter plot.

I did this in excel this way. I created my data in columns labelled X and Y. then created columns for XY and X^2 then used those ranges in my equations.

There is also another calcualtion that computes how closely the data points fall in relation to the line of best fit, but its a mess to try to write here. I will have to use OpenMath and try to make a picture or pdf of it and post it later.

Hope this helps a little bit,
Jason

Sep 18, 2007 4:09 AM in response to ScottKitts

I agree that Numbers needs a lot of work, but that I also like it. It took me a while to figure out the answer to one of the issues you mention, so perhaps you and other people are not aware of it. It /is/ possible to control the two axes independently; if you click on the axis of a chart, including scatter chart, that axis can be highlighted separately. Using the 'Minimum', 'Maximum' and 'Steps' controls at this point affects only the chosen axis, so you can for instance get integer or other reasonable tick separation on each axis. I think this is why the boxes return to a blank state; they actually contain multiple values. I'm not sure what you mean by having a non-integer number of grid divisions, though. A non-integer number of tick marks?

On some other points, I find it useful for the data in a scatter plot to 'Merge cells' on the two column headers to name the data set as a whole; in this sense the data name comes from the one merged cell, not the independent variable like you say. Not necessarily the best answer, but it makes some sense. As for adding data to a chart, if you add column pairs to the table being used for the plot, then you should be able to add them. For example, highlight two columns to make a scatter chart. Click on the chart, and the data is highlighted in the table, with a small circle at the bottom right. Drag that circle two columns to the right, and that data becomes part of the plot.

Hope this answers /someone's/ question!

Craig.

Sep 18, 2007 12:22 PM in response to tilaglar

Thanks for the heads up on the axis range control. Not exactly what you'd call intuitive. The really weird part is if you don't sub-select an axis Number will accept an entry anyway. Numbers will then decide for itself which axis you meant when you enter a value for (and then go blank again). I consider this a bug (or really sloppy programing). They should provide a set of entry boxes for both axis when you select a scatterplot (the inspector pallet morphs for everything else, why not a scatterplot); or, data entry into the one set of data boxes should be disabled completely (and grayed out in the inspector pallet) until either axis is sub-selected.

The integer part of the number of grid divisions wasn't important (though, by the way Numbers does it, a real possibility. Would a min. of 0 max. of 1.5, 1.5 divisions would put major gird lines at 0, 1, and 1.5? I can't tell.). It was the fact that you could only pick a number between 1 and 10. Very limiting. And it's kind of an odd/back-handed way of doing it. I would rather have more explicit control over major/minor grid divisions.

As for adding data to a scatterplot, I've only been able to get it to work if I already have more than one series in the chart. It doesn't seem to work for me if there was only one to begin with.

I guess the real problem is Apple's philosophy. They believe in over simplifying everything. While it is an admirable trait for a lot of things (the simplicity of working in the rest of Numbers is a boon. I don't even remotely miss Excel.), it just doesn't work for some things. And Scientific/Engineering plots ("scatterplot charts" to CPAs) is definitely one of them. Or perhaps they're looking at it from the wrong perspective: that of an accountant, rather than an engineer/scientist/mathematician.

Hopefully, we won't have to wait until iWork '09 for a fix.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

is it possible to show a best fit line

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.