Multi-Page Experiments

Today experiments (or, rather, surveys) that incorporate multiple question sheets were implemented, and the groundwork was laid to making complex experiments that have both survey and matrix items. Work stopped once an unknown error was encountered — trapping that will be the top priority for the next note on rails.

First, we’ll change the code so the question_sheets are no longer just dynamically added to the old page, but come up as something new. This will make the page both easier to navigate and easier to program for. To do this, change the app/views/students/_selection_condition.rhtml partial to

<% form_tag :action => ‘run_experiment’ do %>

Your Condition: <%= select :student, :condition_id, @conditions %>
<%= submit_tag "Select Condition" %>

<% end %>

Now go tinto the students_controller.rb, and rename select_notes_from_condition to run_experiment(). This will pull up our old _question_list_view.rhtml partial. However, partials means that the standard header doesn’t get added. So rename _question_list_view.rhtml to run_experiment.rhtml

Open the run_experiment.rhtml file, and update the form tag so that it’s a traditional form and not one of these hip AJAX forms. Leaving out the body of the file, run_experiment.rhtml should now look like:

<h1>Question List Page</h1>
<% form_tag :action => ‘run_experiment’ do %>


<%= submit_tag "Continue" %>
<% end %>

Now we get into the problem, however, that run_experiment.rhtml contains both the outer form that does the work of handling form processing and the inner control logic of what to do for different types of questions. Furhter, a check of our code as it now runs reveals that the controller is going to try to determine the condition of the student each time So break out the inner part of the page to a partial called _question_types.rhtml

<% for question in @questions %>
<p><h3><%= question.display_text %></h3>

