It is a 20 months old thread, but I am adding some answers to the queries posted by yangzhenzhen1988 above, which may benefit others. Please read the query completely in the above post to get a clear idea of what I am answering.
1. I wonder what the degree of freedom is, how we can estimate that.
If we look into the result file, we will see a line similar to as follows:
lnL(ntime: 11 np: 12): -2788.563776 +0.000000
Here np is the number of parameters
So, our degree of freedom = (np of the alternate model - np of Null model )
2. If when model =1 (free model), we found that our branch w has higher value compared to the background w(when model =0, i.e. all branches have the same w), what can we conclude? Can we say that our branch has relaxed evolution of rate compared to the background branch? Or our branch has faster evolutionary rate?
To my understanding, free model only says that different branches have different rate of evolution. It dose not confirm if any of the branch have positive selection. To test if a branch have positive selection, we have to use model=2 and also would have to use the tree file with specifying the branch (for which we are testing if there is positive selection) with the tag #1.
3. Is it because they are allowing sites to be changed, so the whole branch keeps fixed? And that's the model that they detect if there is positive selected sites? (read the complete question from the above post)
Yes, This is the to find out if there are positively selected sites, and this is called site model (not branch-site model as assumed in the questions).
4. Then it comes to me another question, will there be a difference if I set the background of my tree differently ? Will it gives me different results? When running paml, what is the criteria of choosing background taxa or seqs if we want to get significant results?
I do not understand the question completely, but I would add a note. Running codeml with different starting tree topology gives different results.