Interpretation of P-value vs. Plot when performing Logistic Regression in R

I am new to R and Logistic Regression so I will try to be as clear as possible.

I did the following really as a test case as proof of concept of what I've been trying to learn.

I have performed Logistic Regression in R using the following - logistic <- glm(y ~ x, family = binomial (link = "logit"))

y is the response variable containing 1 or 0 based on whether or not a product was purchased, x is the predictor and contains the purchaser's age.

A plot of the data including the logistic regression curve, added using - curve(predict(logistic,data.frame(x=x),type="response"),add=TRUE) shows very little correlation in that the curve is almost horizontal - image attached here - Logistic Regression x-y plot with curve.

If I summarise logistic (summary(logistic)), I get a Pr(>|z|) value of x of 0.0203 *. As this is less than the 0.05 level of significance, this suggests a level of statistical correlation, but this is not what I see at all from the plot. Am I interpreting the results incorrectly here?

I have taken a screenshot of the other results from summary (Logistic Regression Summary) as they didn't format well here.

Thank you.

• Don't confuse how big your correlation is (here the coefficient is -0.017; close to zero; your graph makes sense) with the statistical significance (how confident you are that it's a true pattern; the number of observations are enough in your case). The summary here is that based on the data you analysed you have a small but statistically significant correlation. Try to perform the same analysis with half your data, then 1/3 of your data and you'll see how the p value changes... – AntoniosK Oct 5 '18 at 13:30
• You must have a huge amount of over-printing in your graph as there are not anywhere near 1500+ points shown. Try grouping your x variable and plotting the proportion instead. – mdewey Oct 5 '18 at 14:57
• @mdewey thanks for taking the time to reply. As the x-axis is age, the majority of points will be stacked on top of each other. – user10461773 Oct 6 '18 at 15:37
• @AntoniosK thanks a lot for replying. So it's the coefficient (-0.017) that shows the strength of the correlation and the p value that shows how significant the correlation is. – user10461773 Oct 8 '18 at 8:06