# how can I make a trend line fit close to (0,0) but not include (0,0) in my data?

I have five data sets, {4.88281 10^(-5), 0.0788}, {9.76563 10^(-5), 0.1014}, {0.000195313, 0.12455}, {0.000390625, 0.15594}, {0.0015625, 0.18587}. I was using EXCEL to add the trendline, but the x intercept is a negative value. I wanted to fit the trendline close to zero but don't include (0,0) in my plot, can I get this done with Mathematica?

Thanks!

• You need to specify a model. I suspect you want $y=a+b*\log x + \epsilon$ where $\epsilon \sim N(0,\sigma^2)$. If so consider LinearModelFit or NonlinearModelFit.
– JimB
Jul 23, 2020 at 21:20
• In FindFit[data,{expr,cons},pars,vars] , you can add a constraint. Jul 23, 2020 at 21:28

data = {{4.88281 10^(-5), 0.0788}, {9.76563 10^(-5), 0.1014}, {0.000195313, 0.12455},
{0.000390625, 0.15594}, {0.0015625, 0.18587}};

lm = LinearModelFit[data, Log[x], x]
Show[ListLogLinearPlot[data],
LogLinearPlot[lm[x], {x, Min[data[[All, 1]]], Max[data[[All, 1]]]}]] Show[ListPlot[data],
Plot[lm[x], {x, 0, Max[data[[All, 1]]]}, PlotRange -> All]] 