Using Stata Version 14.2 on Windows 8 (64 bit)
Example dataset:
I have hypothesized an inverted u-shaped relationship between funded (DV) and zinnovative (IV). I further hypothesized that fznar (Moderator) will moderate this curvilinear relationship.
Question 1: test of curvilinear relationship in logit models
I ran below model to test my hypothesized relationships.
Query on testing significance of curvilinear effect.
1. I understand that the logit model I have run gives me coefficients of the log-odds of DV and not of DV itself. Hence I cannot determine whether I have a significant curvilinear relationship or not between DV (funded) & IV (zinnovative) by interpreting model coefficients.
2. I can plot the relationship to visualize it using margins command.
Plot is attached as png for view. File name: funded_innovativeness.png
Plot shows that there is a curvilinear relation but it is not a statistical test.
3. Marginal effects can be used to test curvilinearity. My hypothesis is about inverted u-shaped relationship.
I chose not to run below command because that would have given me average marginal effect and I am not aware how average marginal effect could be interpreted as statistical test of curvilinear effects.
instead I ran below command. Calculating marginal effects at various values of IV and plotting it.
Plot is attached as png for view. File name: dydx(innovative).png
In the attached plot, I can easily see that the slope is changing. Slope started with a positive value, then slowly became zero and then turned negative and kept getting larger in negative values with increasing value of IV. This is peculiar of what I was expecting as a change in slope for an inverted -shaped relationship.
However, I still do not have any statistical test which says that the slopes at different values of IV (zinnovative) are indeed different. I believe that is what I need to prove that my relationship is not linear but curvilinear and then I can use the predicted margins plot to show the nature of the relationship. Please suggest how I can statistically test that the slopes are changing at different values of IV.
Question 2: test of curvilinear interactions in logit models
In step 2 of analysis, I ran above model with interaction term - Narcissism (fznar). It is a moderating variable for me. I expect that the presence of high levels of moderating variable (M) will affect the curvilinear relation between my IV (zinnovative) and DV (funded).
I ran below code for my model.
Query on testing significance of curvilinear interaction effect.
1. I can plot the relationship to visualize it using margins command. I plotted the relation between DV and IV at two levels of Moderator.
Plot is attached as png for view. File name: funded_innvativeness_narcissism.png
Now from the plot, I can see the interaction does not look significant. At almost all values of IV, I see the error bars overlapping for low and high values of Moderator. But how to say it statistically?
2. I calculated marginal effects. This time the question is not about inverted u-shaped curve. This time, I have two curves and I have to test that the shape of one curve is different from the other.
Plot is attached as png for view. File name: dydx(zinnovative_fznar).png
In the attached plot, I can see two lines. One is the change in slope of the relation between IV (zinnovative) and DV (funded) at low levels of Moderator (fznar) and other one is the change in slope at high levels of moderator (fznar). It looks like that the slopes of these two lines are not different. My query is how can I prove that statistically.
Thank You.
Example dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float funded byte category_group_id float(launch_year hasvideo lgoal duration) byte staff_pick float(fznar zinnovative) 1 1 2015 1 9.903487 29.181053 . -.1059211 -.5815727 1 1 2011 1 7.313221 30 1 -.1557212 .0612783 1 1 2011 0 6.214608 31.958334 0 -.1968106 -.5815727 0 1 2014 0 6.39693 45 0 .33145735 -.5815727 1 1 2012 1 8.006368 60 . .1013649 .0612783 1 1 2012 0 8.987197 30 1 -.0494278 .3827038 0 1 2014 0 7.600903 59.95833 0 -.1968106 -.5815727 0 1 2018 0 6.55108 10 0 -.1886733 -.5815727 0 1 2016 0 6.761573 30 0 -.16098997 -.5815727 0 1 2014 0 8.517193 30 0 .029723614 -.5815727 end label var category_group_id "category_group_id" label var staff_pick "staff_pick" label var fznar "Factor score (Narcissism)" label var zinnovative "Standardized values of (innovative) "
I have hypothesized an inverted u-shaped relationship between funded (DV) and zinnovative (IV). I further hypothesized that fznar (Moderator) will moderate this curvilinear relationship.
Question 1: test of curvilinear relationship in logit models
I ran below model to test my hypothesized relationships.
Code:
melogit funded i.category_group_id i.launch_year hasvideo lgoal duration staff_pick c.zinnovative##c.zinnovative ||country:
1. I understand that the logit model I have run gives me coefficients of the log-odds of DV and not of DV itself. Hence I cannot determine whether I have a significant curvilinear relationship or not between DV (funded) & IV (zinnovative) by interpreting model coefficients.
2. I can plot the relationship to visualize it using margins command.
Code:
margins, at(zinnovative = ( -0.5 (.5) 3.5)) marginsplot
Plot shows that there is a curvilinear relation but it is not a statistical test.
3. Marginal effects can be used to test curvilinearity. My hypothesis is about inverted u-shaped relationship.
I chose not to run below command because that would have given me average marginal effect and I am not aware how average marginal effect could be interpreted as statistical test of curvilinear effects.
Code:
margins, dydx(zinnovative)
Code:
margins, dydx(zinnovative) at(zinnovative = ( -0.5 (.5) 3.5)) marginsplot
In the attached plot, I can easily see that the slope is changing. Slope started with a positive value, then slowly became zero and then turned negative and kept getting larger in negative values with increasing value of IV. This is peculiar of what I was expecting as a change in slope for an inverted -shaped relationship.
However, I still do not have any statistical test which says that the slopes at different values of IV (zinnovative) are indeed different. I believe that is what I need to prove that my relationship is not linear but curvilinear and then I can use the predicted margins plot to show the nature of the relationship. Please suggest how I can statistically test that the slopes are changing at different values of IV.
Question 2: test of curvilinear interactions in logit models
In step 2 of analysis, I ran above model with interaction term - Narcissism (fznar). It is a moderating variable for me. I expect that the presence of high levels of moderating variable (M) will affect the curvilinear relation between my IV (zinnovative) and DV (funded).
I ran below code for my model.
Code:
melogit funded i.category_group_id i.launch_year hasvideo lgoal duration staff_pick c.fznar##c.fznar c.zinnovative##c.zinnovative c.zinnovative##c.zinnovative#c.fznar ||country:
Query on testing significance of curvilinear interaction effect.
1. I can plot the relationship to visualize it using margins command. I plotted the relation between DV and IV at two levels of Moderator.
Code:
margins, at(zinnovative = ( -0.5 (.5) 3.5) fznar = (-0.189, 0.195)) marginsplot
Now from the plot, I can see the interaction does not look significant. At almost all values of IV, I see the error bars overlapping for low and high values of Moderator. But how to say it statistically?
2. I calculated marginal effects. This time the question is not about inverted u-shaped curve. This time, I have two curves and I have to test that the shape of one curve is different from the other.
Code:
margins, dydx(zinnovative) at(zinnovative = ( -0.5 (.5) 3.5) fznar = (-0.189, 0.195)) marginsplot
Plot is attached as png for view. File name: dydx(zinnovative_fznar).png
In the attached plot, I can see two lines. One is the change in slope of the relation between IV (zinnovative) and DV (funded) at low levels of Moderator (fznar) and other one is the change in slope at high levels of moderator (fznar). It looks like that the slopes of these two lines are not different. My query is how can I prove that statistically.
Thank You.
Comment