Topic
3 replies Latest Post - ‏2013-01-11T15:44:27Z by SystemAdmin
MattFreeman
MattFreeman
29 Posts
ACCEPTED ANSWER

Pinned topic Accessing Parameter Estimates from a Generalized Linear Model

‏2012-12-28T20:47:53Z |
After running a GLM modeling node and generating the model nugget, is there a way to capture the parameter estimate(s) for this model? For example, I have a parameter named year and the coefficient estimate, B, is -.017. I want to capture just that value. Thanks.
Updated on 2013-01-11T15:44:27Z at 2013-01-11T15:44:27Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    435 Posts
    ACCEPTED ANSWER

    Re: Accessing Parameter Estimates from a Generalized Linear Model

    ‏2012-12-29T11:23:44Z  in response to MattFreeman
    Hey Matt,
    The way I do this is by the following: if you create your model, you export it with as a PMML. This is a xml format of the model with all the necessary information (including the betas). You can then read this PMML file back into modeler, discover the correct schema (sounds more difficult than it is), and you are done.
    The advantage of this method is that in the same approach, you can read many more interesting things, like predictor importance, model accuracy, labels, ...
    The only thing which you have to keep in mind is that, as there is an intermediate step of creating PMML, your PMML-file matches the latest model. You can guarantee this using scripting lines:
    
    execute :linearnode export model :applylinearnode as linear.xml format pmml
    

    In that way you can guarantee that modeler first creates the pmml file before it does anything else.

    I hope this helps.
    • MattFreeman
      MattFreeman
      29 Posts
      ACCEPTED ANSWER

      Re: Accessing Parameter Estimates from a Generalized Linear Model

      ‏2013-01-11T15:07:23Z  in response to SystemAdmin
      Thanks Rosius(?)! That was very informative. I have another question for you. Suppose I wish to run multiple linear models by looping through various output variables. I know how to do this with a script, however, do you happen to know how to amass the multiple parameter estimates generated through each iteration of the loop? Thanks, Matt
      • SystemAdmin
        SystemAdmin
        435 Posts
        ACCEPTED ANSWER

        Re: Accessing Parameter Estimates from a Generalized Linear Model

        ‏2013-01-11T15:44:27Z  in response to MattFreeman
        Hey Matt,
        You will just have to elaborate on your scripting.
        You save each model in a different PMML (add <OutputVar> to the xml file). Once you have these, you can go two ways
        • Or append all the different xml's to one (include somewhere the <OutputVar>), and continue like before.
        • Continue with your script: in the loop, duplicate the xml-input you already have, change the source, add derive node to include the <OutputVar>. Appending all the inputs will give you wath you need.

        That should do the trick.
        Cheers
        PS It's Wannes:)