Fit and Fits Collection - Statistica Visual Basic - Statistica - Dell Community

Fit and Fits Collection

Fit and Fits Collection

This question is not answered

Hello,

I do most of my data analysis programmatically using VB.  I have data sets which I use to make scatterplot graphs based on 2 variables, and I have added polynomial fits to the data.  What I would like to do is programatically get the fit object associated with the graph so that I can extract and save the polynomial coefficients.  I haven't been able to figure out from the documentation of the object model what object owns the fits collection associated to the analysis/graph.  Could someone help me out here, a code snippet would be best.  Or perhaps indicate that my approach is not the right one...

Thanks,

Mike

All Replies
  • Welcome to the forum. I found an example macro; Demo2DFitInfo.zip.

     

    Angela Waner
    Forum Admin

     

  • what I would do is use general linear models to compute the same model as you get in scatterplots. Then use the parameters output from there to construct the model.

    I say this because the parameters given in the scatterplot equation are reported to 6 significant digits. Sometimes that is enough, but especially for polynomial regression, where you square X, the predictions made via the parameters given in the scatterplot title have significant round off error. So getting the equation via the analysis tool is a much better approach.

    of course, you can get the code by recording the macro of the GLM analysis.
  • Thanks Angela, I believe I can use that code example, it shows the object model tree down to the Fit2D object.

    Analyzer, would you have a code snippet showing the programattic use of the general linear model, I've never used them.

    Thanks again,
    Mike
  • Hi Angela,
    I guess I have a version number issue at this point. My desktop license is version 9, but the PC I am doing my current work on is version 7. I know its old, but it is what we have. A number of the objects don't seem to exist, most notably the Graph object, so I can't get down to Fit object. I'm at a point where I am going to extract info by hand, based on the graph title, but I am concerned about the resolution of one of the terms, since it is printing out in the title as (for example) 0.0002 * x^3. I suspect there are some more significant digits that I could get from the Fits object, that I can't get from the chart.
    Thanks,
    Mike
  • Demo2DFitInfo.zip was updated. Please download it again. I am not 100% sure the macro will work with STATISTICA 7, but it may now. I think it also extracts the fit coefficients.

    Also you could download the STATISTICA 12 trial and use the macro.

     

     

    Angela