Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Level III

Fit X by Y with by group and 2-polynomial fit

I am trying to script a fit X by Y with a by variable, then fit each with a polynomial (degree = 2)  and then extract the "summary of fit" data (specifically the R Square and number of observations) to a data table. As an example I was working with the Car Physical Data sample set. For example use Weight as the Y, Horsepower as the X, and Type as the By. Then fit with each group with a 2nd order poly. extract all summary of fit diagnostics using make combined data table. I know how to do it with the gui but need to script it to perform much larger operation. 


Re: Fit X by Y with by group and 2-polynomial fit

I suggest that you actually get the result you want interactively. Then click the red triangle for the result for one of the By groups and select Save Script > To Script Window. Now just change the Where( :by = xxx ) to By( :by ).

Learn it once, use it forever!
Article Labels