Performance on the Wisconsin Card Sort Test (WCST) of patients with schizophrenia, Parkinson's disease (PD), and Huntington's disease (HD) was simulated by a neural network model constructed on principles derived from neuroanatomic loops from the frontal cortex through the basal ganglia and thalamus. The model provided a computational rationale for the empirical pattern of perseverative errors associated with frontal cortex dysfunction and random errors associated with striatal dysfunction. The model displayed perseverative errors in performance when the gain parameter of the activation function in units representing frontal cortex neurons was reduced as an analog of reduced dopamine release. Random errors occurred when the gain parameter of the activation function in units representing striatal neurons was reduced, or when the activation level was itself reduced as an analog of a striatal lesion. The model demonstrated that the perseveration of schizophrenic, Huntington's, and demented Parkinsonian patients may be principally due to ineffective inhibition of previously learned contextual rules in the frontal cortex, while the random errors of Parkinson's and Huntington's patients are more likely to be due to unsystematic errors of matching in the striatum. The model also made specific, empirically falsifiable predictions that can be used to explore the utility of these putative mechanisms of information processing in the frontal cortex and basal ganglia.