Advanced Curve Fitting App

Complete user guide — data entry, curve selection, result interpretation, prediction, and reporting

v1.2.0

Contents

  1. App overview
  2. Interface layout
  3. Entering data
  4. Curve types explained
  5. Fitting curves & reading results
  6. Chart interpretation
  7. Evaluate at a custom point
  8. Import & export data
  9. Print reports
  10. Example data sets
  11. Tips & best practices
  12. FAQ

1. App Overview

The Advanced Curve Fitting App is a self-contained, browser-based tool that lets you enter or import X–Y data, automatically fit one or more mathematical curves to that data, visualize all curves on an interactive chart, and export polished statistical reports.

Key capabilities at a glance:

No installation required. Open cfav120.html in any modern browser (Chrome, Firefox, Edge, Safari). Everything runs locally — no internet connection or server is needed.

2. Interface Layout

The app uses a two-column layout. The left column contains all controls; the right column shows the chart and results.

Left panel — Controls

📝 Data title field
📊 X, Y data textarea
📤 Import / Export button
📊 Example Data button
🔢 Polynomial degree selector (1–5)
☑ Polynomial checkbox
☑ Exponential checkbox
☑ Logarithmic checkbox
☑ Power checkbox
📈 Fit Curves button
🖨 Print Basic / Advanced Report
🗑 Clear All button
🔍 Evaluate at custom point
📈 Scatter plot + overlaid fitted curves
Polynomial (Quadratic) · y = 2.3x² + 1.1x + 0.5 · R² = 0.9981 · Excellent
Exponential · y = 1.18·e^(0.48x) · R² = 0.9912 · Excellent

3. Entering Data

3.1 Manual entry

Type or paste your data directly into the large text area labeled Enter X, Y data. Each row represents one data point. The required format is:

x_value, y_value

Example — six data points:

1, 2.1
2, 4.8
3, 11.0
4, 20.9
5, 35.5
6, 55.2
Common mistakes to avoid Use a comma to separate X and Y — not a tab or space. Each data point must be on its own line. At least 2 data points are required; polynomial regression of degree D requires at least D + 1 points.

3.2 Load built-in example

Click 📊 Example Data to instantly load an 11-point exponential-growth dataset (x = 0 to 10). This is a good starting point to explore all features before working with your own data.

3.3 Import from file or clipboard

Click Import / Export to open the Import/Export modal, then use one of these methods:

Accepted CSV format (first line with an x header is optional and ignored):

# Title: My Experiment
x,y
1, 3.2
2, 7.8
3, 18.1

Accepted JSON format:

[{"x": 1, "y": 3.2}, {"x": 2, "y": 7.8}, {"x": 3, "y": 18.1}]

Or the titled JSON format (preserves the dataset name):

{"title": "My Experiment", "data": [{"x": 1, "y": 3.2}, ...]}

3.4 Data title

Enter a descriptive name in the Data Title field above the data textarea. This title appears in all exported files and printed reports.

4. Curve Types Explained

Check one or more of the four curve families before clicking Fit Curves. You can run all four simultaneously and compare R² values to find the best model.

CurveColorEquation formRequirementsBest for
Polynomial Blue y = a₀ + a₁x + a₂x² + … n ≥ degree + 1 points General shapes; peaks & valleys; parabolas
Exponential Green y = a · ebx All y values must be > 0 Rapid growth or decay; population; radioactive decay
Logarithmic Orange y = a · ln(x) + b All x values must be > 0 Diminishing returns; learning curves; sound intensity
Power Purple y = a · xb All x > 0 and all y > 0 Allometric scaling; Kepler's law; tool wear rates

Polynomial degree selector

When Polynomial is checked, choose the degree from the drop-down:

Tip: Start with degree 2. Higher degrees can overfit noisy data — they produce a great R² on the original points but may curve wildly between them. If R² barely improves going from degree 2 to 3, stick with 2.

5. Fitting Curves & Reading Results

1

Enter data and set a title

Type or import your X, Y values. Give the dataset a meaningful name in the title field.

