Hi I am trying to plot number of trips against number of sightings in the graph below
]1
This graph was produced with the following code;
plot(Sightings ~ Trips, data=Sharkies, pch=NA,
xlab="Number of Trips per season", ylab="Sightings per trip per season", main = "How number of trips predicts shark sightings per season")
points(Sightings[Season=="Winter"] ~ Trips[Season=="Winter"], data=Sharkies, pch=22, col="black")
points(Sightings[Season=="Autumn"] ~ Trips[Season=="Autumn"], data=Sharkies, pch=21, col="brown")
points(Sightings[Season=="Summer"] ~ Trips[Season=="Summer"], data=Sharkies, pch=24, col="darkorange")
points(Sightings[Season=="Spring"] ~ Trips[Season=="Spring"], data=Sharkies, pch=25, col="darkgreen")
lines(sharpredicted ~ Sharkies$Trips, par(lwd=1))
sharpredicted is a line based on the predicted values of 'sightings' per 'trip' from a quasipoisson generalised linear model.
I thought that doing the following may rectify the situation;
plot(Sightings ~ Trips, data=Sharkies, pch=NA,
xlab="Number of Trips per season", ylab="Sightings per trip per season", main = "How number of trips predicts shark sightings per season")
points(Sightings[Season=="Winter"] ~ Trips[Season=="Winter"], data=Sharkies, pch=22, col="black")
points(Sightings[Season=="Autumn"] ~ Trips[Season=="Autumn"], data=Sharkies, pch=21, col="brown")
points(Sightings[Season=="Summer"] ~ Trips[Season=="Summer"], data=Sharkies, pch=24, col="darkorange")
points(Sightings[Season=="Spring"] ~ Trips[Season=="Spring"], data=Sharkies, pch=25, col="darkgreen")
lines(sharpredicted[order(sharpredicted)] ~ Sharkies$Trips, par(lwd=1))
But alas, the graph is made worse;
]2
My key question is - how does one plot the predictions of a GLM without getting multiple lines/lines going in strange directions