Hi,
I am trying to fit a model to compare two categories of data. There are 3 graphs of one category and 4 graphs that represents the next category. The two categories will be fitted to two separate to unable a camparison between categories. This should create two smooth graphs. Instead the model creates this.
Note the weird plateaus that is plotted for the model. I don´t know what could be wrong with the code or data file..
Here is the code I´m using:
BDmod1<-lme(OmCProcent~ deepthcat2*Category, random =~1|SampleID, correlation= corCAR1( form=~ meandepth|SampleID), data=jacobdata)
jacobdata$BDfitted<-fitted(BDmod1)
ggplot(jacobdata)+geom_point(aes(x=meandepth,y=BDfitted, shape = Category))+
geom_line(aes(x=meandepth,y=BDfitted, linetype=Category))+ coord_flip()+ guides(linetype=FALSE) +
labs(x = "Depth", shape = "Natural or drained", y="Fitted BD", title="Model prediction")
I would be very thankful if somone could shed some light on this!
Best,
Jacob