2

Choose curve types and polynomial degree

Tick one or more checkboxes. If you're unsure, tick all four — the app will fit and display each independently.

3

Click "Fit Curves"

The app runs regression for all selected curve types and redraws the chart with overlaid curves.

4

Read the results panel

Below the chart, each fitted curve gets a result card showing its equation, R² value, and a quality rating.

Understanding the result card

Each card looks like this:

Polynomial (Quadratic)
Equation: y = 2.312045x² + 1.088312x + 0.512481
R² value: 0.998142
Fit quality: Excellent

R² — goodness of fit

R² (coefficient of determination) measures how well the curve explains the variance in your data. It ranges from 0 to 1 (or can be negative for very poor fits).

R² rangeQuality labelWhat it means
> 0.95ExcellentCurve explains >95 % of the variance — very strong fit
0.80 – 0.95GoodStrong fit, minor unexplained variation
0.50 – 0.80ModeratePartial fit; may be missing variables or wrong curve type
< 0.50PoorCurve does not describe the data well; try a different type

6. Chart Interpretation

The canvas chart auto-scales to fit your data range with 10% padding on each axis. Grid lines, axis tick labels, and all fitted curve overlays are drawn automatically.

Each curve is plotted with 300 sample points across the data range, so even highly curved models render smoothly. Logarithmic and Power curves are only plotted for x > 0.

Tip: Visually assess the residuals. Look at how far the data dots sit from each curve line. A good fit has dots scattered randomly on both sides of the line. If they are systematically above the line on the left and below on the right, your curve type may be wrong.

7. Evaluate at a Custom Point

The Evaluate at Custom Point panel (bottom of the left column) lets you predict the Y value for any X across all currently fitted curves — useful for interpolation and extrapolation.

How to use it

  1. Fit your curves first (click Fit Curves).
  2. In the X value box, enter the X coordinate you want to predict at.
  3. Optionally enter an Expected Y value if you have a measured result you want to compare against.
  4. Click Calculate.

Output

The results box shows the predicted Y from every fitted curve. If you supplied an Expected Y, it also shows the absolute difference and percentage error for each curve — handy for ranking which model is most accurate at that specific point.

Example output (x = 11, Expected Y = 130):
polynomial: y = 129.321462 (diff: -0.678538, 0.52% error)
exponential: y = 131.042915 (diff: +1.042915, 0.80% error)
logarithmic: y = 104.732194 (x must be > 0 — OK)

8. Import & Export Data

Open the Import/Export modal by clicking Import / Export in the control panel.

Exporting

Importing

9. Print Reports

You must fit at least one curve before printing. Two report formats are available:

Basic Report

A two-page print layout containing:

Advanced Statistical Report

A comprehensive multi-page report that adds:

Use AIC/BIC for model selection. Lower AIC (Akaike Information Criterion) or BIC (Bayesian Information Criterion) indicates a better balance between fit quality and model complexity. If exponential and polynomial both have excellent R², the one with lower AIC is preferable.

10. Example Data Sets

The following ready-to-use data sets demonstrate each curve type. Copy any block below and paste it into the data textarea, then click Fit Curves.

Example A — Exponential Growth (built-in example)

Simulates a bacterial population doubling roughly every 2 time steps. Exponential fit should score ≥ 0.99.

0, 1.2
1, 2.5
2, 5.1
3, 10.2
4, 17.8
5, 26.5
6, 37.1
7, 51.2
8, 66.8
9, 85.1
10, 105.5
Best curveExpected equationExpected R²
Exponentialy ≈ 1.18 · e0.484x≈ 0.9985

Example B — Quadratic (Projectile Height)

Represents the height of a ball thrown upward over time. Quadratic polynomial should dominate.

0, 0
0.5, 12.3
1.0, 19.8
1.5, 22.6
2.0, 20.1
2.5, 12.9
3.0, 1.2
Best curveExpected equationExpected R²
Polynomial degree 2y ≈ −9.8x² + 24.5x + 0.1≈ 0.9997