<% if question.type_id == QuestionType::STRING %>
<%= text_field("question", %>
<% end %>

<% if question.type_id == QuestionType::TEXT %>
<%= text_area("question", %>
<% end %>

<% if question.type_id == QuestionType::SELECTION %>
<% @options = Question.find_question_options_map( %>
<%= select :question,, @options %>
<% end %>

<% if question.type_id == QuestionType::CHECKBOX %>
<% @options = Question.find_question_options_array( %>
<% for option in @options %>
<%= check_box("question", %><%= option.display_text %>

<% end %>
<% end %>

<% if question.type_id == QuestionType::RADIO %>
<% @options = Question.find_question_options_array( %>
<% for option in @options %>
<%= radio_button("question",, %><%= option.display_text %>

<% end %>
<% end %>

<% if question.type_id == QuestionType::INSTRUCTION %>

<% end %>

<% end %>

And now run_experiment.rhtml should read:

<h1>Question List Page</h1>
<% form_tag :action => ‘running_experiment’ do %>
<%= render :partial => ‘question_types’ %>
<%= submit_tag "Continue" %>
<% end %>

For now create a skeleten running_experiment() in the students controller

def running_experiment
@student = Student.find(session[:student])
@next_question_list = Student.find_next_question_list(@student.condition_id,@student.current_question_list)
@student.current_question_list = @next_question_list
@questions = Question.find_by_question_list_id(@student.current_question_list)

Hmmm.. Some quick testing reveals that Question List never goes above “1,” even after is added to the code. Some investigation reveals an error in how the find_next_question_list method and related code was programmed. We need both to know the question_list_id (so that the current question list can be pulled out) and the ordering (so that we know how to search for the next one). So change find_next_question_list in student.rb to:

def self.find_next_question_list(condition_id,ordering)
to_find = QuestionListCondition.find(
:conditions=> [ ‘condition_id = ? AND ordering > ?’, condition_id, ordering ],
:order => ‘ordering ASC’

@to_return = to_find

We’ll also update the database again to store the ordering information

ruby script/generate migration alter_student_add_current_ordering

The new file, 026_alter_student_add_current_ordering.rb

class AlterStudentAddCurrentOrdering < ActiveRecord::Migration
def self.up
add_column :students, :current_ordering, :integer, :default => 0

def self.down
remove_column :students, :current_ordering

Then rake db:migrate

Updating the controller as appropriate makes it work, but now a new question — what happens when the system comes to the end of questions? The solution will be to collapse back into one run_experiment() procedure that tests for both the beginninga and the end. Change the “running_experiment” reference to “run_experiment” in run_experiment.rhtml and there you go!

Next step is to integrate the matrix back into the experiment. It won’t eb fully functioning now, but at least it will allow the matrix to appear in the regular rotation

add these lines: at the very bottom of question_type.rb:

QuestionType.add_item :NOTES_LINEAR, 7
QuestionType.add_item :NOTES_MATRIX, 8

The full run_experiment function will look like this:

def run_experiment
@student = Student.find(session[:student])

unless @student.condition_id
@student.condition_id = params[:student][:condition_id]

@next_question_list = Student.find_next_question_list(@student.condition_id,@student.current_ordering)
if @next_question_list

@student.current_question_list = @next_question_list.question_list_id
@student.current_ordering = @next_question_list.ordering
@questions = Question.find_by_question_list_id(@student.current_question_list)
render_text "Hello, world"

There is more to do. The notes have to be integrated, and during testing there’s an error somewhere that needs to be caught. But everyday is one day closer to having a functioning system.

Me versus myself

A great discussion over at Tom’s blog led me back to my archives — and to discover this apparently tdaxp contradiction

From June 9, 2005:

If we lose the Global War on Terrorism it will be through lack of political will. America needs a strong, rooted, outward-looking ideology to win. It must be a revolutionary ideology…

The neocon / theocon ideological network is a perfect motivating force for the United States in the Global War on Terrorism. It provides tremendous internal energy and is very outward looking — the religious right agitates for System Administration in Darfur, Sudan while secular right sees classic enemies in Syria and North Korea. Their enemy lists overlap almost perfectly.

From July 15th, 2007:

America cannot win a 4GW — a long-term war of ideas — because she will betray herself first. Within a generation of the enslavement of Europe and China to Stalinism, arrogant American liberals combined with comforatble American leftists to do their best to defeat American action in the Vietnam War, and make South-East Asia safe for Communism.

If history repeats itself, or at least rhymes, within a generation of 9/11 active support of al Qaeda inspired movements should be fashionable on college campuses.

So who is right? tdaxp? Or tdaxp?

Cognitive Development, Part X: Bibliography

Baillargeon, R. (1987). Object permanence in 3.5- and 4.5- month old infants.. Developmental Psychology, 23, 655-664.
Barone, M. (2003). Hard America, soft America: Competition vs. coddling and the battle for the nation’s future. New York: Crown Forum.
Behl-Chadha, G. (1996). Basic-level and superordinate-like categorical representations in early infancy. Cognition, 60, 105-141.
Bloom, H. (2000). Global Brain. Wiley & Sons: New York, NY.
Bornstein, M.H. & Sigman, M.D. (1986). Continuing in mental development from infancy. Child Development, 57, 251-274.
Boysson-Bardies, B. (1999). How language comes to children. Cambridge, MA: MIT Press.
Brenner, J.D., Randall, P., Scott, T.M., Capelli, S., Delaney, R., McCarthy, G., & Charney, D.S. (1995). Deficits in short-term memory in adult survivors of childhood abuse. Psychiatric Research, 59(1-2), 97-107.
Brown, A.L. & DeLoache, J.S. (1978). Skills, plans and self-regulation. In R.S. Siegler (Ed.), Children’s thinking: What develops? Hillsdale, NJ: Earlbaum.
Bullock, M. & Ziegler, A. (1999). Scientific reasoning: Developmental and individual differences. In F.E. Weinert & W. Schneider (Eds.) Individual development from 3 to 12: Findings from the Munich longitudinal study. New York: Cambridge University Press.
Butterworth, G. (1977). Object disappearance and error in Piaget’s Stage IV task. Journal of Experimental Child Psychology, 23, 391-401.

Camerer, C., Loewenstein, G., & Prelec, D. (2005). Neuroeconomics: How neuroscience can inform economics. Journal of Economic Literature, 43(1), 9-64.
Case, R., & Okamoto, Y. (1996). The role of central ceonceptual structures in the development of children’s thoughts. Monographs of the Society for Research in Child Development, 61(1-2, Serial No. 246).
Cassel, W.S., Roebers, C.E.M., & Bjorklulnd, D.F. (1996). Developmental patterns of eyewitness responses to increasingly suggestive questions. Journal of Experimental Child Psychology, 61, 116-133.
Ceci, S.J. (1996). On intelligence: A bioecological treatise on intellectual development(expanded ed.). Cambridge, MA: Harvard University Press.
Chen, Y-S, et al. Olckers, A., Schurr, T.G., Kogelnik, A.M., Huoponen, K., & Wallace, D.C. (2000). mtDNA variation in the South African Kung and Khwe – and their genetic relationship to other African populations. American Journal of Human Genetics 66(4), 1362-1383.
Chen, Z., Sanchez, R.P., & Campbell, T. (1997). From beyond to within their grasp: The rudiments of analogical problem solving in 10- and 13- month-olds. Developmental Psychology, 33, 780-801
Clements, W.A. & Perner, J. (1994). Implicit understanding of belief. Cognitive Development, 9, 377-395.
Courage, M.L. & Adams, R.J. (1990). Visual acuity assessment from birth to three years using the acuity card procedures: Cross-sectional and longitudinal samples. Optometry and Vision Sciences, 67, 713-718.
Csikszentmihalyi, M. (1996). Creativity: Flow and the psychology of discovery and invention. HarperCollins: New York.

De Loache, JS, & Brown, AL (1984). Where do I go next? Intelligent searching by very young children. Developmental Psychology, 20, 37-44.
DeCasper, A.J.m & Spence. M.J. (1986). Prenatal maternal speech influences newborn’s perception of speech sounds. Infant Behavior and Development, 9, 133-150.
Dediu, D. & Ladd, D.R. (2007). Linguistic tone is related to the population frequency of the adaptive haplogroups of two brain size genes, ASPM and Microcephalin. PNAS, 104(26), 10944-10949.
DeLoache, J.S. (1987). Rapid change in the symbolic functioning of very young children. Science, 238, 1556-1557.
DeLoache, J.S.. & Smith, C.M. (1999). Early symbolic representation. In I.E. Sigel (Ed.), Development of mental representation: Theories and applications. Mahwah, NJ: Earlbaum.
Devlin, B., Daniels, M., & Roeder, K. (1997). The heritability of IQ. Nature, , 468-471.
Diamond, A. (1985). Development of the ability to use recall to guide action, as indicated by infants’ performance on AB. Child Development, 56, 868-883.
Diamond, A. (1991a). Frontal lobe involvement in cognitive changes during the first year of life. In K.R. Gibson & A.C. Petersen (Eds.), Brain maturation and cognitive development: Comparative and cross-cultural perspectives.. Hawthorne, NY: Aldine de Gruyter.
Diamond, A. (1991b). Neurophyschological insights into the meaning of object concept development. In S. Carey & R. Gelman (Eds.), The epigenesis of mind: Essays on biology and cognition. Hillsdale, NJ
Ding, Y., et al. (2002). Evidence of positive selection acting at the human dopamine receptor D4 gene locus. PNAS, 99(1) 309-314.
Dobson, V., & Teller, D.Y. (1978). Visual acuity in human infants: A review and comparison of behavioral and electrophysiological studies. Vision Research, 18, 1469-1483.

Evans, P.D., Gilber, S.L., Mekel-Bobrov, N., Vallender, E.J., Anderson, J.R., Vaez-Azizi, L.M., Tishkoff, S.A., Hudson, R.R., & Lahn, B.T. (2005). Microcephalin, a Gene Regulating Brain Size, Continues to Evolve Adaptively in Humans. Science, 309(5741), 1717-1720.

Fadok, D.S., Boyd, J., and Warden, J. (1995). Air Power’s Quest for Strategic Paralysis. Air University Press: Maxwell Air Force Base AL.
Flavell, J. H., Miller, P. H., & Miller, S. A. (2002). Cognitive development (4th edition). Prentice Hall: Upper Saddle River, NJ.
Flavell, J.H. (1974). The development of inferences about others. In T. Mischel (Ed.), Understanding other persons. Oxford: Blackwell, Basil, and Mott.
Flavell, J.H., Green, F.L., & Flavell, E.R. (1998). The mind has a mind of its own: Developing knowledge about mental uncontrolability. Cognitive Development, 13, 127-138.
Freeman, K., McKie, S., & Bauer, P. (1994, March). Analogical reasoning in 2-year-olds. Paper presented at the Conference on Human Development, Pittsburgh, PA.

Gardner, H. (1991). The unschooled mind: How children think and how schools should teach. Basic Books: New York.
Gardner, H. (2003). Multiple Intelligences After Twenty Years. Paper presented at the American Educational Research Association.
Geary, D.C., Bow-Thomas, C., Fan, L., & Siegler, R.S. (1993). Even before formal instruction, Chinese children outperform American children in mental addition. Cognitive Development, 8, 517-529
Gelman, R. (1982). Basic numerical abilitie. In R.J. Sternberg (Ed.), Advances in the psychology of human intelligence(Vol. 1). Hillsdale, NJ: Erlbaum.
Gelman, R. (1990). First principles organize attention to and learning about relevant data: Number and the animate-inanimate distinction. Cognitive Science, 14, 79-106.
Gobbo, C. & Chi, M.T.H. (1986). How knowledge is structured and used by expert and novice children. Cognitive Development, 1, 221-237.
Goodman, H.S., Aman, C., & Hirschman, J. (1987). Child sexual and physical abuse: Children’s testimony. In S.J. Ceci, M.P. Toglia, & D.F. Ross (Eds.), Children’s eyewitness memory. New York: Springer-Verla.
Guttentag, R.E. (1984). The mental effort requirement of cumulative rehearsal: A developmental study. Journal of Experimental Child Psychology, 37, 92-106.
Guttentag, R.E. (1997). Memory development and processing resources. In N.Cowan (Ed.), The development of memory in childhood. Hove East Sussex, UK: Psychology Press.

Henrich, J, Boyd, R., Bowles, S., Camerer, C., Fehr, E., Gintis, H., & McElreath, R. (2001). In Search of Homo Economicus: Behavioral Experiments in 15 Small-Scale Societies. American Economic Review 91(2):73-78.
Hoek, D., Ingram, D. & Gibson, D. (1986). An examination of the possible causes of children’s early word extensions. Journal of Child Language, 13, 477-494.

Jacob, S., McClintock, M.K., Zelano, B., & Ober, C. (2002). Paternally inherited HLA alleles are associated with women’s choice of male odor. Nature Genetics 30, 175-179.
Johnson, J. & Newport, E. (1989). Critical period effects in second language learning: The influence of maturational state on the acquisition of English as a second language. Cognitive Psychology, 21, 60-99.

Kaiser, M.K., Proffitt, D.R., & McCloskey, M. (1986). Development of intuitive theories of motion: Curvilinear motioning the absence of external forces. Developmental Psychology, 22, 67-71.
Knight, A., Underhill, P.A., Mortensen, H.M., Zhivotovsky, L.A., Lin, A.A., Henn, B.M., Louis, D., Ruhlen, M., Mountain, J.L. (2003). African Y Chromosome and mtDNA divergence provides insight into the history of click languages. Current Biology, 13(6), 464-473.

Lecanuet, J-P. (1998). Faetal responses to auditory and speech stimuli. In A. Slater (Ed.), Perceptual development: Visual, auditory, and speech perception in infancy. Hove, UK: Psychology Press.
Locke, J.L. (1983). Phonological acquisition and change. New York: Academic Press.
Lynn, R. and Vanhanen, T. (2002). IQ and the wealth of nations. Westport, CT: Praeger.

Mandler, J.M. & McDonough, L. (1996). Drinking and driving don’t mix: Inductive generalization in infancy. Cognition, 59, 307-335.
Markman, E. M. (1979). Review of Siegler’s Children’s thinking: What develops? Cognitive Psychology, 24, 963-964.
McCrabb, M. (2002) Effects-based coalition operations: Belief, framing, and mechanism. In A. Tate (Ed.), Second International Conference on Knowledge Systems for Coalition Operation, 134-146. KSCO: Toulouse, France.
McPherson, S.L. & Thomas, J.R. (1989). Relation of knowledge and performance in boys’ tennis: Age and expertise. Journal of Experimental Child Psychology, 48, 190-211.
Mekel-Bobrov, N., Gilbert, S.L., Evans, P.D., Vallender, E.J., Anderson, J.R., Hudson, R.R., Tishkoff, S.A., & Lahn, B.T. (2004). Ongoing adaptive evolution of ASPM, a brain size determinant in homo sapiens. Science 309(5741), 1720-1722.
Miller, G.A. (1956). The magical number seven, plus or minus two: Some limits on our capacity for processing information.
Miller, J.G. (1987). Cultural influences on the development of conceptual differentiation in person description. British Journal of Developmental Psychology, 5, 309-319.
Miller, K.F. & Stigler, J.W. (1987). Counting in Chinese: Cultural variation in a basic cognitive skill. Cognitive Development, 2, 279-362.
Morell, R.J., Brewer, C.C., Ge, D., Snieder, H., Zalewski, C.K., King, K.A., Drayna, D., & Friednman, T.B. (2007). A twin study of auditory processing indicates that dichotic listening ability is a strongly heritable trait. Human Genetics 122(1), 103-111.
Moshman, D. (2005). Adolescent Psychological Development(2nd ed.). Mahwah, NJ: Lawrence Erlbaum Associates.
Moshman, D. (2007). The development of rationality. In H. Siegel (Ed.), Oxford handbook of philosophy of education. Oxford, UK: Oxford University Press.
Moshman, D. & Geil, M. (1998). Collaborative reasoning: Evidence for collective rationality. Thinking & Reasoning, 4(3), 231-248.
Muellen, M.K. & Yi, S. (1995). The cultural context of talk about the past: Implications for the development of autobiographical memory. Cognitive Development, 10, 407-419.

Nisbett, R. & Ross, L. (1980). Human inference: Strategies and shortcomings of social judgment. Englewood Cliffs, N.J.: Prentice-Hall.
Nowak, M.A., Page, K.M., & Sigmund, K. (2000). Fairness versus reason in the ultimatum game. Science, 289(5485), 1772-1775.

Osinga, F. (2007) On Boyd, bin Laden, and Fourth Generation Warfare as String Theory. In J. Olson (Ed.), On New Wars. Olso: Norwegian Defense command and Staff College.

Paas, F.G.W.C. & Kester, L. (2006). Learner and information characteristics in the design of powerful learning environments. Applied Cognitive Psychology, 20(3), 281-285.
Pascalis, O., de Schonen, S., Morton, J., & Deruelle, C. (1995). Mother’s face recognition by neonates: A replication and an extension. Child Development, 45, 633-642.
Petkus, E., JR. (1996). The creative identity: Creative behavior from the symbolic interactionist perspective. Journal of Creative Behavior, 30(3), 188-196.
Pinker, S. (2007). Groups of people may differ genetically in their average talents and temperaments. In J. Brockan (Ed.), What is your dangerous idea? Today’s leading thinkers on the unthinkable.
Pinker, S. (2002). The Blank Slate: The Modern Denial of Human Nature. Viking Adult: New York, NY.
Posthuma, D., De Geus, E.J.C., Baare, W.F.C., Pol H.E.H., Kahn, R.S., & Boomsma, D.I. (2002). The association between brain volume and intelligence is of genetic origin. Nature Neuroscience, 5(83), 202-283.

Quinn, P.C. (1999). Development of recognition and categorization of objects and their spatial relations in young infants. In L.Baulter & C.S. Tamis-Monda (Eds.). Child psychology: A handbook of contemporary issues. Philadelphia: Psychology Press.

Reese, E., Haden, C.A., & Fivush, R. (1993). Mother-child conversations about the past: Relationships of style and memory over time. Cognitive Development, 8, 403-430.
Rescorla, L. (1980). Overextension in early language development. Journal of Child Language, 7, 321-336.
Richards, C. (2002). Certain to win: The strategy of John Boyd, applied to business. Xlibris: Tinicum, PA.
Rogoff, B. (1988). Cognition as a collaborative process. In W. Damon (Series Ed.) & D. Kuh & R.S. Siegler (Vol. Eds.), Handbook of child psychology: Vol. 2. Cognition, perception, and language(5thed.). New York: Wiley.

Sagan, C. (1997). The demon-haunted world: Science as a candle in the dark. New York: Ballantine Books.
Saxe, G. B. (1981). Body parts as numerals: A developmental analysis of numeration among the Oksapmin in Papua New Guinea. Child Development, 52, 306-316.
Saxe, G. B. (1982). Developing forms of arithmetical thought among the Oksapmin of Papua New Guindea. Developmental Psychology, 18, 583-594.
Siegler, R.S. (1991b). In young children’s counting, procedures precede principles. Educational Psychology Review, 3, 127-135.
Slater, A., Mattock, A., & Brown, E. (1990). Size constancy at birth: Newborn infants’ responses to retinal and real size. Journal of Experimental Child Psychology, 49, 314-322
Sundet, J.M., Barlaug, D.G., & Torjussen, T.M. (2004). The end of the Flynn Effect? Intelligence, 32(4), 349-362.

Tang, H., Choudhry, S., Mei, R., Morgan, M., Rodriguez-Clinton, W., Gonzalez-Burchard, E., Risch, N.J. (2007). Recent genetic selection in the ancestral admixture of Puerto Ricans. The American Journal of Human Genetics, 81, electronically published August 1, 2007.
tdaxp (2007). In search of the wary student. Unpublished manuscript.
tdaxp & Gleason, M. (2006). The creative anarchy. Unpublished manuscript.
tdaxp & Johnson, C.J. (2006). In search of the wary guerrilla: Political aspects of extreme punishers. Unpublished manuscript.
Treiber, F., & Wilcox, S. (1984). Discrimination of number by infants. Infant Behavior and Development, 7, 93-100.

von Lubitz, D.K.J.E., Carrasco, B., Levine, H., & Richir, S. (2004). Medical readiness in the context of operations other than war: Development of first responders readiness using OODA-Loop thinking and advanced distributed interactive simulation technology. Emispher 2004, 1-16.

Wade, N. (2006). Before the dawn: Recovering the lost history of our ancestors. New York, NY: Penguin Press.
Weisberg, Robert W. (1993). Creativity: Beyond the Myth of Genius. W.H. Freeman & Company: New York, NY.

Cognitive Development, a tdaxp series
1. Introduction
2. Infant Perception
3. Infant Cognition
4. Representation and Concepts
5. Reasoning and Problem Solving
6. Social Cognition
7. Memory
8. Language
9. Questions and Problems
10. Bibliography