0

I have two datasets that I have done logistic regression for. When I plot them using predict() the manip.model is significantly lower than non.manip model, however, they intersect at x=2.3. I would like to do a permutation test to see how often they intersect anywhere, or if this is just an artifact, but I can't figure it out. So far I have only performed very simple permutation tests and am having trouble with this more complicated one.

manip.model <- glm(catch~traplen, family=binomial, data=manip.data)
nonmanip.model <- glm(catch~traplen, family=binomial, 
data=nonmanip.data)
predict(manip.model,data.frame(traplen=x),type="resp")
predict(nonmanip.model2,data.frame(preymass=x),type="resp")

Edit: This is what the data would look like where catch success is represented by 0 or 1, and treatment is represented by y or n. I am trying to determine the frequency that the predicted logistic regression line for treatment n would be lower than for treatment y over the range [1, 2.3] and greater for the range (2.3, 3].

df <- data.frame(traplen=sample(1.0:3.0, 10, replace=T), 
manip=sample(c('y', 'n'), 10, replace=T), catch=sample(c('0','1'), 10, 
replace=T))
df
A. Lee
  • 1
  • 1
  • 4
    You might need to provide more information. But if you're only using a single predictor the models will always "intersect" at some point *unless* the slopes are exactly equal. – Dason Jan 11 '18 at 15:47
  • Hi Dason, thanks for the response. I have two different treatments applied to carnivorous plants, and recorded binary data (1 for successful catch, 0 for unsuccessful) to see if the treatment changed the performance. The manipulated plants consistently do worse, but at around a trap length of 2.3 cm they seem to be doing better. I am really only interested if the two lines cross between a trap length of 2.0 cm and 3.0 cm. The predictor is the trap length. – A. Lee Jan 11 '18 at 16:00
  • What exactly do you want to permute for this permutation test? It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input so we can run and test possible solutions. – MrFlick Jan 11 '18 at 16:06
  • I am a bit new to StackOverflow so sorry about the lack of information. I edited it above. – A. Lee Jan 11 '18 at 16:31

0 Answers0