Menu
Log in


First experience using Copilot to program

  • 4 Mar 2026 11:11 AM
    Reply # 13604561 on 13604254
    Chris Lloyd wrote:

    I just got Copilot to write a function for me. Have you ever run MASS::stepAIC on a linear model that includes poly(x,3) terms and factor(x) terms? These are included as a block. What about if you want to select all the single degree of freedom terms to maximise AIC? stepAIC will not do it, so you need to refit the model  in base form, which is a pain.

    It took five sequential attempts to get Copilot to give me a function that worked properly for the range of cases I wanted (attached) One roadblock was that you can apply functions to the y-variable in a formula and I wanted this to pass thorough the refitting. Anyway, below is the function it produced.

    I think this would have taken me a long time to write, especially as it is not in my comfort zone. Translating formulas into text and selecting components of the model with the same name is not something that inspires me.

    So I would call it a win, but the first four versions of this function did not work properly at all.


    I haven't used Copilot but have had ChatGPT help me with a few little Python scripts recently. I don't want to to work too hard and strain an overloaded brain. What I find wonderful, despite limitations, is that it seems to know any API you need

    EDIT you prompted me to test Copilot with one of my successful ChatGPT projects. It could not even reada my input file to help me parse it but I will find another way and see how it looks. I take it back. It is a helpful interface for creating such scripts. And my apologies for a bad memory. It talks remarkably like Chat GPT. Same turn of phrase and everything

    Last modified: 7 Mar 2026 11:34 AM | Duncan Lowes
  • 3 Mar 2026 7:31 PM
    Message # 13604254

    I just got Copilot to write a function for me. Have you ever run MASS::stepAIC on a linear model that includes poly(x,3) terms and factor(x) terms? These are included as a block. What about if you want to select all the single degree of freedom terms to maximise AIC? stepAIC will not do it, so you need to refit the model  in base form, which is a pain.

    It took five sequential attempts to get Copilot to give me a function that worked properly for the range of cases I wanted (attached) One roadblock was that you can apply functions to the y-variable in a formula and I wanted this to pass thorough the refitting. Anyway, below is the function it produced.

    I think this would have taken me a long time to write, especially as it is not in my comfort zone. Translating formulas into text and selecting components of the model with the same name is not something that inspires me.

    So I would call it a win, but the first four versions of this function did not work properly at all.


    1 file
Powered by Wild Apricot Membership Software