In my IT experience, BSODs(I'm from mostly Windows, but it should apply to kernel panics also) are mostly caused by memory and hardware like HD, graphics, NIC.
Sudden shutdowns, in my experience, seem to be more caused by PSU, CPU, chipset, heat(air flow, dead fan, whatever) issues.
PSU and memory are the easiest to replace and test. If you have two or more sticks of memory, there is a good chance you can just remove one of the sticks, but I'd recommend just doing a memtest for 24-48 hours. My guess is it's not your memory if it causes a power down, but it is easy to check.