I found this recently [1] suggesting that 15-18% of calories from peanuts are excreted. It's probably more for me since they give me digestive problems and that's what made me curios about the subject too.
So I guess eating processed food vs food that's hard to digest actually matters a decent bit if you're counting calories (10-15% of your calories is not insignificant - that's almost half of what you're trying to cut on a calorie restriction diet)
[1]http://www.peanut-institute.org/images/materials_10_19046826...