Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • error using LRTEST - no i have not added anything new in model

    Can anyone please help me out, why am I am getting error: ....with everyone step forward I go one step backward !!
    Following error:

    df(unrestricted) = df(restricted)= 20

    I have removed the variable from the reduced model. I have not added anything new in the model.
    My original model looked like this

    Code:
    stcox i.tx i.sex i.provider i.general i.vte i.asa age bottle experience cubic1 cubic2 cubic3 charlson, no hr
    However after performing a LR with following p value of 0.28 after removing charlson from my model. I decided charlson is not confounding and removed it from my model, resulting in this (see full model below)

    Code:
    //Full model //no charlson only, cubic 1 still in
    stcox i.tx i.sex i.provider i.general i.vte i.asa age bottle experience cubic1 cubic2 cubic3, no hr
    
    estimates store model_full
    
    //Reduced model - no Charlson no cubic 1 - Here i want to remove cubic1 and evaluate differences. I expect I should be able to remove cubic1 as values are very small. 
    
    stcox i.tx i.sex i.provider i.general i.vte i.asa age bottle experience cubic1 cubic2 cubic3, no hr
    estimates store model_reduced
    However I get the error:
    df(unrestricted) = df(restricted)= 20

    Here's a screen shot of the output - apologies but it's stored on a remote platform and there's no internet - sorry can't supply dataex




    Attached Files

  • #2
    assuming the code you show above is what you actually typed, it is not consistent with what you say - (1) there is no variable called charlson in either model and (2) the variable called cubic1 is in each of the two models - sounds like a typo to me
    Last edited by Rich Goldstein; 09 Aug 2023, 08:07.

    Comment


    • #3
      Thanks for replying so fast for such a simple question.
      However, yes it is a typo from my end i.e retyping from one platform to the next - but actually, my code appears below and is correct. The horrors of working with remote platforms.

      However, I haven't added anything new in the reduced model.
      Perhaps I havne't made myself clear enough to be understood. I previously evaluated 'Charlson' variable in the crude model to a reduced model, performed a LR test and p value 0.28 therefore made a decision to drop it from my model.
      That's why in the code in post 1 it says 'no charlson ' .

      Here I'm trying to make a decision on whether to keep cubic1 or drop it.
      I still obtain error df(unrestricted) = df(restricted) = 20


      Code:
        
       //Full model //cubic 1 still in  stcox i.tx i.sex i.provider i.general i.vte i.asa age bottle experience cubic1 cubic2 cubic3, no hr  estimates store model_full  //Reduced model - Cubic 1 removed   stcox i.tx i.sex i.provider i.general i.vte i.asa age bottle experience cubic2 cubic3, no hr estimates store model_reduced
      I'm not sure if you're aware of perhaps another reason for this error?

      Comment


      • #4
        what are "cubic1", "cubic2" and "cubic3"?

        Comment


        • #5
          They are truncated power restricted cubic splines generated from surgexperience at 4 centiles of surgexperience: 5 ; 35;65;95

          I thought of including them at the start of the model.

          The thing is cubic1 and cubic2 have minimal values so perhaps there is no point including them, but perhaps i'M being pedantic and don't want to drop anything....which is where I'm going wrong
          I generated cubic splines using

          Code:
          spbase surgexperience, gen(cubexperience) knots (`k1' `k2' `k3' `k4')
          Click image for larger version

Name:	Screenshot 2023-08-09 at 16.13.19.png
Views:	1
Size:	28.1 KB
ID:	1723328




          Last edited by Denise Vella; 09 Aug 2023, 09:17.

          Comment


          • #6
            Rich Goldstein i don’t suppose you have any further thoughts on this ?

            Greatly appreciate your input Prof

            Comment


            • #7
              based on what you show in #5, it appears that cubic1 and cubic2 may be duplicates of each other and that would explain your original issue; however, without a -dataex- example, I cannot even be sure of this

              digression - why are using the very old, user-written, -spbase- command instead of -makespline- (assuming you are using version 18; you should tell us if you are not; but, even if you are using an older version, why not use -mkspline-)?

              Comment


              • #8
                Also a digression, your splines represent, collectively, a transformation of a continuous variable. It isn’t valid to omit some of them after transformation; either fit the entire collection or go with a different transformation entirely.

                Comment


                • #9
                  Originally posted by Rich Goldstein View Post
                  based on what you show in #5, it appears that cubic1 and cubic2 may be duplicates of each other and that would explain your original issue; however, without a -dataex- example, I cannot even be sure of this

                  digression - why are using the very old, user-written, -spbase- command instead of -makespline- (assuming you are using version 18; you should tell us if you are not; but, even if you are using an older version, why not use -mkspline-)?
                  Hello there yes I am using version 18, well I'm using spbase because I posted here :
                  https://www.statalist.org/forums/for...er-from-spbase

                  To ask about the difference between spbase vs mkspline as I coudln't find a way how to obtain a TRUNCATED power of restricted cubic splines - which spbase can make but not mkspline.
                  Mkspline can make restricted cubic splines but not truncated power infact the values of both commands are different as seen in the link above.

                  No one seemed to know the answer to my question so decided to use spbase as a researcher has used spbase in pivotal prostate research questions...
                  I may be wrong....

                  Comment


                  • #10
                    My guess is the same as Rich's: cubic1 and cubic2 are perfectly collinear -- that's why the coefficient on cubic2 is zero in the full model. When you drop cubic1, the effect shifts to cubic2, leaving the model unchanged. Do any of the coefficients on other variables change across the two models? My guess is no.

                    Comment


                    • #11
                      Originally posted by Denise Vella View Post

                      Hello there yes I am using version 18, well I'm using spbase because I posted here :
                      https://www.statalist.org/forums/for...er-from-spbase

                      To ask about the difference between spbase vs mkspline as I coudln't find a way how to obtain a TRUNCATED power of restricted cubic splines - which spbase can make but not mkspline.
                      Mkspline can make restricted cubic splines but not truncated power infact the values of both commands are different as seen in the link above.

                      No one seemed to know the answer to my question so decided to use spbase as a researcher has used spbase in pivotal prostate research questions...
                      I may be wrong....
                      I hadn't heard of truncated power basis functions used in this context before. A related question over at Stack Exchange suggests that it is an alternative method of smoothing, of which b-splines and cubic splines are alternatives. I don't really believe the argument that truncated power basis functions make for any easier interpretation over other spline-based methods. The warning about precision issues possibly causing problems is worth noting, and for that reason alone, I would prefer b-splines or cubic splines

                      Comment


                      • #12
                        Originally posted by Leonardo Guizzetti View Post

                        I hadn't heard of truncated power basis functions used in this context before. A related question over at Stack Exchange suggests that it is an alternative method of smoothing, of which b-splines and cubic splines are alternatives. I don't really believe the argument that truncated power basis functions make for any easier interpretation over other spline-based methods. The warning about precision issues possibly causing problems is worth noting, and for that reason alone, I would prefer b-splines or cubic splines
                        Perhaps this should be continued on the other thread , however the data from -spbase- and -mkspline— is completely different … as you can see in my link



                        Comment


                        • #13
                          Originally posted by Denise Vella View Post
                          Perhaps this should be continued on the other thread , however the data from -spbase- and -mkspline— is completely different … as you can see in my link
                          Why are you under the impression that they would be the same? They're completely different families of functions.

                          Comment


                          • #14
                            Originally posted by Leonardo Guizzetti View Post

                            Why are you under the impression that they would be the same? They're completely different families of functions.
                            no actually I do state they are different as one is the truncated power which apparently is a bit more precise. I couldnt understand why the modern mkspline didnt have that option.

                            Comment


                            • #15
                              Originally posted by Denise Vella View Post

                              no actually I do state they are different as one is the truncated power which apparently is a bit more precise. I couldnt understand why the modern mkspline didnt have that option.
                              I can’t answer the why question as only StataCorp can know the reason. I don’t agree the spline is more precise (by what criteria, exactly?) since I’ve highlighted potential precision issues.

                              Comment

                              Working...
                              X