How can I apply the ggpredict function with the following requirements
1) estimate marginal effects for all values below the first knot (x<5),
2) for values above the first knot (x>5), select a random sample of 20 observations including the maximum x value and estimate the marginal effects for these random 20 x values above the 1st knot ?
Assuming this is my dataset
This is what it looks like like
If I fit a model with a linear spline term like this.
How can I apply the
ggpredict
function with the following requirements 1) estimate marginal effects for all values below the first knot (x<5), 2) for values above the first knot (x>5), select a random sample of 20 observations including the maximum x value and estimate the marginal effects for these random 20 x values above the 1st knot ?Thanks.