Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Experiments and Modeling in Cognitive Science: MATLAB, SPSS, Excel and E-Prime
Experiments and Modeling in Cognitive Science: MATLAB, SPSS, Excel and E-Prime
Experiments and Modeling in Cognitive Science: MATLAB, SPSS, Excel and E-Prime
Ebook417 pages3 hours

Experiments and Modeling in Cognitive Science: MATLAB, SPSS, Excel and E-Prime

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Software Simulation and Modeling in Psychology: MATLAB, SPSS, Excel and E-Prime describes all the stages of psychology experimentation, from the manipulation of factors, to statistical analysis, data modeling, and automated stimuli creation. The book shows how software can help automate various stages of the experiment for which operations may quickly become repetitive. For example, it shows how to compile data files (instead of opening files one by one to copy and paste), generate stimuli (instead of drawing one by one in a drawing software), and transform and recode tables of data.

This type of modeling in psychology helps determine if a model fits the data, and also demonstrates that the algorithmic is not only useful, but essential for modeling data.

  • Covers the entire process of experimenting, from designing an experiment, to modeling the data
  • Shows how software can help automate various stages of the experiment for which operations may quickly become repetitive
  • Contains sections on how to compile data files (instead of opening files one by one to copy and paste) and generate stimuli (instead of drawing one by one in a drawing software)
LanguageEnglish
Release dateNov 22, 2018
ISBN9780081027974
Experiments and Modeling in Cognitive Science: MATLAB, SPSS, Excel and E-Prime
Author

Fabien Mathy

