Recent

Author Topic: Tchart Log10 transformation  (Read 2100 times)

flori

  • Full Member
  • ***
  • Posts: 196
Tchart Log10 transformation
« on: March 01, 2021, 11:13:53 am »
Hi!
Does anyone know why can not I see the y side log10 value? (after run I doesent see left side value). In principle, the data is transformed.
I set: log base: 10, left side: transformation: ChartAxisTransformations and SPline y: on left

function Log10 ( const Number : Extended ) : Extended; (I'm not using it now) //
Thank u

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Tchart Log10 transformation
« Reply #1 on: March 01, 2021, 12:56:30 pm »
You chart looks correct. The axis displays the original values - TAChart calles them "axis coordiates", but the marks are plotted in an invisible coordinate system defined by the logarithms ("graph coordinates"). So, when the y value of your data is 100 the displayed "axis coordinate" is 100, but the "graph coordinate" is log10(100) = 2.

I understand your question such that you do not want the axis to be labelled with the "axis" values , e.g., 1, 10, 100, 100, but with their logs, 1, 2, 3, the "graph" values.

This is not done by the axis transformation.

If you want to have logs on the axis you must calculate the logs by yourself, and must NOT use an axis transformation. -- see the second chart in the attached modified project.

Please note that fitting to data have a different meaning in both cases. Suppose your data follow an exponential function (y = exp(x)). When you use a log axis transformation the correct way to fit thiese data with a TFitseries is by setting FitSeries.FitEquation to feExponential - this will result in a straight line in the log chart.

However when you plot precalculated logs and do NOT use an axis transformation you must use FitEquation = felinear to get a straight line.

flori

  • Full Member
  • ***
  • Posts: 196
Re: Tchart Log10 transformation
« Reply #2 on: March 01, 2021, 03:16:13 pm »
Wp many thank you.
Yes I know the data  different meaning in both cases.
We often use in statistics, the Kolmogorov–Smirnov test (nonparametric test of the equality of continuous/for a given cumulative distribution function F(x) is) ---unfortunately, it often has to be transformed as well
Thank you

flori

  • Full Member
  • ***
  • Posts: 196
Re: Tchart Log10 transformation
« Reply #3 on: March 01, 2021, 03:26:20 pm »
WP: The FitSEries can also calculate R? When the fit equation is (for example R2 = 0.93) how can I put R2 on the line? or how can I show it



wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Tchart Log10 transformation
« Reply #4 on: March 01, 2021, 03:35:43 pm »
WP: The FitSEries can also calculate R?
Yes. Look at TFitSeries.FitStatistics (https://wiki.lazarus.freepascal.org/TAChart_documentation#Fit_series).

When the fit equation is (for example R2 = 0.93) how can I put R2 on the line? or how can I show it
Which "line"? TFitSeries only provides the value, you can choose any way to display it (in the Chart.Foot, in a label, in a MessageBox, in a memo, ...) The fitdemo project in (lazarus)/components/tachart/demo/fit is rather versatile. (After having put some work into LazStats (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/applications/lazstats/) I have some doubt whether the calculation of the confidence levels in TAChart is correct.).

flori

  • Full Member
  • ***
  • Posts: 196
Re: Tchart Log10 transformation
« Reply #5 on: March 01, 2021, 04:41:13 pm »
Thank you. We often use R-stat and SPSS. (within that ANOVA, MANOVA, NON p.menthod, Chi-square Test ) I will try LazStats

Do u know how to refer FitEquation (fePolynomial, feCustom, feLinear etc) with combobox?
for example:
Code: Pascal  [Select][+][-]
  1. if combobox1.text='fePolynomial' then Chart2FitSeries1.FitEquation :=fePolynomial; //(not work)

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Tchart Log10 transformation
« Reply #6 on: March 01, 2021, 05:35:36 pm »
When you add the items to the combobox in the same order in which the elements of the TFitEquation enumeration are declared then you simply can type-cast the Combobox.ItemIndex to TFitEquation:
Code: Pascal  [Select][+][-]
  1.   Chart1FitSeries1.FitEquation := TFitEquation(Combobox1.ItemIndex);

In the attachment you can find a very simple demo in which the FitEquation can be varied, and in which the fitted formula as well as the R2 value are displayed after each fit.

flori

  • Full Member
  • ***
  • Posts: 196
Re: Tchart Log10 transformation
« Reply #7 on: March 01, 2021, 07:00:12 pm »
stunning work! Thank u! I compare R stat and LazStats the restults was the same!  :)


 

TinyPortal © 2005-2018