Plotting linear regression of mean colour % over altitude

Hi,
So I am looking at the wing colour in broods of butterflies and how that is affected by altitude.
I have completed my colour analyses (pixel binning) but now need to make my graphs. I have values for:
percentage of black = BP
altitude = ALT
Mother ID = FAM
Species = SPE
percentage of red = RP

My BP and RP are values for each (over 500) individual but I want to have a linear regression with mean black / red percentage value for each brood (per FAM, removing broods with < 6 individuals) and plot this against ALT.

How do I begin to do this? Do I need to create a model for my data?

Thank you

Hello,

Building a regression model is not difficult in R, but you need to have the correct data. Numeric data works very well, but for categorical data (e.g. Mother ID or species) things are more complex as you'll have to create a one-hot vector representation. R functions can do this for you, but if you have many categories, it might make the model more complex and less robust.

Please take a look at one of my older posts for more details

Hope this helps,
PJ

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.