In psychology and cognitive science, a schema (pl.: schemata or schemas) describes a pattern of thought or behavior that organizes categories of information and the relationships among them. It can also be described as a mental structure of preconceived ideas, a framework representing some aspect of the world, or a system of organizing and perceiving new information, such as a mental schema or conceptual model. Schemata influence attention and the absorption of new knowledge: people are more likely to notice things that fit into their schema, while re-interpreting contradictions to the schema as exceptions or distorting them to fit. Schemata have a tendency to remain unchanged, even in the face of contradictory information. Schemata can help in understanding the world and the rapidly changing environment. People can organize new perceptions into schemata quickly as most situations do not require complex thought when using schema, since automatic thought is all that is required.
 People use schemata to organize current knowledge and provide a framework for future understanding. Examples of schemata include mental models, social schemas, stereotypes, social roles, scripts, worldviews, heuristics, and archetypes. In Piaget's theory of development, children construct a series of schemata, based on the interactions they experience, to help them understand the world.
 "Schema" comes from the Greek word schēmat or schēma, meaning "figure".
 Prior to its use in psychology, the term "schema" had primarily seen use in philosophy. For instance, "schemata" (especially "transcendental schemata") are crucial to the architectonic system devised by Immanuel Kant in his Critique of Pure Reason.
 Early developments of the idea in psychology emerged with the gestalt psychologists (founded originally by Max Wertheimer) and Jean Piaget. The term schéma was introduced by Piaget in 1923. In Piaget's later publications, action (operative or procedural) schémes were distinguished from figurative (representational) schémas, although together they may be considered a schematic duality. In subsequent discussions of Piaget in English, schema was often a mistranslation of Piaget's original French schéme. The distinction has been of particular importance in theories of embodied cognition and ecological psychology.
 This concept was first described in the works of British psychologist Frederic Bartlett, who drew on the term body schema used by neurologist Henry Head in 1932. In 1952, Jean Piaget, who was credited with the first cognitive development theory of schemas, popularized this ideology. By 1977, it was expanded into schema theory by educational psychologist Richard C. Anderson. Since then, other terms have been used to describe schema such as "frame", "scene", and "script".
 Through the use of schemata, a heuristic technique to encode and retrieve memories, the majority of typical situations do not require much strenuous processing. People can quickly organize new perceptions into schemata and act without effort. The process, however, is not always accurate, and people may develop illusory correlations, which is the tendency to form inaccurate or unfounded associations between categories, especially when the information is distinctive.
 Nevertheless, schemata can influence and hamper the uptake of new information, such as when existing stereotypes, giving rise to limited or biased discourses and expectations, lead an individual to "see" or "remember" something that has not happened because it is more believable in terms of his/her schema. For example, if a well-dressed businessman draws a knife on a vagrant, the schemata of onlookers may (and often do) lead them to "remember" the vagrant pulling the knife. Such distortion of memory has been demonstrated. (See § Background research below.) Furthermore, it has also been seen to affect the formation of episodic memory in humans. For instance, one is more likely to remember a pencil case in an office than a skull, even if both were present in the office, when tested on certain recall conditions.  
 Schemata are interrelated and multiple conflicting schemata can be applied to the same information. Schemata are generally thought to have a level of activation, which can spread among related schemata. Through different factors such as current activation, accessibility, priming, and emotion, a specific schema can be selected. 
 Accessibility is how easily a schema can come to mind, and is determined by personal experience and expertise. This can be used as a cognitive shortcut, meaning it allows the most common explanation to be chosen for new information.
 With priming (an increased sensitivity to a particular schema due to a recent experience), a brief imperceptible stimulus temporarily provides enough activation to a schema so that it is used for subsequent ambiguous information. Although this may suggest the possibility of subliminal messages, the effect of priming is so fleeting that it is difficult to detect outside laboratory conditions.
 The original concept of schemata is linked with that of reconstructive memory as proposed and demonstrated in a series of experiments by Frederic Bartlett. Bartlett began presenting participants with information that was unfamiliar to their cultural backgrounds and expectations while subsequently monitoring how they recalled these different items of information (stories, etc). Bartlett was able to establish that individuals' existing schemata and stereotypes influence not only how they interpret "schema-foreign" new information but also how they recall the information over time. One of his most famous investigations involved asking participants to read a Native American folk tale, "The War of the Ghosts", and recall it several times up to a year later. All the participants transformed the details of the story in such a way that it reflected their cultural norms and expectations, i.e. in line with their schemata. The factors that influenced their recall were:
 Bartlett's work was crucially important in demonstrating that long-term memories are neither fixed nor unchanging but are constantly being adjusted as schemata evolve with experience. His work contributed to a framework of memory retrieval in which people construct the past and present in a constant process of narrative/discursive adjustment. Much of what people "remember" is  confabulated narrative (adjusted and rationalized) which allows them to think of the past as a continuous and coherent string of events, even though it is probable that large sections of memory (both episodic and semantic) are irretrievable or inaccurate at any given time.
 An important step in the development of schema theory was taken by the work of D.E. Rumelhart describing the understanding of narrative and stories. Further work on the concept of schemata was conducted by W.F. Brewer and J.C. Treyens, who demonstrated that the schema-driven expectation of the presence of an object was sometimes sufficient to trigger its incorrect recollection. An experiment was conducted where participants were requested to wait in a room identified as an academic's study and were later asked about the room's contents. A number of the participants recalled having seen books in the study whereas none were present. Brewer and Treyens concluded that the participants' expectations that books are present in academics' studies were enough to prevent their accurate recollection of the scenes.
 In the 1970s, computer scientist Marvin Minsky was trying to develop machines that would have human-like abilities. When he was trying to create solutions for some of the difficulties he encountered he came across Bartlett's work and concluded that if he was ever going to get machines to act like humans he needed them to use their stored knowledge to carry out processes. A frame construct was a way to represent knowledge in machines, while his frame construct can be seen as an extension and elaboration of the schema construct. He created the frame knowledge concept as a way to interact with new information. He proposed that fixed and broad information would be represented as the frame, but it would also be composed of slots that would accept a range of values; but if the world did not have a value for a slot, then it would be filled by a default value. Because of Minsky's work, computers now have a stronger impact on psychology. In the 1980s, David Rumelhart extended Minsky's ideas, creating an explicitly psychological theory of the mental representation of complex knowledge.
 Roger Schank and Robert Abelson developed the idea of a script, which was known as a generic knowledge of sequences of actions. This led to many new empirical studies, which found that providing relevant schema can help improve comprehension and recall on passages.
 Schemata have also been viewed from a sociocultural perspective with contributions from Lev Vygotsky, in which there is a transactional relationship between the development of a schema and the environment that influences it, such that the schema does not develop independently as a construct in the mind, but carries all the aspects of the history, social, and cultural meaning which influences its development. Schemata are not just scripts or frameworks to be called upon, but are active processes for solving problems and interacting with the world. However, schemas can also contribute to influential outside sociocultural perspectives, like the development of racism tendencies, disregard for marginalized communities and cultural misconceptions. 
 New information that falls within an individual's schema is easily remembered and incorporated into their worldview. However, when new information is perceived that does not fit a schema, many things can happen. One of the most common reactions is for a person to simply ignore or quickly forget the new information they acquired. This can happen on an unconscious level—meaning, unintentionally an individual may not even perceive the new information. People may also interpret the new information in a way that minimizes how much they must change their schemata. For example, Bob thinks that chickens do not lay eggs. He then sees a chicken laying an egg. Instead of changing the part of his schema that says "chickens don't lay eggs", he is likely to adopt the belief that the animal in question that he has just seen laying an egg is not a real chicken. This is an example of disconfirmation bias, the tendency to set higher standards for evidence that contradicts one's expectations. This is also known as cognitive dissonance. However, when the new information cannot be ignored, existing schemata must be changed or new schemata must be created (accommodation).
 Jean Piaget (1896–1980) was known best for his work with development of human knowledge. He believed knowledge was constructed on cognitive structures, and he believed people develop cognitive structures by accommodating and assimilating information. Accommodation is creating new schema that will fit better with the new environment or adjusting old schema. Accommodation could also be interpreted as putting restrictions on a current schema, and usually comes about when assimilation has failed. Assimilation is when people use a current schema to understand the world around them. Piaget thought that schemata are applied to everyday life and therefore people accommodate and assimilate information naturally. For example, if this chicken has red feathers, Bob can form a new schemata that says "chickens with red feathers can lay eggs". This schemata, in the future, will either be changed or removed entirely. 
 Assimilation is the reuse of schemata to fit the new information. For example, when a person sees an unfamiliar dog, they will probably just integrate it into their dog schema. However, if the dog behaves strangely, and in ways that does not seem dog-like, there will be an accommodation as a new schema is formed for that particular dog. With accommodation and assimilation comes the idea of equilibrium. Piaget describes equilibrium as a state of cognition that is balanced when schema are capable of explaining what it sees and perceives. When information is new and cannot fit into a previous existing schema, disequilibrium can happen. When disequilibrium happens, it means the person is frustrated and will try to restore the coherence of his or her cognitive structures through accommodation. If the new information is taken then assimilation of the new information will proceed until they find that they must make a new adjustment to it later down the road, but for now the person remains at equilibrium again. The process of equilibration is when people move from the equilibrium phase to the disequilibrium phase and back into equilibrium.
 In view of this, a person's new schemata may be an expansion of the schemata into a subtype. This allows for the information to be incorporated into existing beliefs without contradicting them. An example in social psychology would be the combination of a person's beliefs about women and their beliefs about business. If women are not generally perceived to be in business, but the person meets a woman who is, a new subtype of businesswoman may be created, and the information perceived will be incorporated into this subtype. Activation of either woman or business schema may then make further available the schema of "businesswoman". This also allows for previous beliefs about women or those in business to persist. Rather than modifying the schemata related to women or to business persons, the subtype is its own category.
 Schemata about oneself are considered to be grounded in the present and based on past experiences. Memories are framed in the light of one's self-conception. For example, people who have positive self-schemata (i.e. most people) selectively attend to flattering information and ignore unflattering information, with the consequence that flattering information is subject to deeper encoding, and therefore superior recall. Even when encoding is equally strong for positive and negative feedback, positive feedback is more likely to be recalled. Moreover, memories may even be distorted to become more favorable: for example, people typically remember exam grades as having been better than they actually were. However, when people have negative self views, memories are generally biased in ways that validate the negative self-schema; people with low self-esteem, for instance, are prone to remember more negative information about themselves than positive information. Thus, memory tends to be biased in a way that validates the agent's pre-existing self-schema.
 There are three major implications of self-schemata. First, information about oneself is processed faster and more efficiently, especially consistent information. Second, one retrieves and remembers information that is relevant to one's self-schema. Third, one will tend to resist information in the environment that is contradictory to one's self-schema. For instance, students with a particular self-schema prefer roommates whose view of them is consistent with that schema. Students who end up with roommates whose view of them is inconsistent with their self-schema are more likely to try to find a new roommate, even if this view is positive. This is an example of self-verification.
 As researched by Aaron Beck, automatically activated negative self-schemata are a large contributor to depression. According to Cox, Abramson, Devine, and Hollon (2012), these self-schemata are essentially the same type of cognitive structure as stereotypes studied by prejudice researchers (e.g., they are both well-rehearsed, automatically activated, difficult to change, influential toward behavior, emotions, and judgments, and bias information processing).
 The self-schema can also be self-perpetuating. It can represent a particular role in society that is based on stereotype, for example: "If a mother tells her daughter she looks like a tom boy, her daughter may react by choosing activities that she imagines a tom boy would do. Conversely, if the mother tells her she looks like a princess, her daughter might choose activities thought to be more feminine." This is an example of the self-schema becoming self-perpetuating when the person at hand chooses an activity that was based on an expectation rather than their desires.
 Schema therapy was founded by Jeffrey Young and represents a development of cognitive behavioral therapy (CBT) specifically for treating personality disorders. Early maladaptive schemata are described by Young as broad and pervasive themes or patterns made up of memories, feelings, sensations, and thoughts regarding oneself and one's relationships with others; they can be a contributing factor to treatment outcomes of mental disorders and the maintenance of ideas, beliefs, and behaviors towards oneself and others. They are considered to develop during childhood or adolescence, and to be dysfunctional in that they lead to self-defeating behavior. Examples include schemata of abandonment/instability, mistrust/abuse, emotional deprivation, and defectiveness/shame.
 Schema therapy blends CBT with elements of Gestalt therapy, object relations, constructivist and psychoanalytic therapies in order to treat the characterological difficulties which both constitute personality disorders and which underlie many of the chronic depressive or anxiety-involving symptoms which present in the clinic. Young said that CBT may be an effective treatment for presenting symptoms, but without the conceptual or clinical resources for tackling the underlying structures (maladaptive schemata) which consistently organize the patient's experience, the patient is likely to lapse back into unhelpful modes of relating to others and attempting to meet their needs. Young focused on pulling from different therapies equally when developing schema therapy. Cognitive behavioral methods work to increase the availability and strength of adaptive schemata while reducing the maladaptive ones. This may involve identifying the existing schema and then identifying an alternative to replace it. Difficulties arise as these types of schema often exist in absolutes; modification then requires replacement to be in absolutes, otherwise the initial belief may persist. The difference between cognitive behavioral therapy and schema therapy according to Young is the latter "emphasizes lifelong patterns, affective change techniques, and the therapeutic relationship, with special emphasis on limited reparenting". He recommended this therapy would be ideal for clients with difficult and chronic psychological disorders. Some examples would be eating disorders and personality disorders. He has also had success with this therapy in relation to depression and substance abuse.