
1. Re: Best fit line for linear regression
Zhouyi Zhang Nov 6, 2018 3:21 AM (in response to Manoj Lobo) 
2. Re: Best fit line for linear regression
Sasha Hanna Nov 6, 2018 3:28 AM (in response to Manoj Lobo)Hi Manoj,
Simply drag and drop a trend line from the analytics pane onto your visualisation (Add Trend Lines to a Visualization  Tableau). The model will be available when you hover over. You can also if use R within Tableau to compute the coefficient values if you need them for further analysis.
Cheers,
Sasha

3. Re: Best fit line for linear regression
Manoj Lobo Nov 6, 2018 4:35 AM (in response to Zhouyi Zhang)Hi ZZ,
Thanks a lot for the quick reply.
I have already tried with the trend lines as shown and also from the analytics pane as well, but the model accuracy is very poor. So I want to plot a line which follows most of the data points.
I want to know if there's any workaround with the trend lines so as to get the desired result.
Thanks,
Manoj

4. Re: Best fit line for linear regression
Zhouyi Zhang Nov 6, 2018 4:40 AM (in response to Manoj Lobo) 
5. Re: Best fit line for linear regression
Manoj Lobo Nov 6, 2018 4:41 AM (in response to Sasha Hanna)Hi Sasha,
Thanks a lot for the quick reply.
I have tried adding the trend lines from the analytics pane. As I said, the model accuracy is pathetic. So I want to plot a line which follows most of the data points.
Also can you suggest me an idea to calculate the coefficient values in tableau using R?
Thanks,
Manoj

6. Re: Best fit line for linear regression
Manoj Lobo Nov 6, 2018 5:08 AM (in response to Zhouyi Zhang) 
7. Re: Best fit line for linear regression
Zhouyi Zhang Nov 6, 2018 5:28 AM (in response to Manoj Lobo)1 of 1 people found this helpfulHi, Manoj
If you prefer using python for a better accuracy, probably below link will help
Leverage the power of Python in Tableau with TabPy  Tableau Software
ZZ

8. Re: Best fit line for linear regression
Manoj Lobo Nov 6, 2018 6:09 AM (in response to Zhouyi Zhang)Hi ZZ,
Thanks for sharing the link
I am yet to use R or python in Tableau, so after establishing the connection between Tableau and Python (or R). What type of table calculation would allow me to get the desired plot?
Or is there a way where I can use calculated field and manually calculate the line of best fit in tableau. If there's a way it would be an ideal one in this case.
Thanks,
Manoj

9. Re: Best fit line for linear regression
Sasha Hanna Nov 6, 2018 7:13 AM (in response to Manoj Lobo)Hi Manoj,
I've used this resource to set up the Logistic regression using R many times Logistic Regression in Tableau using R  Bora Beran. If you want further clarification on how to set up the R connection make sure you watch this video: How to Integrate R and Tableau.
Good luck!
Cheers,
Sasha