The legal definition incompetency is pretty much the same for each state. The differences would be in what each state may or may not require in the competency hearing. Generally, someone may be considered incompetent if through either physical or mental defect the individual lacks the ability to handle his/her affairs. This is adjudicated through the courts and the individual believed to be incompetent has the right to produce evidence of competency. There is a presumption that the individual is competent and the burden of proof is on the petitioner to rebut the presumption.
The PA statutory definition is:
Title 20 Pa.C.S.A. Decedents, Estates and Fiduciaries
Chapter 55. Incapacitated Persons
Subchapter A. General Provisions
§ 5501. Meaning of incapacitated person
“'Incapacitated person' means an adult whose ability to receive and evaluate information effectively and communicate decisions in any way is impaired to such a significant extent that he is partially or totally unable to manage his financial resources or to meet essential requirements for his physical health and safety."
So as to prove that a particular individual meets/doesn't meet that definition a Petitoner will file with the county Court of Common Pleas a petition that includes a medical assessment of the individual whose competence is questioned. Often to avoid paying a doctor to come to testify - a costly affair - they will be allowed to testify by answering written questions from the Court.