Example C — Logarithmic (Learning Curve)

Diminishing performance gains with practice — a classic logarithmic shape. All X values must be > 0.

1, 15.0
2, 21.0
4, 27.5
8, 34.0
16, 40.5
32, 47.0
64, 53.5
128, 60.0
Best curveExpected equationExpected R²
Logarithmicy ≈ 9.12 · ln(x) + 15.0≈ 0.9999

Example D — Power Law (Tool Wear)

Tool wear rate modelled by a power law. Both X and Y must be positive.

1, 0.50
2, 0.71
3, 0.87
5, 1.12
8, 1.41
12, 1.73
20, 2.24
50, 3.54
Best curveExpected equationExpected R²
Powery ≈ 0.50 · x0.500≈ 0.9999

Example E — Noisy Real-World Data (Multi-model comparison)

A realistic dataset with measurement noise. Use this to practice comparing all four models and using AIC/BIC for selection.

1, 3.8
2, 8.1
3, 14.7
4, 18.3
5, 29.2
6, 39.5
7, 52.1
8, 68.4
9, 87.3
10, 112.0
11, 131.5
12, 165.2
CurveTypical R²Notes
Polynomial deg. 2~0.994Strong fit; slight undershoot at extremes
Exponential~0.998Best fit — data is fundamentally exponential
Logarithmic~0.915Poor at high X — does not capture growth rate
Power~0.984Good but not as tight as exponential

Try evaluating at x = 13 with expected Y = 200 using the Evaluate panel to see which model predicts best beyond the data range.

11. Tips & Best Practices

Choosing the right model

Data grows slowly then levels off

→ Try Logarithmic first. Classic for learning curves, signal attenuation, and diminishing returns.

Data doubles (or halves) at a constant rate

Exponential. Populations, radioactive decay, compound interest.

Data has a peak or valley

Polynomial degree 2 or 3. Projectiles, profit functions, resonance curves.

Ratio of y-values equals ratio of x-values raised to a power

Power law. Kepler's orbit periods, metabolic rates, fracture mechanics.

Avoiding overfitting with polynomial

A degree-5 polynomial through 6 data points will achieve R² = 1 by passing through every point exactly — but it will oscillate wildly between them and make terrible predictions. As a rule:

When a curve can't be fitted

Saving your work

The app has no internal save function. To preserve work between sessions:

  1. Click Import / Export → Export as JSON. The JSON (including your title) is copied to the clipboard.
  2. Paste it into a text file and save it with a .json extension.
  3. Next session, use Import → Upload File or paste the JSON text to restore everything.

12. FAQ

Why is my R² negative?

A negative R² means the fitted curve is a worse predictor than simply using the mean of Y. This usually happens when the selected curve type is completely wrong for the data shape — for example, fitting a logarithm to data that clearly grows exponentially.

Why does the Power curve disappear from the chart?

Power and Logarithmic curves are undefined for x ≤ 0. If your data range includes zero or negative X values, those portions of the curve are simply not drawn. The regression coefficients are still calculated from the valid (positive X) portion of your data.

Can I fit more than four curves?

The app supports exactly four model families. To explore additional model families (e.g., Gompertz, logistic, Gaussian), the data would need to be analysed in a dedicated statistics package.

The Print button opens a print dialog but the chart is missing.

Some browser pop-up blockers interfere with the print-preview window. Ensure pop-ups are allowed for the file URL. Alternatively, use Print Advanced Report, which embeds the chart as a canvas copy.

I pasted CSV but got "No valid data points found".

Check that: (1) commas separate X and Y (not semicolons or tabs); (2) there are no empty lines at the start; (3) decimal numbers use a period, not a comma (i.e., 3.14 not 3,14).

What algorithm is used for polynomial regression?

The app builds the normal equations (Xᵀ·X)·β = Xᵀ·Y and solves them using Gaussian elimination with partial pivoting. Exponential, Logarithmic, and Power regressions are linearised via logarithmic transformation and then solved as degree-1 polynomial problems.