Does anybody know how to show the R-squared for scattered polynomial trend line?

48 views
Skip to first unread message

Zhenyu Hu

unread,
Oct 9, 2014, 2:40:25 PM10/9/14
to google-visua...@googlegroups.com
Dear All,

I am using google chart api to draw a scattered polynomial trend line.

I can get the trend line equation through the API, but I also want to know the R square which is used to measure the minimum distance of scattered points to the regression line.
Does anyone know how to show the R square?

Thanks a lot,

Andrew Gallant

unread,
Oct 9, 2014, 9:18:35 PM10/9/14
to google-visua...@googlegroups.com
The R-squared value is not available from the visualization API, you will have to calculate it yourself.

Zhenyu Hu

unread,
Oct 9, 2014, 9:23:09 PM10/9/14
to google-visua...@googlegroups.com
Hi Andrew,

Thanks for the feedback, I appreciate it!

Kevin

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/Q5D281P0cRE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Sergey Grabkovsky

unread,
Oct 10, 2014, 9:34:54 AM10/10/14
to google-visua...@googlegroups.com
Hi Zhenya, what Andrew said wasn't entirely correct. You can show the R square in the legend, but you have to make sure that you have enough space. Here is an example: http://jsfiddle.net/g7hz9ydL/

The option showR2 is what you're looking for.

You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

Zhenyu Hu

unread,
Oct 10, 2014, 2:55:01 PM10/10/14
to google-visua...@googlegroups.com
Hi Sergey,

Thanks a lot, it works!!!
There is a parameter "showR2: true" under trendlines options, but why this parameter doesn't show up on their documentation, how do yo find it?

Thanks,
Kevin

Jon Orwant

unread,
Oct 10, 2014, 8:44:28 PM10/10/14
to google-visua...@googlegroups.com
Documentation for showR2 will go live next week.

Jon

Zhenyu Hu

unread,
Oct 10, 2014, 8:45:45 PM10/10/14
to google-visua...@googlegroups.com
wow, that's great, thanks!

Jon Orwant

unread,
Oct 18, 2014, 1:37:08 PM10/18/14
to google-visua...@googlegroups.com
Coefficients of determination now documented at https://developers.google.com/chart/interactive/docs/gallery/trendlines#r2.

This works for all Google Charts that support trendlines: bar, column, scatter, and line.

Enjoy!

Jon

Zhenyu Hu

unread,
Oct 18, 2014, 1:42:57 PM10/18/14
to google-visua...@googlegroups.com

thanks a lot

Reply all
Reply to author
Forward
0 new messages