Fabien Mathy is a professor in the department of Psychology at University Côte d'Azur, and researcher at the laboratory Bases, Corpus, Langage of the CNRS. After being head of the Department of Psychology, he is currently appointed director of a doctoral program and head of the Cognitive Science & Computation program at the Maison des Sciences de l'Homme et de la Société Sud-Est in Nice, France. He teaches psychology and cognitive science to show in particular how artificial intelligence and psychology can combine to offer adequate models of cognitive processes. HIs main research interest is the relationship between learning, memory, and intelligence and his current research explores the growth of immediate memory capacity across age. He has been the recipient of two grants from the Agence Nationale de la Recherche and one IDEX (Initiative d'excellence) grant and he has been a fellow of the Psychonomic Society since 2010.

Related to Experiments and Modeling in Cognitive Science

Related ebooks

Psychology For You

View More

Related articles

Reviews for Experiments and Modeling in Cognitive Science

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Experiments and Modeling in Cognitive Science - Fabien Mathy

    Experiments and Modeling in Cognitive Science

    MATLAB, SPSS, Excel and E-Prime

    Fabien Mathy

    Mustapha Chekaf

    Series Editor

    Patrick Paroubek

    Table of Contents

    Cover image

    Title page

    Copyright

    Preface

    Objectives

    Advantages of programming

    Acknowledgments

    Part 1: Experiments, Models, Simulations

    1: Principles of Modeling

    Abstract

    1.1 Experiments, models and simulations

    1.2 Principles of modeling

    1.3 Modeling vs. conceptualization

    2: Modeling and Simulation

    Abstract

    2.1 Classical prediction of the serial position curve

    2.2 Alternative explanation based on the interference phenomenon

    2.3 Going further

    3: Adjustment of the Model to the Data

    Abstract

    3.1 Categorization by exemplars

    3.2 Categorization by exemplar, with MATLAB® calculations

    3.3 Adjustment functions (RMSE and likelihood)

    3.4 From adjustment to model selection

    4: Introduction to Programming in MATLAB®

    Abstract

    4.1 Programming basics: getting started

    4.2 Matrices

    4.3 Basic functions

    4.4 Comparison tests

    4.5 Logical operators

    4.6 Text or character strings

    4.7 Cells and structures

    4.8 Control structures

    4.9 Nested loops

    4.10 Create functions

    4.11 Summary

    4.12 Programming tips in MATLAB®

    Part 2: Experimentation

    5: Principles of Experimentation Organization and Experimental Reasoning

    Abstract

    5.1 Experimental effect

    5.2 Generalities

    5.3 Participants

    5.4 Location and conditions

    5.5 Informed consent

    5.6 Introductory reminder regarding the terminology of experimental design

    5.7 Group denomination

    5.8 Order effects, and rank effects in repeated measures

    5.9 Going further: order and rank effects in repeated measures

    6: Building Experimental Conditions from Random Draws or Permutations

    Abstract

    6.1 Creation of experimental groups

    6.2 Randomly counterbalanced series of zeros and ones

    6.3 Random series of experimental trials

    6.4 Draw of conditions or participants without replacement

    6.5 Counterbalancing experimental conditions

    6.6 Randomization of several word lists by subject

    6.7 Choice and counterbalancing of experimental conditions

    6.8 Creation of permuted item lists for each subject

    6.9 Creation of exhaustive lists and random draws

    7: Creating Stimuli Digitally

    Abstract

    7.1 Overlaying stimuli

    7.2 Create and combine various stimuli

    7.3 Resources

    8: Experimenting with Psychtoolbox (and Others)

    Abstract

    8.1 Introduction: Psychtoolbox (Psychophysics toolbox) or E-Prime?

    8.2 MATLAB® experiments with the GUI

    8.3 MATLAB® experiments with Psychtoolbox

    8.4 E-Prime

    Part 3: Analysis and Modeling

    9: Analyzing Data: Import, Transformation, Compilation, Restructuring, Aggregation and Use of Statisticstoolbox

    Abstract

    9.1 Importing and transforming

    9.2 Compiling data files

    9.3 Extracting digital information from a file that is not organized as a table

    9.4 Import, combine and manipulate data in a table format

    9.5 Restructuring and aggregating data in MATLAB®

    9.6 Restructuring and aggregating data with Excel or SPSS

    10: Introduction to Bayesian Analysis

    Abstract

    10.1 Introduction

    10.2 Conditional release

    10.3 Bayes’ law

    10.4 Principle of Bayesian inference

    10.5 Updating hypotheses

    10.6 Statistics: going past rejecting the null hypothesis

    10.7 What alternative for an implausible null hypothesis?

    10.8 More complex distributions for calculating whether toast lands more often on the buttered side

    10.9 Model selection

    10.10 Cognitive psychology

    11: Complex and Original Figures

    Abstract

    11.1 Correlation matrix with original diagonal

    11.2 Dispersion diagram with cohorts

    11.3 Double Y axis graphs

    11.4 Multiple juxtaposed figures

    11.5 Adding text

    References

    Index

    Copyright

    First published 2018 in Great Britain and the United States by ISTE Press Ltd and Elsevier Ltd

    Apart from any fair dealing for the purposes of research or private study, or criticism or review, as permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced, stored or transmitted, in any form or by any means, with the prior permission in writing of the publishers, or in the case of reprographic reproduction in accordance with the terms and licenses issued by the CLA. Enquiries concerning reproduction outside these terms should be sent to the publishers at the undermentioned address:

    ISTE Press Ltd

    27–37 St George’s Road

    London SW19 4EU

    UK

    www.iste.co.uk

    Elsevier Ltd

    The Boulevard, Langford Lane

    Kidlington, Oxford, OX5 1GB

    UK

    www.elsevier.com

    Notices

    Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary.

    Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility.

    To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein.

    MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of MATLAB® software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLAB® software.

    For information on all our publications visit our website at http://store.elsevier.com/

    © ISTE Press Ltd 2018

    The rights of Fabien Mathy and Mustapha Chekaf to be identified as the authors of this work have been asserted by them in accordance with the Copyright, Designs and Patents Act 1988.

    British Library Cataloguing-in-Publication Data

    A CIP record for this book is available from the British Library

    Library of Congress Cataloging in Publication Data

    A catalog record for this book is available from the Library of Congress

    ISBN 978-1-78548-284-7

    Printed and bound in the UK and US

    Preface

    Fabien Mathy; Mustapha Chekaf July 2018

    Objectives

    This textbook describes all of the experimental stages of cognitive science, ranging from the handling of factors to statistical analysis and data modeling, through the creation and automated delivery of stimuli. The main goal of this book is to demonstrate the advantages of using software to automate various stages of the experimentation process, in which operations can quickly become repetitive. We stress the many virtues of MATLAB®, allowing us to use simple algorithms to compile data files (instead of opening the files one after the other for repeated copy-pasting), generate stimuli (instead of drawing them one-by-one in a graphics editor) and recode or generate data tables.

    The second part of this book focuses on the use of models in cognitive science, which involves determining whether a model can adapt to the data by varying its parameters through simulations. The overall goal is to show that algorithmics is essential in all stages of production of scientific data.

    The authors have provided relevant MATLAB® files to be used in conjunction with this book. They can be downloaded at: https://doi.org/10.5281/zenodo.1339342.

    Advantages of programming

    The use of standard programs in psychology, such as E-Prime and SPSS, for experiments and data analysis can quickly become limiting. For simple experiments, followed by simple data analysis, the programs most commonly used in psychology (e.g. E-Prime, Excel, SPSS and Statistica) are undoubtedly useful and might be enough for the objectives of the project. Nonetheless, MATLAB® can be used as a very simple tool for experimenting and analyzing data as long as the time taken to learn how to use it is not an obstacle. For this reason, in the short term, it can sometimes seem that learning to use MATLAB® is not necessary when the programs mentioned previously are sufficient. However, in the long term, we suggest choosing the route of programming in order to speed up all steps of data production and to increase the reliability of this data. Knowledge of a programming language such as MATLAB® also increases imagination and can lead to the creation of experiments and analyses that had not been considered before. MATLAB® is a way of increasing creativity in the world of research.

    With regard to its efficiency, MATLAB® is clearly an asset. Programming a data analysis with MATLAB® presents the advantage of being able to repeat the analysis with a single click, if needed. Having specified a list of commands linking the various steps of the descriptive analysis, data transformation and inferential analysis, we now have a program that can be reused as required. Let us imagine a folder containing 50 files corresponding to the data of 50 participants. A program can automatically list the files, create the variable N = 50, construct a histogram of the performances (e.g. response time), transform the response time using a logarithm in order to avoid asymmetric distribution, increase the power of the subsequent inferential tests and so on. All of these programming steps placed one after the other might very well correspond to as many steps as required in an SPSS-type program. However, in the case of a change made to the data, MATLAB® has the significant advantage of being able to rerun the program with a single click of the mouse (as the program has already been made), thus carrying out the same sequence of analysis, while SPSS would need to be carried out again for each step of the analysis ¹ .

    Going through all of the steps of the analysis again using the menus can be time-consuming and labor-intensive. However, repeating a data analysis is relatively common, and there are various reasons for this: (1) we then realize that a file contains aberrant data as the participant did not understand the instruction and performed in a manner that is not representative of the sample, the participant must be removed from the analysis; (2) the analysis lacks power, and the size of the sample must be increased (while optional stopping, i.e. changing the size of a sample until significance is achieved, is certainly not recommended by expert statisticians, it is common practice); or (3) we want to carry out the same analysis using a different sample (e.g. with children instead of adults) several months later. Regardless of the reason, the data folder must be updated for MATLAB® to be able to use the new data, for the variable N to be updated automatically in order to apply the old program to the new files and for it to carry out the analysis in full, producing tables, graphs and statistics. The analysis plan and the logical sequencing of the analyses as well as all of the esthetic parameters of the tables and figures are preserved. On the other hand, SPSS requires the entire analysis to be planned again (it is difficult to remember the order in which the different menus were clicked on) and each of the new figures to be double-clicked in order to edit them (e.g. change colored bars into shaded bars, change the scale of the axes in order to improve the proportions and add error bars). Programming using MATLAB® is time-consuming as opposed to SPSS. The advantage of MATLAB® is that even a minor change can lead to another day of work with SPSS, while in MATLAB® it would take a few seconds.

    A second example is linked to the application of rules for recoding data. Let us say, for example, that we wish to create a new variable after the first analysis in order to recode an experimental condition. In the example, the new variable takes the value of 1 (meaning the condition is fulfilled) if the participant presses the button x at trial n, after having pressed button y at trial n − 1, only when the stimulus z is shown in the top part of the screen and only when the presentation time is less than 100 ms. This operation is difficult to carry out without using an algorithm to search for it, which would compare the data along different rows and columns (SPSS only recodes data by carrying out tests along a single row, e.g. if gender = male, then code 1).

    Finally, when we wish to test a model in order to find the parameters that are best adjusted to the data for example, it is sometimes necessary to read a data table several times in order to calculate the best adequacy of the model to the data. This method is not possible using a classic statistics program, which tend to only list classic procedures (most often, simple statistics tests, and not models aiming to explain mental processes such as models of memory or decision processes). MATLAB® allows us to develop or test original models that are specific to an area of research.

    For those not wishing to start learning MATLAB®, while still becoming familiar with the goals it can achieve, it is recommended to start with the chapters on modeling and experimentation. Chapter 4, Introduction to Programming, will allow us to start learning MATLAB® and to take into account all of the content from the other chapters. However, the chapters are all relatively independent of each other and can be globally studied without the basics of MATLAB®.

    Acknowledgments

    The authors thank Emmanuelle Ménétrier for her careful proofreading, André Didierjean, Alessandro Guida, Lucie Laurent, Noelia Do Carmo Blanco and the students of Nice who followed the program in Cognitive Science and the introductory course to cognitive sciences. They also acknowledge the team members of Language and Cognition and, more generally, the Bases, Corpus, Langage (UMR 7320) laboratory for their support and comments.


    ¹ Unless the language SYNTAX is used, which also allows for a sequence of commands to be run, but with far less freedom than with MATLAB®.

    Part 1

    Experiments, Models, Simulations

    1

    Principles of Modeling*

    Abstract

    Cognitive sciences comprise a diverse group of disciplines working together with the goal of understanding how human knowledge is possible. This field uses the following four fundamental methods: conceptualization, experimentation, modeling and simulation, the latter of which is most characterized by the rise of informatics. In this chapter, we describe each of these methods, with a focus on modeling.

    Keywords

    Bifurcation; Conceptualization; Eratosthenes; Golden number; Hypothesis; Modeling; Parastichies; Reproduction; Simulations

    Cognitive sciences comprise a diverse group of disciplines working together with the goal of understanding how human knowledge is possible. This field uses the following four fundamental methods: conceptualization, experimentation, modeling and simulation, the latter of which is most characterized by the rise of informatics. In this chapter, we describe each of these methods, with a focus on modeling.

    1.1 Experiments, models and simulations

    Starting with the most essential method, experimentation involves manipulating one or several factors with the goal of measuring their effects. Experimentation is usually the result of a process of conceptualization that allows a question to be asked and a hypothesis to be provided as the answer to this question. The answer to the question is a prediction of an effect. For example, if we assume that Sunlight is needed for the growth of plants, then we might ask what happens if we try to grow plants in the dark, and a simple hypothesis might be that the plant would die in the dark. In order to avoid circumstances that are unfavorable (such as experimenting on a sick plant) or favorable to the objectives of the experiment (such as choosing a particularly robust plant), it is best to choose several different plants, placed in the dark for a month, and to compare their growth with that of another set of plants, placed in the light of day, while making sure that factors like the temperature of the two areas are the same. Making sure that the two conditions are treated equally allows the experimenter to manipulate the experimental factor all other things being equal ("ceteris paribus), which ensures that the only difference that exists between the two sets of plants is due to the light factor. When a prediction is limited to a single experiment, it can be said that the hypothesis has been operationalized. There can be several possible experiments available for one hypothesis. Experimentation assumes that the dependent variable (DV, also called measure) is a function of the independent variable (IV, or factor), a relation that can be written as DV = f(IV). A way of remembering this is that the dependent variable depends on (i.e. is a function of) the independent variable (which does not depend on anything in the isolated context of the experiment). In the previous example, we can simply measure the wilting rate of the plants in all of the conditions. Academic research more often requires experimentation to rely on current theories, but some domains often carry out experiments without a starting idea, just to see. For example, this might involve using several materials to see" which is best suited to an object. This practice is not limited to the industrial world. Physical experimentation might involve probing phenomena through experience when no theories are available for a given problem.

    The goal of this chapter is not to spend time on the experimental method, but rather to show how to move from conceptualization to modeling. In a slightly disparaging way, it could be said that conceptualization is a simple intuition requiring more precise formalization, once again based on mathematical equations. Simulation is even more complex than the model, in that it seeks to realize the model. The modeling process is static, and the simulation is dynamic. We shall return to this more complex point after providing some examples of models. We start with some examples of models that seem to govern a variety of phenomena such as the reproductive rates of animals, the arrangement of leaves along a stem and the presence of parastichies (i.e. of spiraled patterns) in sunflowers.

    The conceptualization of the reproduction of rabbits might start by remarking that they appear to reproduce very quickly. It is important to note that we do not say that they appear to reproduce exponentially, which would already imply a model. A classic model of this reproduction is the Fibonacci sequence using the following two constants and the equation:

    This sequence results in the following series of numbers:

    1, 1, 2, 3, 5, 8, 13, 21, 34,

    Using simple calculations:

    1 + 1 = 2,

    1 + 2 = 3

    2 + 3 = 5, etc.

    Code:

    %mini program for Fibonacci sequence clc % clears the command window clear fibo nbreOr % clears variables fibo and nbreOr fibo(1)=1; fibo(2)=1; nbreOr(1)=0; nbreOr(2)=1; N = input('Fibonacci for which number? ') ;·% Asks the user to input the value for which they wish to calculate the Fibonacci sequence for generationNum = 3:N fibo(generationNum)=fibo(generationNum- 2)+fibo(generationNum-1); gldnmb(generationNum)=fibo(generationNum)/fibo(generation Num-1); end fibo % prints the calculated values of the Fibonacci sequence gldnmbr % shows the calculated values of the golden number

    Output

    Fibonacci for which number? 10 ((type 10 manually))

    fibo =

        1    1    2    3    5    8    13    21    34    55

    gldnmbr =

          0    1.0000    2.0000    1.5000    1.6667    1.6000    1.6250    1.6154    1.6190    1.6176

    >>

    The reason why this sequence is a good description of the increase of the number of rabbits is that a pair of rabbits (called a and b) looking each in the eye produces nothing more than this very same pair of rabbits (a and b). This explains the first two 1’s of the sequence! This pair of rabbits

    Enjoying the preview?
    Page 1 of 1