I would like to test whether the prevalence (in %) of parasite-infected individuals of population A (second host) is correlated with the prevalence of parasite-infected individuals of population B (first host). I have seven stations in total, in each of them I sampled 30 individuals of population A and 40 individuals of population B. So, I have 14 data points in total, 7 belonging to B, 7 belonging to A. In general I want to see if there is any correlation between the presence of parasites in A and the presence of parasites in B. I calculated prevalence in percentages. First, can I apply a linear regression to verify the correlation? If yes, but the data are not meeting the assumptions of linear regression, can I transform percentages (with log, for example)?
I do not have your data, but below i simulate some data according to what you describe, and you can see how correlation works
# number of stations n=7 # number of individuals sampled per station # i assume all of them to be 40 x = rep(40,n) # simulate probability of being infection in A true_pA = runif(n,max=0.5) # make the probability in B some function of A, with some error true_pB = 2*true_pA + runif(n,max=0.1) # simulate the data under a binomial A = rbinom(n,size=x,p=true_pA) B = rbinom(n,size=x,p=true_pB) # you can see the counts are correlated plot(A,B)
Because you sampled the same number of individuals per station, you can simply do a pearson correlation between the two values, with 0.5 to handle zeros (as pointed out by AdamO):
If however you want to correlate the ratios,let's say if you have different number of individuals sampled between population.
The correlation is identical to a test of slope in linear regression (this link should be ok), but in this case we just transform the count values using log, which works as a good approximation most of the time.