Linear Fit

I tried using this to get the linear fit, but it does not seem to work well.
The data that I’m trying to do the fit on looks like:


in scatter points, and the regression line looks like:

The code for the scatter points and the fitting process is as follows:
scatter( time_list_r_05[1:end]*tf_small/length(sol_r_05) , P_r_05[1:end] )

b_05 = ( time_list_r_05[1:end]tf_small/length(sol_r_05)) \ P_r_05[1:end]
f_05(x) = 1-b_05
x
plot!(f_05 , 0 , time_list_r_05[end]*tf_small/length(sol_r_05), label=“regular linear fit using ''”)

I’m not sure if I’ve used this fitting method correctly. Thanks!