## Site Navigation

# Multinomial Processing Tree (MPT) Model

used in Yim, Dennis, & Sloutsky (2013)

The current webpage provides Python code for the MPT model in Yim, H., Dennis, S. J., & Sloutsky, V. M. (2013). The Development of Episodic Memory: Items, Contexts, and Relations, *Psychological Science*. The file contains three Python files and requires Numpy and Scipy packege. The codes were tested on Python 2.7.3, Numpy 1.6.1, Scipy 0.9.0 on Ubuntu 12.04 (64bit). The efficiency and elegancy of the code is not garanteed and should be used at one's own risk.

The data (response patterns) are stored in a matrix form using numpy.array(), where individual data are in each row. The order of each value follows the description below:

In the study, three paired associated learning conditions were used (see below figure for an example of the list structure).

From the three conditions (i.e. ABCD, ABAC, and ABABr), 13 types of responses could be produced. The 13 types are described below with examples when a cued recall task (i.e. "What was under the bike in the green house?") was given.

**ABCD condition:**- (1) correct response
*(i.e. cup)* - (2) items in the same list as the correct response
*(i.e. football, strawberry, ..., cat)* - (3) items in the different list as the correct response
*(i.e. apple, pencil, ..., chair)* - (4) misses
*(i.e. extra-experiment, or "I don't know" responses)*

- (1) correct response
**ABAC condition:**- (5) correct response
*(i.e. cup)* - (6) items in the same list as the correct response
*(i.e. strawberry, cat, ..., balloon)* - (7) bound with same item-cue but different list-context
*(i.e. fork)* - (8) items in the different list as the correct response
*(i.e. chair, apple, ..., orange)* - (9) misses
*(i.e. extra-experiment, or "I don't know" responses)*

- (5) correct response
**ABABr condition:**- (10) correct response
*(i.e. cup)* - (11) same item-cue but different list-context
*(i.e. spoon)** - (12) different item-cue
*(i.e. strawberry, phone, ..., balloon)*** - (13) misses
*(i.e. extra-experiment, or "I don't know" responses)*

* note that this type occurs due to the lack of three-way binding.

** note that the list-context does not help distinguish items in the ABABr condition since both list contains the exact same items.- (10) correct response

The identical order (numbered in parentheses) is used in the data structure of the program.

**<1>**For bootstrap and rand_test, individual data should be retained. Therefore in the below example, each row is an individial data and each column corresponses the order as stated above (i.e. (1) correct response, (2) items in the same list as the correct response, (3) items in the different list as the correct response, and (4) misses).

Ex1_4y_ABCD=numpy.array([[4,0,0,2], [5,0,0,1], [5,1,0,0], [5,0,0,1], ... [3,2,1,0], [4,1,1,0], [3,0,2,1], [4,0,2,0], [4,1,1,0], [6,0,0,0] ])

**<2>**For fitMPT, individual data should summed in a list form, where the order should be (1) ABCD, (2) ABAC, (3) ABABr. Therefore in the below example, the individual data is aggregated into one row where the order follows the above numbering (i.e. (1)~(13)).

#>>> Experiment 1 (merge the three conditions into one list) Ex1_4y = list(numpy.sum(Ex1_4y_ABCD,0))+list(numpy.sum(Ex1_4y_ABAC,0))+list(numpy.sum(Ex1_4y_ABABr,0))

MPT_main.py contains the usage of the functions that (1) estimates the parameters (fitMPT), (2) uses bootstrapping methods to obtain distribution of the parameters (bootstrap), and (3) conducts randomization tests (rand_test). Below explains the three functions and related examples.

**(1)**fitMPT

#>>> (1) Estimates parameters # "fitMPT(data)" # > Executes parameter optimization # > Prints loglikelihood/BIC/AIC, estimated parameters, and the raw data # > The function takes raw data which is stroed in MPT_data.py # - raw data from MPT_data.py should be summed into group data (one list of 13 values) # # >>> Example # - The example uses 4yr data from Experiment1 # fitMPT(Ex1_4y)>> Results

====================== Optimization ========================== (1) loglike: -32.877712 (2) BIC : 90.147722 (3) AIC : 73.755425 (4) parameter estimation (e, i, l, b) [ 0.93707872 0.7456193 0.34342948 0.51921782] (5) Compare results >> the order of response patterns are described at http://cogdev.osu.edu/mpt/code.php Model: 123.4 5.9 11.3 9.4 83.7 5.5 30.7 10.5 8.7 75.9 52.4 17.9 9.8 Data : 118.0 8.0 13.0 11.0 85.0 5.0 39.0 4.0 6.0 78.0 46.0 21.0 11.0

** The order of the response patterns is thesame as the order for data structure, which is explained in MPT_data.py.

**(2)**bootstrap

#>>> 2> Bootstrapping the parameters # "bootstrap(NumSample, dataABCD, dataABAC, dataABABr, savefile)" # > Executes bootstraping on the 4 paramters # > Prints 5 percentile values and saves the bootstrapped samples # > The function takes 5 arguments # - NumSample: Number of samples for bootstrapping # - dataABCD, dataABAC, dataABABr: should contain individual raw data # - savefile: if you leave the savefile option to 0 it will not save a file # ## note that bootstrapping will take some time depending on the sample size... # # >>> Example # - The example uses 4yr data from Experiment1 with a sample size of 100 # (but you might want a larger sample size which would take more computing time) # - It also saves the results to a file '4yr_MPT_boot.txt' # NumSamples = 100 bootstrap(NumSamples, Ex1_4y_ABCD, Ex1_4y_ABAC, Ex1_4y_ABABr, '4yr_MPT_boot.txt')>> Results (in addition to the saved file which contains boostrapped raw values)

====================== Bootstrapping ========================= Percentile parameter | 1st 25th 50th 75th 99th e | 0.90337 0.92809 0.93708 0.94607 0.96629 i | 0.66394 0.72287 0.74611 0.76833 0.82061 l | 0.19799 0.30078 0.34291 0.38640 0.49780 b | 0.45147 0.49930 0.51911 0.53900 0.58779

**(3)**rand_test

#>>> 3> Randomization test # "rand_test(NumSample, data1ABCD, data1ABAC, data1ABABr, data2ABCD, data2ABAC, data2ABABr)" # > Executes a randomization test and compares 4 parameters between two groups # > The function takes 7 arguments # - NumSample: Number of samples for bootstrapping # - data1ABCD, ~ data2ABABr: should contain individual raw data # data1 comes from one group and data2 comes from another group # ## note that the randomization test will take some time depending on the sample size... # # - The example compares 4yr and 7yr data from Experiment1 with a sample size of 100 # (but you might want a larger sample size for better accuracy # which would take more computing time) # NumSamples = 100 rand_test(NumSamples, Ex1_4y_ABCD, Ex1_4y_ABAC, Ex1_4y_ABABr, Ex1_7y_ABCD, Ex1_7y_ABAC, Ex1_7y_ABABr)>> Results

============= Randomization test results ======================= 1st_group minus 2nd_group parameter difference p-value e | -0.032829 0.024 i | 0.042818 0.203 l | -0.097767 0.182 b | -0.135478 0.005 ================================================================

The MPT_function.py contains all (sub)functions used in the program.