The other day my cattle dog Bill ate a cupcake off of the counter.   He licked the icing off another one.  My husband found the crumbs of the  first cupcake and the frosting missing off of the other and said, "Oh  man, someone ate a cupcake off the counter.  Hey, they licked the  frosting off of this one".  There are only two dogs big enough to do  this but I was pretty sure which dog it was.  I didn't say anything but  looked for Bill and found him lying down behind the couch looking very  "guilty".  He looked the exact same way when my husband raises his voice  because his football team is losing, when something he is working on  around the house isn't going his way and when he is losing at his video  game.  Do you see where this is going?  Bill didn't feel "guilty"  because he ate a cupcake, in fact, he didn't realize Rick was vocalizing  about cupcakes, he responds that way anytime Rick is upset about  anything.  Bill is very close and attach to Rick and freakishly in tune  with Rick's emotions.  He is so sensitive to Rick's tone of voice in  fact, that every time Rick raises his voice he slinks away regardless of  what Rick is talking about or who Rick is talking to.  In fact, Rick  has taken to saying, "It's okay Bill, it's not you" nearly every time he  raises his voice to stop Bill from worrying.  
People are always saying that their dogs feel  "guilty".  They say this because this is how they perceive their dog's  body language, usually just after they have found something that the dog  has done that they don't like.  What they don't understand is that the  dog is not responding this way because he feels "guilt" or "remorse"  over something he has done, in fact, the dog usually has not clue that  he did something "wrong".  The dog is simply responding to the owner's  tone of voice and body language.  If a person comes home from work,  finds poop in the house, then has an anger meltdown because they have to  clean it up, the dog will begin to look worried and afraid when the  owner comes home.  It isn't because of what he did, it is because of his  past experiences of his owner coming home and then getting angry.  By  the way, a dog can find our reactions punishing regardless of how benign  they may seem.  To some very sensitive dogs, something has subtle as a  heavy sigh or look of discuss can be punishing to the dog.  It is so  interesting to me how people are can be completely resistant to the fact  that dogs have emotions (which they do) or they believe that they have  emotions and because they do, they must be exactly like human emotions  (which they aren't). 
Dogs repeat behaviors that are  reinforcing.  They also live in the moment.  I had a very hard time  resisting those cupcakes, even though I had already eaten one!  Bill saw  them on the counter and wanted one, so he took one.  I believe he saw  it, wanted it, took it, ate it and then it was over.  He probably forgot  about the cupcake the moment he was finished eating it (even though  there was still frosting on his lip when I found him behind the  couch!).  When Rick started to complain that a cupcake was eaten, Bill  heard his tone and got worried like he always does.  There was no  cupcake-guilt about it.  By the way, we didn't care too much that he ate  a cupcake and Bill didn't get in "trouble" for it, we just felt stupid  for leaving the cupcake container open on the edge of the counter.   STUPID!
There has been a video circulating on the internet of a  "guilty dog".  The owner comes to the dog with a ripped bag of cat  treats and says to the dog "Did you do this?  Did you rip open these cat  treats?".  The dogs starts to do a series of appeasement behaviors  including pinning his ears back, yawning, lip licking, squinting his  eyes, and finally offering a full, submissive grin with all of his teeth  showing.  People watch it and laugh and say that the dog is guilty, but  the dog is not feeling "guilty" the dog is simply responding to the  owner's tone of voice.  It's sad to watch actually if you know what is  going on.  If you tested it (which I don't recommend you do since it's  stressful to your dog) you would see that your dog will respond the same  way if your tone and body language worries him.
The  take away message here is "please don't assume your dog is feeling  guilty", he is likely just responding to you.  Oh, and remember to put  the lid back on the cupcake container before leaving it on the counter!