diff --git a/docs/articles/calmr_fits.html b/docs/articles/calmr_fits.html index 395d81b..afd043a 100755 --- a/docs/articles/calmr_fits.html +++ b/docs/articles/calmr_fits.html @@ -173,7 +173,7 @@

Writing the model function
 pati_summ <- setDT(pati)[,
   list("rpert" = mean(rpert)),
-  by = "block,us,response"
+  by = c("block","us","response")
 ]
 # set order (relevant for the future)
 setorder(pati_summ, block, response, us)
@@ -343,7 +343,7 @@ 

Writing the model function (response == "np" | (response == "lp" & mapply(grepl, s1, trial_type)))] # aggregate - responses <- responses[, list(value = mean(value)), by = "block,s2,response"] + responses <- responses[, list(value = mean(value)), by = c("block","s2","response")] if (full) { return(responses) } diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index c59b92f..f9f2517 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -17,7 +17,7 @@ articles: SM2007: SM2007.html TD: TD.html using_time_models: using_time_models.html -last_built: 2024-04-09T20:07Z +last_built: 2024-04-09T20:28Z urls: reference: https://victornavarro.org/calmr/reference article: https://victornavarro.org/calmr/articles diff --git a/docs/search.json b/docs/search.json index 9775380..3a42296 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"the-mathematics-behind-anccr","dir":"Articles","previous_headings":"","what":"The mathematics behind ANCCR","title":"ANCCR","text":"ANCCR (Jeong et al., 2022) model, stands adjusted net contingency causal relations, proposes mesolimbic dopaminergic conveys adjusted net contingency causal relationships (biologically meaningful targets). mathematics (logic) behind model go well beyond can cover , now, suffice say model: Uses “Hebbian” mechanism learn retrospective associations experiencing meaningful causal target. Derives prospective associations using Bayes’s rule. Combines associations contingency terms represent dopaminergic activity. Uses sign dopaminergic activity strengthen weaken causal weights. Responds function prospective associations causal links.","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"maintaining-stimulus-representations","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"1 - Maintaining stimulus representations","title":"ANCCR","text":"degree stimulus \\(\\) time \\(t\\) “active” memory denoted : \\[ \\tag{Eq.1} E_i(t) = \\Sigma_{t_i \\leq t}e^{-(\\frac{t-t_i}{t\\_constant})} \\] \\(t_i\\) time steps time \\(t\\), \\(t\\_constant\\) time constant (usually meant inter-reward rate)1","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"learning-stimulus-associations","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"2 - Learning stimulus associations:","title":"ANCCR","text":"model learns retrospective associations meaningful causal targets occur. Whether event \\(j\\) meaningful causal target given : \\[ \\tag{Eq.2} \\Phi_j = \\begin{cases} 1,& \\text{} \\Phi_j(t) = 1\\\\ 1,& \\text{}DA_j + \\beta_j > \\theta\\\\ 0,& \\text{otherwise} \\end{cases} \\] \\(\\Phi\\) plays role indicator function, \\(DA_j\\) total dopamine activity time event \\(j\\), \\(\\beta_j\\) unconditioned value event \\(j\\) \\(\\theta\\) global threshold parameter.2 Note indicator function self-preserving: stimulus becomes meaningful causal target, stop . stimulus \\(j\\) observed, predecessor representation contingency, PRC, stimulus \\(\\) updated via: \\[ \\tag{Eq.3} PRC_{\\leftarrow j} = M_{\\leftarrow j} - M_{} \\] \\(M_{\\leftarrow j}\\) predecessor representation \\(\\) given \\(j\\) occurred, \\(M_{}\\) base rate \\(\\) occurs. quantities given : \\[ \\tag{Eq.4a} M_{\\leftarrow j} = M_{\\leftarrow j}' + \\Phi_j\\alpha(E_{\\leftarrow j} - M_{\\leftarrow j}') \\] \\[ \\tag{Eq.4b} M_{} = M_{}' + k\\alpha(E_{} - M_{}') \\] \\(M_{\\leftarrow j}'\\) \\(M_{}'\\) quantities \\(j\\) observed, \\(k\\) \\(\\alpha\\) learning rate parameters, \\(E_{\\leftarrow j}\\) eligibility trace stimulus \\(\\) time \\(j\\) occurs (see Eq. 1). , PRC can used derive prospective association, aptly named successor representation contingency, SRC via Bayes rule: \\[ \\tag{Eq.5} SRC_{\\rightarrow j} = PRC_{\\leftarrow j} \\frac{M_j}{M_i} \\] base rate \\(j\\), \\(M_j\\) calculated via Eq.4b.","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"releasing-dopamine","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"3 - Releasing Dopamine","title":"ANCCR","text":"model postulates dopaminergic signaling encodes adjusted net contingencies causal relations stimuli, ANCCRs. total dopaminergic activity time event \\(\\) equal : \\[ \\tag{Eq.6} DA_i = \\Sigma_j (ANCCR_{\\rightarrow j}\\Phi_j) \\] ANCCR stimulus \\(\\) stimulus \\(j\\) given : \\[ \\tag{Eq.7} ANCCR_{\\rightarrow j} = NC_{\\leftrightarrow j} CW_{\\rightarrow j} - \\sum_{k \\neq }(ANCCR_{k \\leftrightarrow j}\\Delta_{k \\leftarrow }\\Phi_{k \\leftrightarrow }) \\] \\(NC_{\\leftrightarrow j}\\) net contingency stimuli \\(\\) \\(j\\), \\(CW_{\\rightarrow j}\\) causal weight \\(\\) \\(j\\), \\(\\Delta_{k \\leftarrow }\\) recency stimulus \\(k\\) respect stimulus \\(\\), \\(\\Phi_{k \\leftrightarrow }\\) indicator function denoting whether \\(k\\) \\(\\) putative causal relationship . net contingency stimuli \\(\\) \\(j\\), \\(NC_{\\leftrightarrow j}\\), given : \\[ \\tag{Eq.8} NC_{\\leftrightarrow j} = wSRC_{\\rightarrow j} + (1-w)PRC_{\\leftarrow j} \\] weighted sum successor predecessor representation contingencies. net contingency used calculate indicator function , : \\[ \\tag{Eq.9} \\Phi_{k \\leftrightarrow } = \\begin{cases} 1,& \\text{} NC_{\\leftrightarrow j} > \\theta\\\\ 0,& \\text{otherwise} \\end{cases} \\] \\(\\theta\\) threshold parameter used Eq.23, indicator function stimulus , \\(\\Phi_{\\leftrightarrow }\\), 0. recency term, \\(\\Delta_{k \\leftarrow }\\), given : \\[ \\tag{Eq.10} \\Delta_{k \\leftarrow } = e^{-(\\frac{t_j-t_i}{t\\_constant})} \\] \\(t\\_constant\\) parameter used Eq.1. Note however Eq.9 include sum term Eq. 1. Finally, causal weight stimulus \\(\\) stimulus \\(j\\) given : \\[ \\tag{Eq.11} CW_{\\rightarrow j} = CW_{\\rightarrow j}' + \\alpha_{reward}\\delta_{\\rightarrow j} \\] \\(CW_{\\rightarrow j}'\\) previous causal weight, \\(\\alpha_{reward}\\) learning rate parameter exclusive causal weights, \\(\\delta_{\\rightarrow j}\\) delta term depending sign total dopaminergic activity, given : \\[ \\tag{Eq.12} \\delta_{\\rightarrow j} = \\begin{cases} CW_{j \\rightarrow j} - CW_{\\rightarrow j}, & \\text{} DA_j \\ge 0\\\\ (0-CW_{\\rightarrow j})\\frac{n_i^{-1}\\Delta{\\leftarrow j} \\Phi_{\\leftrightarrow j}}{\\Sigma_{k \\neq j}(n_k^{-1}\\Delta_{k \\leftarrow j} \\Phi_{k \\leftrightarrow j})},& \\text{otherwise} \\end{cases} \\] \\(CW_{j \\rightarrow j}\\) reward magnitude stimulus \\(j\\). plain words, dopaminergic activity positive, causal weights (present absent stimuli) strengthen. Conversely, dopaminergic activity negative, causal weights (present absent stimuli) weaken, proportional normalized frequency recency (long putative causal relations \\(j\\)).","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"4 - Generating responses","title":"ANCCR","text":"Responding ANCCR lightly specified. value responding upon presentation stimulus \\(\\) given : \\[ \\tag{Eq.13} Q_i = \\Sigma_k(SRC_{\\rightarrow k} CW_{\\rightarrow k}) \\] can mapped onto probabilities via softmax function4.","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"a-diagram","dir":"Articles","previous_headings":"The mathematics behind ANCCR > 4 - Generating responses","what":"A diagram","title":"ANCCR","text":"diagram shows dependencies model. excluding indicator functions parameters simplicity.5","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"note","dir":"Articles","previous_headings":"The mathematics behind ANCCR > 4 - Generating responses","what":"Note","title":"ANCCR","text":"implementation model port MATLAB code Jeong et al. shared GitHub repository associated paper. output R model checked outputs MATLAB model, using training routines (“eventlogs” parlance) generated using MATLAB code. training routines generated calmr differ somewhat, accommodate generality. example, version 0.6.1, possible specify probabilistic relations cues rewards. Instead, left user specify exact probability via trial numbers (e.g., 80% reward probability can specified “80A>(US)/20A”). naming parameters also differs codebases.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"the-design-data-frame","dir":"Articles","previous_headings":"","what":"The design data.frame","title":"Getting started with calmr","text":"Let’s specify blocking design. rules design data.frame: row represents group. first column contains group labels. remaining columns organized pairs (trials phase, whether randomize ) trials phase column specified using rigid notation. observations : Trials preceded number. number represents number times trial given phase. “10A(US)” means “(US)” trial given 10 times. presence absence unconditioned stimulus denoted traditional “+” “-” symbols. Instead, use parenthesis denote “complex” stimuli. can thought element complex name (.e., one character). , “(US)” specifies single element represent US. vein, multiple characters parentheses denote individual elements. example, “AB” implies presence two stimuli, B. “/” character used trial separator (imply randomization ). Thus, “1A/1B” specifies single “” trial single “B” trial given phase. Recall randomization trials within phase specified column (, R1, R2, R3). “#” character used denote probe trials. contrast real life, probe trials entail update model’s associations. , probe trials can used track development key associations, repercussion model learns normal training trials. want check whether phase string work package, can use phase_parser(). Warning: function returns list lot information used models package, rule thumb see ton text, phase string working.","code":"library(calmr) #> #> Attaching package: 'calmr' #> The following object is masked from 'package:base': #> #> parse my_blocking <- data.frame( Group = c(\"Exp\", \"Control\"), Phase1 = c(\"10A(US)\", \"10C(US)\"), R1 = c(FALSE, FALSE), Phase2 = c(\"10AB(US)\", \"10AB(US)\"), R2 = c(FALSE, FALSE), Test = c(\"1#A/1#B\", \"1#A/1#B\"), R3 = c(FALSE, FALSE) ) # parsing the design and showing the original and what was detected parsed <- parse_design(my_blocking) parsed #> CalmrDesign built from data.frame: #> Group Phase1 R1 Phase2 R2 Test R3 #> 1 Exp 10A(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> 2 Control 10C(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 Exp Phase1 A(US) 10 FALSE A;US #> 2 Exp Phase2 AB(US) 10 FALSE A;B;US #> 3 Exp Test #A 1 TRUE A #> 4 Exp Test #B 1 TRUE B #> 5 Control Phase1 C(US) 10 FALSE C;US #> 6 Control Phase2 AB(US) 10 FALSE A;B;US #> 7 Control Test #A 1 TRUE A #> 8 Control Test #B 1 TRUE B # not specifying the number of AB trials. Error! phase_parser(\"AB/10AC\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # putting the probe symbol out of order. Error! phase_parser(\"#10A\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # considering a configural cue for elements AB trial <- phase_parser(\"10AB(AB)(US)\") # different USs trial <- phase_parser(\"10A(US1)/10B(US2)\") # tons of information! Phase parser is meant for internal use only. # you are better of using `parse_design()` on a design `data.frame` str(trial) #> List of 2 #> $ trial_info :List of 2 #> ..$ 10A(US1):List of 8 #> .. ..$ name : chr \"A(US1)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"A(US1)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ functionals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ all_nominals : chr [1:2] \"A\" \"US1\" #> .. ..$ all_functionals: chr [1:2] \"A\" \"US1\" #> ..$ 10B(US2):List of 8 #> .. ..$ name : chr \"B(US2)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"B(US2)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ functionals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ all_nominals : chr [1:2] \"B\" \"US2\" #> .. ..$ all_functionals: chr [1:2] \"B\" \"US2\" #> $ general_info:List of 5 #> ..$ trial_names : chr [1:2] \"A(US1)\" \"B(US2)\" #> ..$ trial_repeats: num [1:2] 10 10 #> ..$ is_test : logi [1:2] FALSE FALSE #> ..$ nomi2func : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> ..$ func2nomi : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\""},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"the-parameters-list","dir":"Articles","previous_headings":"","what":"The parameters list","title":"Getting started with calmr","text":"Now need pick model parameters. get models currently supported calmr, can call supported_models(). choosing model, can get default parameters design get_parameters(). reference model parametrized, check model’s reference page. example, reference page “RW1972” model . , many equations tire eyes, can consult model parameter reference.","code":"supported_models() #> [1] \"HDI2020\" \"HD2022\" \"RW1972\" \"MAC1975\" \"PKH1982\" \"SM2007\" \"RAND\" #> [8] \"ANCCR\" \"TD\" my_pars <- get_parameters(my_blocking, model = \"RW1972\") # Increasing the beta parameter for US presentations my_pars$betas_on[\"US\"] <- .6 my_pars #> $alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $betas_on #> A B C US #> 0.4 0.4 0.4 0.6 #> #> $betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $lambdas #> A B C US #> 1 1 1 1"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"simulating","dir":"Articles","previous_headings":"The parameters list","what":"Simulating","title":"Getting started with calmr","text":", can run simulation using run_experiment() function. function also takes extra arguments manipulate number iterations run experiment (important designs randomized trials), whether organize trials miniblocks, extra configuration complex models (see help page make_experiment() additional details). , keep simple run experiment single iteration. advanced R user able dig data straight away. However, package also includes methods get quick look results.","code":"my_experiment <- run_experiment( my_blocking, # note we do not need to pass the parsed design model = \"RW1972\", parameters = my_pars ) # returns a `CalmrExperiment` object class(my_experiment) #> [1] \"CalmrExperiment\" #> attr(,\"package\") #> [1] \"calmr\" # CalmrExperiment is an S4 class, so it has slots slotNames(my_experiment) #> [1] \"design\" \"model\" \"groups\" \"parameters\" \"timings\" #> [6] \"experiences\" \"results\" \".model\" \".group\" \".iter\" # some of the experience given to group Exp on the first (and only) iteration head(my_experiment@experiences[[1]]) #> model group phase tp tn is_test block_size trial #> 1 RW1972 Exp Phase1 1 A(US) FALSE 1 1 #> 2 RW1972 Exp Phase1 1 A(US) FALSE 1 2 #> 3 RW1972 Exp Phase1 1 A(US) FALSE 1 3 #> 4 RW1972 Exp Phase1 1 A(US) FALSE 1 4 #> 5 RW1972 Exp Phase1 1 A(US) FALSE 1 5 #> 6 RW1972 Exp Phase1 1 A(US) FALSE 1 6 # the number of times we ran the model (groups x iterations) length(experiences(my_experiment)) #> [1] 2 # an experiment has results with different levels of aggregation class(my_experiment@results) #> [1] \"CalmrExperimentResult\" #> attr(,\"package\") #> [1] \"calmr\" slotNames(my_experiment@results) #> [1] \"aggregated_results\" \"parsed_results\" \"raw_results\" # shorthand method to access aggregated_results results(my_experiment) #> $associations #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0.0000000 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0.0000000 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0.0000000 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0.0000000 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0.0000000 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0.9939534 RW1972 #> 701: Control Test #B 22 2 US A 0.4999999 RW1972 #> 702: Control Test #B 22 2 US B 0.4999999 RW1972 #> 703: Control Test #B 22 2 US C 0.6626356 RW1972 #> 704: Control Test #B 22 2 US US 0.0000000 RW1972 #> #> $responses #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0 RW1972 #> 701: Control Test #B 22 2 US A 0 RW1972 #> 702: Control Test #B 22 2 US B 0 RW1972 #> 703: Control Test #B 22 2 US C 0 RW1972 #> 704: Control Test #B 22 2 US US 0 RW1972"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"plotting","dir":"Articles","previous_headings":"","what":"Plotting","title":"Getting started with calmr","text":"Let’s use plot method create plots. model supports different types plots according results can produce (e.g., associations, responses, saliences, etc.) case, RW model supports associations (associations) responses (responses).","code":"# get all the plots for the experiment plots <- plot(my_experiment) names(plots) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" #> [3] \"Exp - Response Strength (RW1972)\" #> [4] \"Control - Response Strength (RW1972)\" # or get a specific type of plot specific_plot <- plot(my_experiment, type = \"associations\") names(specific_plot) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" # show which plots are supported by the model we are using supported_plots(\"RW1972\") #> [1] \"associations\" \"responses\""},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"stimulus-associations","dir":"Articles","previous_headings":"Plotting","what":"Stimulus associations","title":"Getting started with calmr","text":"columns plots phases design rows denote source association. colors within panel determine target association. example, associations towards US shown yellow.","code":"plot(my_experiment, type = \"associations\") #> $`Exp - Association Strength (RW1972)` #> #> $`Control - Association Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"responding","dir":"Articles","previous_headings":"Plotting","what":"Responding","title":"Getting started with calmr","text":"Fairly similar , responding function stimuli presented trial.","code":"plot(my_experiment, type = \"responses\") #> $`Exp - Response Strength (RW1972)` #> #> $`Control - Response Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"graphing","dir":"Articles","previous_headings":"","what":"Graphing","title":"Getting started with calmr","text":"can also take look state model’s associations point experiment, using graph method. graphs created using ggnetwork package.","code":"# some general options for ggnetwork my_graph_opts <- get_graph_opts(\"small\") # passing the argument t to specify the trial we're interested in. # end of acquisition patch_graphs(graph(my_experiment, t = 10, options = my_graph_opts)) # end of blocking patch_graphs(graph(my_experiment, t = 20, options = my_graph_opts))"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"final-thoughts","dir":"Articles","previous_headings":"","what":"Final thoughts","title":"Getting started with calmr","text":"design philosophy behind calmr package revolves around simplicity ease access. user needs specify design well model generate model predictions. fact, also app lets users access basic package functionality using GUI. said, package plenty features advanced R users. ’re one , make sure check vignettes ready.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"using-the-calmr-app","dir":"Articles","previous_headings":"","what":"Using the calmr app","title":"calmr_app","text":"want deal programming side calmr simply want simulate experimental design see model , might interested using calmr application. calmr application offers GUI allows simulate experiments without writing code. want use online app, can find https://victor-navarro.shinyapps.io/calmr_app/. Alternatively, can install calmr.app companion package launch app via calmr.app::launch_app(). rest tutorial assumes app open ready run. Let’s break GUI.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"design-table","dir":"Articles","previous_headings":"The GUI","what":"Design Table","title":"calmr_app","text":"design table specify experimental design run. Using Group- Group+, can remove add groups design. Using Phase- Phase+, can remove add phases design. Parse Design button used parse design, required step run simulation. later. P1 P2 columns specify phases experiment simulated left right. entry columns specifies trials given corresponding groups (G1 G2, case). entries must obey special syntax (see calmr_basics additional information). now, suffice say : number trials specified via digits left trial. example, 10A(US) specifies ten “(US)” trials. Stimuli (elements) specified letters. example, 10AB(US) specifies elements B US. Named stimuli specified within parentheses. example, (US) implies element named “US” instead compound containing elements “U” “S”. Multiple trials per phase separated via forward slash (/). Additionally, one can choose randomize trials within phase ticking boxes R1 R2 columns. important note whatever set interact “Create trial blocks” option Options tab sidebar (see ahead). ’s full breakdown combinations behavior: Table checked preferences checked: Trials shuffled within blocks possible (based greater common factor). example, 2A/2B gets shuffled 2 blocks containing one one B trial, 2A/1B gets shuffled 1 block containing two trials one B trial. Table unchecked preferences checked: Trials deterministically intermixed within blocks possible. example, 2A/2B gets shuffled 2 blocks, resulting sequence ABAB. Table checked preferences unchecked: Trials shuffled completely random. Table unchecked preferences unchecked: Trials given order appearance. example, 2A/2B results AABB sequence. Go ahead parse design. new things appear GUI.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"parameters","dir":"Articles","previous_headings":"The GUI","what":"Parameters","title":"calmr_app","text":"parsing valid design, can set parameters experiment. number parameters change function model. case, Rescorla-Wagner model 4 parameters per stimulus. default values fairly sensible, can modify parameter hand favorite spreadsheet software. parameterization model calmr can sometimes differ appears literature. following table contains links documentation pages model (warning: equations).","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"results","dir":"Articles","previous_headings":"The GUI","what":"Results","title":"calmr_app","text":"new button appear parsing experiment. final click button run model populate “Results” “Association Graphs” portions app. Go ahead run experiment. new button allow download results spreadsheet. calmr app, results shown visually. Clicking bar graph (one containing “Blocking - Response Strength …” ) show plots available. first portion plot’s name denotes group’s name. , plot shows strength associations among stimuli experiment across trials (blocks), faceted phases columns, origin stimuli rows. example, yellow lines denote strength B US. top column corresponds (look label right) middle column corresponds B. Go ahead explore available plots. usually self-explanatory, consult documentation package case something unclear (especially using obscure models).","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"association-graphs","dir":"Articles","previous_headings":"The GUI","what":"Association Graphs","title":"calmr_app","text":"bottom portion app shows network graphs depicting strength associations model given trial, groups. Yellow denotes excitatory strength (.e., positive values), gray denotes neutral strength (.e., values close zero), purple (shown ) shows inhibitory strength (.e., negative values). Move “Trial” slider explore associations model change across experiment.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"other-bits","dir":"Articles","previous_headings":"The GUI","what":"Other bits","title":"calmr_app","text":"sections implement bulk functionalities calmr app. following sections describe additional options found useful.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"options","dir":"Articles","previous_headings":"The GUI > Other bits","what":"Options","title":"calmr_app","text":"set number iterations run experiment (important model behavior sensitive trial order effects), whether want create trial blocks. also set can choose plot common scale y-axis (active default).","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"a-final-message","dir":"Articles","previous_headings":"The GUI","what":"A final message","title":"calmr_app","text":"Hope enjoy app! find bugs, comments, like something implemented, feel free post message package’s Github repository drop line navarrov [] cardiff.ac.uk.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"your-first-simulation","dir":"Articles","previous_headings":"","what":"Your first simulation","title":"calmr_basics","text":"perform first simulation need: data.frame specifying experiment design, list parameters model using.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"the-design-data-frame","dir":"Articles","previous_headings":"","what":"The design data.frame","title":"calmr_basics","text":"Let’s specify blocking design. rules design data.frame: row represents group. first column contains group labels. remaining columns organized pairs (trials phase, whether randomize ) trials phase column specified using rigid notation. observations : Trials preceded number. number represents number times trial given phase. “10A(US)” means “(US)” trial given 10 times. presence absence unconditioned stimulus denoted traditional “+” “-” symbols. Instead, use parenthesis denote “complex” stimuli. can thought element complex name (.e., one character). , “(US)” specifies single element represent US. vein, multiple characters parentheses denote individual elements. example, “AB” implies presence two stimuli, B. “/” character used trial separator (imply randomization ). Thus, “1A/1B” specifies single “” trial single “B” trial given phase. Recall randomization trials within phase specified column (, R1, R2, R3). “#” character used denote probe trials. contrast real life, probe trials entail update model’s associations. , probe trials can used track development key associations, repercussion model learns normal training trials. want check whether phase string work package, can use phase_parser(). function returns list lot information, let’s print fields.","code":"library(calmr) my_blocking <- data.frame( Group = c(\"Exp\", \"Control\"), Phase1 = c(\"10A(US)\", \"10C(US)\"), R1 = c(FALSE, FALSE), Phase2 = c(\"10AB(US)\", \"10AB(US)\"), R2 = c(FALSE, FALSE), Test = c(\"1#A/1#B\", \"1#A/1#B\"), R3 = c(FALSE, FALSE) ) # parsing the design and showing the original and what was detected parsed <- parse_design(my_blocking) parsed # not specifying the number of AB trials. Error! phase_parser(\"AB/10AC\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # putting the probe symbol out of order. Error! phase_parser(\"#10A\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # considering a configural cue for elements AB trial <- phase_parser(\"10AB(AB)(US)\") # different USs trial <- phase_parser(\"10A(US1)/10B(US2)\") # tons of information! Phase parser is meant for internal use only. # you are better of using `parse_design()` on a design `data.frame` str(trial) #> List of 2 #> $ trial_info :List of 2 #> ..$ 10A(US1):List of 8 #> .. ..$ name : chr \"A(US1)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"A(US1)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ functionals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ all_nominals : chr [1:2] \"A\" \"US1\" #> .. ..$ all_functionals: chr [1:2] \"A\" \"US1\" #> ..$ 10B(US2):List of 8 #> .. ..$ name : chr \"B(US2)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"B(US2)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ functionals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ all_nominals : chr [1:2] \"B\" \"US2\" #> .. ..$ all_functionals: chr [1:2] \"B\" \"US2\" #> $ general_info:List of 5 #> ..$ trial_names : chr [1:2] \"A(US1)\" \"B(US2)\" #> ..$ trial_repeats: num [1:2] 10 10 #> ..$ is_test : logi [1:2] FALSE FALSE #> ..$ nomi2func : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> ..$ func2nomi : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"the-parameters-list","dir":"Articles","previous_headings":"","what":"The parameters list","title":"calmr_basics","text":"Now need pick model parameters. get models currently supported calmr, can call supported_models(). choosing model, can get default parameters design get_parameters().","code":"supported_models() #> [1] \"HDI2020\" \"HD2022\" \"RW1972\" \"MAC1975\" \"PKH1982\" \"SM2007\" \"RAND\" #> [8] \"ANCCR\" \"TD\" my_pars <- get_parameters(my_blocking, model = \"RW1972\") # Increasing the beta parameter for US presentations my_pars$betas_on[\"US\"] <- .6 my_pars #> $alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $betas_on #> A B C US #> 0.4 0.4 0.4 0.6 #> #> $betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $lambdas #> A B C US #> 1 1 1 1"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"simulating","dir":"Articles","previous_headings":"The parameters list","what":"Simulating","title":"calmr_basics","text":", can run simulation using run_experiment() function. function also takes extra arguments manipulate number iterations run experiment , whether organize trials miniblocks (see help page make_experiment() additional details). , run experiment 5 iterations. advanced R user able dig data straight away. However, package also includes methods get quick look results.","code":"my_experiment <- run_experiment( my_blocking, # note we do not need to pass the parsed design model = \"RW1972\", parameters = my_pars, iterations = 5 ) # returns a `CalmrExperiment` object class(my_experiment) #> [1] \"CalmrExperiment\" #> attr(,\"package\") #> [1] \"calmr\" # CalmrExperiment is an S4 class, so it has slots slotNames(my_experiment) #> [1] \"design\" \"model\" \"groups\" \"parameters\" \"timings\" #> [6] \"experiences\" \"results\" \".model\" \".group\" \".iter\" # the experience given to group Exp on the first iteration my_experiment@experiences[[1]] #> model group phase tp tn is_test block_size trial #> 1 RW1972 Exp Phase1 1 A(US) FALSE 1 1 #> 2 RW1972 Exp Phase1 1 A(US) FALSE 1 2 #> 3 RW1972 Exp Phase1 1 A(US) FALSE 1 3 #> 4 RW1972 Exp Phase1 1 A(US) FALSE 1 4 #> 5 RW1972 Exp Phase1 1 A(US) FALSE 1 5 #> 6 RW1972 Exp Phase1 1 A(US) FALSE 1 6 #> 7 RW1972 Exp Phase1 1 A(US) FALSE 1 7 #> 8 RW1972 Exp Phase1 1 A(US) FALSE 1 8 #> 9 RW1972 Exp Phase1 1 A(US) FALSE 1 9 #> 10 RW1972 Exp Phase1 1 A(US) FALSE 1 10 #> 11 RW1972 Exp Phase2 2 AB(US) FALSE 1 11 #> 12 RW1972 Exp Phase2 2 AB(US) FALSE 1 12 #> 13 RW1972 Exp Phase2 2 AB(US) FALSE 1 13 #> 14 RW1972 Exp Phase2 2 AB(US) FALSE 1 14 #> 15 RW1972 Exp Phase2 2 AB(US) FALSE 1 15 #> 16 RW1972 Exp Phase2 2 AB(US) FALSE 1 16 #> 17 RW1972 Exp Phase2 2 AB(US) FALSE 1 17 #> 18 RW1972 Exp Phase2 2 AB(US) FALSE 1 18 #> 19 RW1972 Exp Phase2 2 AB(US) FALSE 1 19 #> 20 RW1972 Exp Phase2 2 AB(US) FALSE 1 20 #> 21 RW1972 Exp Test 3 #A TRUE 2 21 #> 22 RW1972 Exp Test 4 #B TRUE 2 22 # the number of times we ran the model (groups x iterations) length(experiences(my_experiment)) #> [1] 10 # an experiment has results with different levels of aggregation class(my_experiment@results) #> [1] \"CalmrExperimentResult\" #> attr(,\"package\") #> [1] \"calmr\" slotNames(my_experiment@results) #> [1] \"aggregated_results\" \"parsed_results\" \"raw_results\" # shorthand method to access aggregated_results results(my_experiment) #> $associations #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0.0000000 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0.0000000 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0.0000000 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0.0000000 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0.0000000 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0.9939534 RW1972 #> 701: Control Test #B 22 2 US A 0.4999999 RW1972 #> 702: Control Test #B 22 2 US B 0.4999999 RW1972 #> 703: Control Test #B 22 2 US C 0.6626356 RW1972 #> 704: Control Test #B 22 2 US US 0.0000000 RW1972 #> #> $responses #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0 RW1972 #> 701: Control Test #B 22 2 US A 0 RW1972 #> 702: Control Test #B 22 2 US B 0 RW1972 #> 703: Control Test #B 22 2 US C 0 RW1972 #> 704: Control Test #B 22 2 US US 0 RW1972"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"plotting","dir":"Articles","previous_headings":"","what":"Plotting","title":"calmr_basics","text":"Let’s use plot method create plots. model supports different types plots according results can produce (e.g., associations, responses, saliences, etc.) case, RW model supports associations (associations) responses (responses).","code":"# get all the plots for the experiment plots <- plot(my_experiment) names(plots) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" #> [3] \"Exp - Response Strength (RW1972)\" #> [4] \"Control - Response Strength (RW1972)\" # or get a specific type of plot specific_plot <- plot(my_experiment, type = \"associations\") names(specific_plot) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" # show which plots are supported by the model we are using supported_plots(\"RW1972\") #> [1] \"associations\" \"responses\""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"stimulus-associations","dir":"Articles","previous_headings":"Plotting","what":"Stimulus associations","title":"calmr_basics","text":"columns plots phases design rows denote source association. colors within panel determine target association.","code":"plot(my_experiment, type = \"associations\") #> $`Exp - Association Strength (RW1972)` #> #> $`Control - Association Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"responding","dir":"Articles","previous_headings":"Plotting","what":"Responding","title":"calmr_basics","text":"Fairly similar , responding function stimuli presented trial.","code":"plot(my_experiment, type = \"responses\") #> $`Exp - Response Strength (RW1972)` #> #> $`Control - Response Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"graphing","dir":"Articles","previous_headings":"","what":"Graphing","title":"calmr_basics","text":"can also take look state model’s associations point training, using graph method experiment.","code":"my_graph_opts <- get_graph_opts(\"small\") # passing the argument t to specify the trial we're interested in. # end of acquisition patch_graphs(graph(my_experiment, t = 10, options = my_graph_opts)) # end of blocking patch_graphs(graph(my_experiment, t = 20, options = my_graph_opts))"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"final-thoughts","dir":"Articles","previous_headings":"","what":"Final thoughts","title":"calmr_basics","text":"calmr package designed simulate quickly: specify design, parameters, get glance model predictions. However, package also additional features advanced R users. ’re one , make sure check vignettes ready.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"fitting-heidi-to-empirical-data","dir":"Articles","previous_headings":"","what":"Fitting HeiDI to empirical data","title":"calmr_fits","text":"demo, fit HeiDI empirical data (Patitucci et al., 2016, Experiment 1). involve writing function produces model responses organized empirical data, can use function maximum likelihood estimation (MLE). begin short overview data, move model function, finally fit.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"the-data","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"The data","title":"calmr_fits","text":"data (pati) contains responses (lever presses lp, nose pokes np) 32 rats, across 6 blocks training (2 sessions per block). animals trained associate two levers two different food rewards (pellets sucrose). Let’s glance. thicker lines group averages; rest individual subjects. ignore specific mapping levers USs counterbalanced across subjects. However, ignore counterbalancing writing model function (see ahead).","code":"summary(pati) #> subject block lever us response #> 1 : 24 Min. :1.0 B: 0 Length:768 lp:384 #> 2 : 24 1st Qu.:2.0 L:384 Class :character np:384 #> 3 : 24 Median :3.5 R:384 Mode :character #> 4 : 24 Mean :3.5 #> 5 : 24 3rd Qu.:5.0 #> 6 : 24 Max. :6.0 #> (Other):624 #> rpert #> Min. :0.0000 #> 1st Qu.:0.9437 #> Median :2.2500 #> Mean :2.4806 #> 3rd Qu.:3.8000 #> Max. :8.4500 #> pati |> ggplot(aes(x = block, y = rpert, colour = us)) + geom_line(aes(group = interaction(us, subject)), alpha = .3) + stat_summary(geom = \"line\", fun = \"mean\", linewidth = 1) + labs(x = \"Block\", y = \"Responses per trial\", colour = \"US\") + facet_grid(~response)"},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"writing-the-model-function","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Writing the model function","title":"calmr_fits","text":"biggest hurdle fitting model empirical data write function , given vector parameters experiment, generates responses organized empirical data. Let’s begin summarizing data first, know aim . design? experiment presented Patitucci et al. (2016) fairly simple, can reduced presentations two levers, followed different appetitive outcome. , assume two outcomes independent . also take liberties number trials specify reduce computing time. beware: HeiDI, like many learning models, sensitive order effects. want model misfit data happened run simulations unlucky run trials. arguments prepare must reflect behavior model “general” experimental procedure, , address issue running several iterations experiment (random order trials) averaging experiments evaluating likelihood parameters. mind, now prepare experiment pass run_experiment(). Note specified two counterbalancings groups. must reproduce counterbalancings data trying fit close possible. Otherwise, optimization process might latch onto experimentally-irrelevant variables. example, can seen pati lever pressing whenever lever paired pellets. didn’t counterbalance identities levers food rewards, optimization might result one levers less salient ! can now begin write model function. First, good see results run_experiment() returns. Although results() returns many model outputs, said earlier, care one : responses (model responses). , can write model function. Let’s dissect function three parts. get parameters experiment, via parameters() method store new_parameters.1 put pars (parameters provided optimizer) alphas new_parameters. run experiment store exp_res. select model responses (responses) model results store responses. Lastly. summarise model responses return .2 ’s lot digest, let’s see function action. Just numbers! order empirical data model responses must match. emphasize point enough: nothing within fit function checks reorders data . sole responsible making sure pieces data order. simple way print model results return compare data. ’s reason full parameter function definition. made sure everything looking good, can fit model.","code":"pati_summ <- setDT(pati)[, list(\"rpert\" = mean(rpert)), by = \"block,us,response\" ] # set order (relevant for the future) setorder(pati_summ, block, response, us) head(pati_summ) #> block us response rpert #> 1: 1 P lp 0.8195313 #> 2: 1 S lp 0.5609375 #> 3: 1 P np 3.4109375 #> 4: 1 S np 3.2796875 #> 5: 2 P lp 1.5738281 #> 6: 2 S lp 0.6406250 # The design data.frame des_df <- data.frame( group = c(\"CB1\", \"CB2\"), training = c( \"12L>(Pellet)/12R>(Sucrose)/12#L/12#R\", \"12L>(Sucrose)/12R>(Pellet)/12#L/12#R\" ), rand_train = FALSE ) # The parameters # the actual parameter values don't matter, # as our function will re-write them inside the optimizer call parameters <- get_parameters(des_df, model = \"HD2022\" ) # The arguments experiment <- make_experiment(des_df, parameters = parameters, model = \"HD2022\", iterations = 4 ) experiment exp_res <- run_experiment(experiment) results(exp_res) #> $activations #> group phase trial_type trial block_size s1 value model #> 1: CB1 training L>(Pellet) 1 4 L 0.4000000 HD2022 #> 2: CB1 training R>(Sucrose) 2 4 L 0.0000000 HD2022 #> 3: CB1 training #L 3 4 L 0.4000000 HD2022 #> 4: CB1 training #R 4 4 L 0.0000000 HD2022 #> 5: CB1 training L>(Pellet) 5 4 L 0.4000000 HD2022 #> --- #> 380: CB2 training #R 44 4 Sucrose 0.0000000 HD2022 #> 381: CB2 training L>(Sucrose) 45 4 Sucrose 0.4000000 HD2022 #> 382: CB2 training R>(Pellet) 46 4 Sucrose 0.0000000 HD2022 #> 383: CB2 training #L 47 4 Sucrose 0.3991293 HD2022 #> 384: CB2 training #R 48 4 Sucrose 0.0000000 HD2022 #> #> $associations #> group phase trial_type trial block_size s1 s2 value #> 1: CB1 training L>(Pellet) 1 4 L L 0.0000000 #> 2: CB1 training L>(Pellet) 1 4 L Pellet 0.0000000 #> 3: CB1 training L>(Pellet) 1 4 L R 0.0000000 #> 4: CB1 training L>(Pellet) 1 4 L Sucrose 0.0000000 #> 5: CB1 training L>(Pellet) 1 4 Pellet L 0.0000000 #> --- #> 1532: CB2 training #R 48 4 R Sucrose 0.0000000 #> 1533: CB2 training #R 48 4 Sucrose L 0.3991293 #> 1534: CB2 training #R 48 4 Sucrose Pellet 0.0000000 #> 1535: CB2 training #R 48 4 Sucrose R 0.0000000 #> 1536: CB2 training #R 48 4 Sucrose Sucrose 0.0000000 #> model #> 1: HD2022 #> 2: HD2022 #> 3: HD2022 #> 4: HD2022 #> 5: HD2022 #> --- #> 1532: HD2022 #> 1533: HD2022 #> 1534: HD2022 #> 1535: HD2022 #> 1536: HD2022 #> #> $pools #> group phase trial_type trial block_size s1 s2 type #> 1: CB1 training L>(Pellet) 1 4 L,Pellet L combvs #> 2: CB1 training L>(Pellet) 1 4 L,Pellet Pellet combvs #> 3: CB1 training L>(Pellet) 1 4 L,Pellet R combvs #> 4: CB1 training L>(Pellet) 1 4 L,Pellet Sucrose combvs #> 5: CB1 training R>(Sucrose) 2 4 R,Sucrose L combvs #> --- #> 764: CB2 training #L 47 4 L Sucrose chainvs #> 765: CB2 training #R 48 4 R L chainvs #> 766: CB2 training #R 48 4 R Pellet chainvs #> 767: CB2 training #R 48 4 R R chainvs #> 768: CB2 training #R 48 4 R Sucrose chainvs #> value model #> 1: 0 HD2022 #> 2: 0 HD2022 #> 3: 0 HD2022 #> 4: 0 HD2022 #> 5: 0 HD2022 #> --- #> 764: 0 HD2022 #> 765: 0 HD2022 #> 766: 0 HD2022 #> 767: 0 HD2022 #> 768: 0 HD2022 #> #> $responses #> group phase trial_type trial block_size s1 s2 value model #> 1: CB1 training L>(Pellet) 1 4 L L 0 HD2022 #> 2: CB1 training L>(Pellet) 1 4 L Pellet 0 HD2022 #> 3: CB1 training L>(Pellet) 1 4 L R 0 HD2022 #> 4: CB1 training L>(Pellet) 1 4 L Sucrose 0 HD2022 #> 5: CB1 training L>(Pellet) 1 4 Pellet L 0 HD2022 #> --- #> 1532: CB2 training #R 48 4 R Sucrose 0 HD2022 #> 1533: CB2 training #R 48 4 Sucrose L 0 HD2022 #> 1534: CB2 training #R 48 4 Sucrose Pellet 0 HD2022 #> 1535: CB2 training #R 48 4 Sucrose R 0 HD2022 #> 1536: CB2 training #R 48 4 Sucrose Sucrose 0 HD2022 my_model_function <- function(pars, exper, full = FALSE) { # extract the parameters from the model new_parameters <- parameters(exper)[[1]] # assign alphas new_parameters$alphas[] <- pars # reassign parameters to the experiment parameters(exper) <- new_parameters # note parameters method # running the model and selecting responses exp_res <- run_experiment(exper) # summarizing the model responses <- results(exp_res)$responses # calculate extra variables responses$response <- ifelse(responses$s1 %in% c(\"Pellet\", \"Sucrose\"), \"np\", \"lp\" ) responses$block <- ceiling(responses$trial / 8) # filtering # only probe trials responses <- responses[grepl(\"#\", trial_type)] # only available responses responses <- responses[s2 %in% c(\"Pellet\", \"Sucrose\") & (response == \"np\" | (response == \"lp\" & mapply(grepl, s1, trial_type)))] # aggregate responses <- responses[, list(value = mean(value)), by = \"block,s2,response\"] if (full) { return(responses) } responses$value } my_model_function(c(.1, .2, .4, .3), experiment) #> [1] 0.028557609 0.040188221 0.004008696 0.008429327 0.045573899 0.061933782 #> [7] 0.010480790 0.021230102 0.053426837 0.070862133 0.015100913 0.029677071 #> [13] 0.057584182 0.074995358 0.018328387 0.035165746 0.059994400 0.077081202 #> [19] 0.020711121 0.039013071 0.061492438 0.078227391 0.022547790 0.041891069 head(my_model_function(c(.1, .2, .4, .3), experiment, full = TRUE)) #> block s2 response value #> 1: 1 Pellet lp 0.028557609 #> 2: 1 Sucrose lp 0.040188221 #> 3: 1 Pellet np 0.004008696 #> 4: 1 Sucrose np 0.008429327 #> 5: 2 Pellet lp 0.045573899 #> 6: 2 Sucrose lp 0.061933782 head(pati_summ) #> block us response rpert #> 1: 1 P lp 0.8195313 #> 2: 1 S lp 0.5609375 #> 3: 1 P np 3.4109375 #> 4: 1 S np 3.2796875 #> 5: 2 P lp 1.5738281 #> 6: 2 S lp 0.6406250"},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"fitting-the-model","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Fitting the model","title":"calmr_fits","text":"fit models using fit_model() function. function requires 4 arguments: (empirical) data. model function. arguments run model function. optimizer options. done great job taking care first three, let’s tackle last. get_optimizer_opts() function returns many things: model_pars: name model parameters (name alpha stimulus). ll ul: lower upper limits parameter search. optimizer: numerical optimization technique wish use MLE estimation. family: family distribution assume model. practice, request used determine link function transform model responses, likelihood function used objective function. normal family nothing fancy model responses estimate extra parameter, scale, scales model responses scale empirical data. comes likelihood functions, family use normal density data model differences. family_pars: family-specific parameter estimated alongside salience parameters. verbose: Whether print parameters objective function values optimize. free modify ; just make sure structure list returned get_optimizer_opts() remains . can also pass extra parameters optimizer call using (e.g., par argument optim, parallel ga). , fit model parallel ga, 10 iterations. , can fit model! (patient following along) fit_model function returns lot information track put got . However, typing model console show MLE parameters obtained time negative log-likelihood, given data: ’s good , well model run parameters “visually” fit data? can obtain predictions model via predict function. looks pretty good! Save blatant misfits, course. Now know everything need fit calmr empirical data. Go forth!","code":"my_optimizer_opts <- get_optimizer_opts( model_pars = names(parameters$alphas), optimizer = \"ga\", ll = c(0, 0, 0, 0), ul = c(1, 1, 1, 1), family = \"normal\" ) my_optimizer_opts #> $model_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" #> #> $optimizer #> [1] \"ga\" #> #> $family #> [1] \"normal\" #> #> $family_pars #> [1] \"normal_scale\" #> #> $all_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" \"normal_scale\" #> #> $initial_pars #> [1] NA NA NA NA 1 #> #> $ll #> L Pellet R Sucrose normal_scale #> 0 0 0 0 0 #> #> $ul #> L Pellet R Sucrose normal_scale #> 1 1 1 1 100 #> #> $verbose #> [1] FALSE the_fit <- fit_model(pati_summ$rpert, model_function = my_model_function, exper = experiment, optimizer_options = my_optimizer_opts, maxiter = 10, parallel = TRUE ) the_fit # the BIC and AIC BIC(the_fit) #> [1] 102.484 AIC(the_fit) #> [1] 96.5937 pati_summ$prediction <- predict(the_fit, exper = experiment) pati_summ[, data := rpert][, rpert := NULL] pati_summ <- melt(pati_summ, measure.vars = c(\"prediction\", \"data\")) pati_summ |> ggplot(ggplot2::aes( x = block, y = value, colour = us, linetype = variable )) + geom_line() + theme_bw() + facet_grid(us ~ response)"},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"a-final-note","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data > Fitting the model","what":"A final note","title":"calmr_fits","text":"vignette pre-generated, don’t want user fit model time installation. try keep package develops, spot inconsistencies, please drop line.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"using-the-calm-app","dir":"Articles","previous_headings":"","what":"Using the calm app","title":"calm_app","text":"beginner useR simply want simulate experimental design see model , might interested using calm application. calm application offers GUI allows simulate experiments without writing code. want use online app, can find : https://victor-navarro.shinyapps.io/calm_app/. Alternatively, installed calm package, can launch app via calm::calm_app(). rest tutorial assumes app open ready run. Let’s break GUI.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"design-table","dir":"Articles","previous_headings":"The GUI","what":"Design Table","title":"calm_app","text":"design table specify experimental design run. Using Group- Group+, can remove add groups design. Using Phase- Phase+, can remove add phases design. Parse Design button used parse design, required step run simulation. later. P1 P2 columns specify phases experiment simulated left right. entry columns specifies trials given corresponding groups (G1 G2, case). entries must obey special syntax (see calm_basics additional information). now, suffice say : number trials specified via digits left trial. example, 10A(US) specifies ten “(US)” trials. Stimuli (elements) specified letters. example, 10AB(US) specifies elements B US. Named stimuli specified within parentheses. example, (US) implies element named “US” instead compound containing elements “U” “S”. Multiple trials per phase separated via forward slash (/). Additionally, one can choose randomize trials within phase ticking boxes R1 R2 columns. important note whatever user sets interact “Create trial blocks” option Options tab sidebar (see ahead). ’s full breakdown combinations behaviour: Table checked preferences checked: Trials shuffled within blocks possible (based greater common factor). example, 2A/2B gets shuffled 2 blocks containing one one B trial, 2A/1B gets shuffled 1 block containign two trials one B trial. Table unchecked preferences checked: Trials deterministically intermixed within blocks possible. example, 2A/2B gets shuffled 2 blocks, resulting sequence ABAB. Table checked preferences unchecked: Trials shuffled completely random. Table unchecked preferences unchecked: Trials given order appearance. example, 2A/2B results AABB sequence. Go ahead parse design. new things appear GUI.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"parameters","dir":"Articles","previous_headings":"The GUI","what":"Parameters","title":"calm_app","text":"parsing valid design. user can set parameters experiment (including stimulus-related global parameters). case, Rescorla-Wagner model 4 parameters per stimulus. default values fairly sensible, can modify parameter hand favorite spreadsheet software. parametrization model calm can sometimes differ appears literature. following table contains links documentation pages model.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"results","dir":"Articles","previous_headings":"The GUI","what":"Results","title":"calm_app","text":"new button appears parsing experiment. final click button run model populate “Results” “Association Graphs” portions app. Go ahead run experiment. , new button appear, allowing download results spreadsheet. calm app, results shown visually. Clicking bar graph (one containing “Blocking - Response Strength …” ) show plots available. first portion plot’s name denotes group’s name. , plot shows strength associations among stimuli experiment across trials (blocks), faceted phases columns, origin stimuli rows. example, yellow lines denote strength B US. top column corresponds (look label right) middle column corresponds B. Go ahead explore available plots. usually self explanatory, consult documentation package case something unclear (specially using obscure models).","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"association-graphs","dir":"Articles","previous_headings":"The GUI","what":"Association Graphs","title":"calm_app","text":"bottom portion app shows network graphs depicting strength associations model given trial, groups. Yellow denotes excitatory strength (.e., positive values), gray denotes neutral strength (.e., values close zero), purple (shown ) shows inhibitory strength (.e., negative values). Move “Trial” slider explore associations model change across experiment.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"other-bits","dir":"Articles","previous_headings":"The GUI","what":"Other bits","title":"calm_app","text":"sections implement bulk functionalities calm app. following sections describe additional options convenience functions found useful.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"options","dir":"Articles","previous_headings":"The GUI > Other bits","what":"Options","title":"calm_app","text":"set number iterations run experiment (important model behaviour sensitive trial order effects), whether want create trial blocks. also set can choose plot common scale y-axis (active default).","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"a-final-message","dir":"Articles","previous_headings":"The GUI","what":"A final message","title":"calm_app","text":"Hope enjoy app! find bugs, comments, like something implemented, feel free post message package’s github repository drop line navarrov [] cardiff.ac.uk.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"your-first-simulation","dir":"Articles","previous_headings":"","what":"Your first simulation","title":"calm_basics","text":"perform first simulation need: data.frame specifiying experiment design, list parameters model ’ll using.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"the-design-data-frame","dir":"Articles","previous_headings":"","what":"The design data.frame","title":"calm_basics","text":"example use blocking design. rules design data.frame: row represents group. first column contains group labels. remaining columns organized pairs (trials phase, whether randomize ) trials phase column specified using rigid notation. observations : Trials preceded number. number represents number times trial given phase. “10A(US)” means “(US)” trial given 10 times. presence absence unconditioned stimulus denoted traditional “+” “-” symbols. Instead, use parenthesis denote “complex” stimuli. can thought element complex name (.e., one character). , “(US)” specifies single element represent US. vein, multiple characters parentheses denote individual elements. example, “AB” implies presence two stimuli, B. “/” character used trial separator (imply randomization ). Thus, “1A/1B” specifies single “” trial single “B” trial given phase. Recall randomization trials within phase specified column (, R1, R2, R3). “#” character used denote probe trials. contrast real life, probe trials entail update model’s associations. , probe trials can used track development key associations, repercussion model learns normal training trials. want check whether phase string work simulator, can use phase_parser. function returns list lot information, let’s print fields.","code":"library(calm) my_blocking <- data.frame( Group = c(\"Exp\", \"Control\"), Phase1 = c(\"10A(US)\", \"10C(US)\"), R1 = c(FALSE, FALSE), Phase2 = c(\"10AB(US)\", \"10AB(US)\"), R2 = c(FALSE, FALSE), Test = c(\"1#A/1#B\", \"1#A/1#B\"), R3 = c(FALSE, FALSE) ) # parsing the design and showing the original and what was detected parsed <- parse_design(my_blocking) parsed #> CalmDesign built from data.frame: #> Group Phase1 R1 Phase2 R2 Test R3 #> 1 Exp 10A(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> 2 Control 10C(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 Exp Phase1 A(US) 10 FALSE A;US #> 2 Exp Phase2 AB(US) 10 FALSE A;B;US #> 3 Exp Test #A 1 TRUE A #> 4 Exp Test #B 1 TRUE B #> 5 Control Phase1 C(US) 10 FALSE C;US #> 6 Control Phase2 AB(US) 10 FALSE A;B;US #> 7 Control Test #A 1 TRUE A #> 8 Control Test #B 1 TRUE B # not specifying a number of AB trials. Error! phase_parser(\"AB/10AC\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # putting the probe symbol out of order. Error! phase_parser(\"#10A\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # considering a configural cue for elements AB trial <- phase_parser(\"10AB(AB)(US)\") # different USs trial <- phase_parser(\"10A(US1)/10B(US2)\")"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"the-parameters-list","dir":"Articles","previous_headings":"","what":"The parameters list","title":"calm_basics","text":"Now need pick model parameters. get models currently supported calm, can call supported_models(). choosing model, can get default parameters design get_parameters.","code":"supported_models() #> [1] \"HDI2020\" \"HD2022\" \"RW1972\" \"MAC1975\" \"PKH1982\" \"SM2007\" \"RAND\" #> [8] \"ANCCR\" my_pars <- get_parameters(my_blocking, model = \"RW1972\") # Increasing the beta parameter for US presentations my_pars$betas_on[\"US\"] <- .6 my_pars #> $alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $betas_on #> A B C US #> 0.4 0.4 0.4 0.6 #> #> $betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $lambdas #> A B C US #> 1 1 1 1"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"simulating","dir":"Articles","previous_headings":"The parameters list","what":"Simulating","title":"calm_basics","text":", can run simulation using run_experiment function. function also takes extra arguments manipulate number iterations run experiment , whether organize trials miniblocks (see help(make_experiment) additional details). , run experiment 5 iterations. advanced R user able dig data straight away. However, package also includes methods get quick look results.","code":"my_experiment <- run_experiment( my_blocking, # note we do not need to pass the parsed design model = \"RW1972\", parameters = my_pars, iterations = 5 ) # returns an CalmExperiment object class(my_experiment) #> [1] \"CalmExperiment\" #> attr(,\"package\") #> [1] \"calm\" # CalmExperiment is an S4 class, so it has slots slotNames(my_experiment) #> [1] \"design\" \"model\" \"groups\" \"parameters\" \"experiences\" #> [6] \"results\" \".model\" \".group\" \".iter\" # the experience given to group Exp on the first iteration my_experiment@experiences[[1]] #> model group phase tp tn is_test block_size trial #> 1 RW1972 Exp Phase1 1 A(US) FALSE 1 1 #> 2 RW1972 Exp Phase1 1 A(US) FALSE 1 2 #> 3 RW1972 Exp Phase1 1 A(US) FALSE 1 3 #> 4 RW1972 Exp Phase1 1 A(US) FALSE 1 4 #> 5 RW1972 Exp Phase1 1 A(US) FALSE 1 5 #> 6 RW1972 Exp Phase1 1 A(US) FALSE 1 6 #> 7 RW1972 Exp Phase1 1 A(US) FALSE 1 7 #> 8 RW1972 Exp Phase1 1 A(US) FALSE 1 8 #> 9 RW1972 Exp Phase1 1 A(US) FALSE 1 9 #> 10 RW1972 Exp Phase1 1 A(US) FALSE 1 10 #> 11 RW1972 Exp Phase2 2 AB(US) FALSE 1 11 #> 12 RW1972 Exp Phase2 2 AB(US) FALSE 1 12 #> 13 RW1972 Exp Phase2 2 AB(US) FALSE 1 13 #> 14 RW1972 Exp Phase2 2 AB(US) FALSE 1 14 #> 15 RW1972 Exp Phase2 2 AB(US) FALSE 1 15 #> 16 RW1972 Exp Phase2 2 AB(US) FALSE 1 16 #> 17 RW1972 Exp Phase2 2 AB(US) FALSE 1 17 #> 18 RW1972 Exp Phase2 2 AB(US) FALSE 1 18 #> 19 RW1972 Exp Phase2 2 AB(US) FALSE 1 19 #> 20 RW1972 Exp Phase2 2 AB(US) FALSE 1 20 #> 21 RW1972 Exp Test 3 #A TRUE 2 21 #> 22 RW1972 Exp Test 4 #B TRUE 2 22 # the number of times we ran the model (groups x iterations) length(experiences(my_experiment)) #> [1] 10 # an experiment has results with different levels of aggregation class(my_experiment@results) #> [1] \"CalmExperimentResult\" #> attr(,\"package\") #> [1] \"calm\" slotNames(my_experiment@results) #> [1] \"aggregated_results\" \"parsed_results\" \"raw_results\" # shorthand method to access aggregated_results results(my_experiment) #> $rs #> group phase trial_type trial s1 s2 block_size value model #> 1: Exp Phase1 A(US) 1 A A 1 0 RW1972 #> 2: Exp Phase1 A(US) 1 A B 1 0 RW1972 #> 3: Exp Phase1 A(US) 1 A C 1 0 RW1972 #> 4: Exp Phase1 A(US) 1 A US 1 0 RW1972 #> 5: Exp Phase1 A(US) 1 B A 1 0 RW1972 #> --- #> 700: Control Test #B 22 C US 2 0 RW1972 #> 701: Control Test #B 22 US A 2 0 RW1972 #> 702: Control Test #B 22 US B 2 0 RW1972 #> 703: Control Test #B 22 US C 2 0 RW1972 #> 704: Control Test #B 22 US US 2 0 RW1972 #> #> $vs #> group phase trial_type trial s1 s2 block_size value model #> 1: Exp Phase1 A(US) 1 A A 1 0.0000000 RW1972 #> 2: Exp Phase1 A(US) 1 A B 1 0.0000000 RW1972 #> 3: Exp Phase1 A(US) 1 A C 1 0.0000000 RW1972 #> 4: Exp Phase1 A(US) 1 A US 1 0.0000000 RW1972 #> 5: Exp Phase1 A(US) 1 B A 1 0.0000000 RW1972 #> --- #> 700: Control Test #B 22 C US 2 0.9939534 RW1972 #> 701: Control Test #B 22 US A 2 0.4999999 RW1972 #> 702: Control Test #B 22 US B 2 0.4999999 RW1972 #> 703: Control Test #B 22 US C 2 0.6626356 RW1972 #> 704: Control Test #B 22 US US 2 0.0000000 RW1972"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"plotting","dir":"Articles","previous_headings":"","what":"Plotting","title":"calm_basics","text":"Let’s use plot method create plots. model supports different types plots according results can produce (e.g., associations, responses, saliences, etc.) case, RW model supports associations responses.","code":"# get all the plots for the experiment plots <- plot(my_experiment) names(plots) #> [1] \"Exp - Response Strength (RW1972)\" #> [2] \"Control - Response Strength (RW1972)\" #> [3] \"Exp - Association Strength (RW1972)\" #> [4] \"Control - Association Strength (RW1972)\" # or get a specific type of plot specific_plot <- plot(my_experiment, type = \"vs\") names(specific_plot) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" # show which plots are supported by the model we are using supported_plots(\"RW1972\") #> [1] \"rs\" \"vs\""},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"stimulus-associations","dir":"Articles","previous_headings":"Plotting","what":"Stimulus associations","title":"calm_basics","text":"columns phases design rows denote source association. colors within panel determine target association.","code":"plot(my_experiment, type = \"vs\") #> $`Exp - Association Strength (RW1972)` #> #> $`Control - Association Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"responding","dir":"Articles","previous_headings":"Plotting","what":"Responding","title":"calm_basics","text":"Fairly similar , time responding function stimuli presented trial.","code":"plot(my_experiment, type = \"rs\") #> $`Exp - Response Strength (RW1972)` #> #> $`Control - Response Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"graphing","dir":"Articles","previous_headings":"","what":"Graphing","title":"calm_basics","text":"can also take look state model’s associations point training, using graph method experiment.","code":"my_graph_opts <- get_graph_opts(\"small\") graph(my_experiment, t = 20, graph_opts = my_graph_opts) #> $RW1972 #> $RW1972$`Exp - Associations (RW1972)` #> #> $RW1972$`Control - Associations (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"final-thoughts","dir":"Articles","previous_headings":"","what":"Final thoughts","title":"calm_basics","text":"calm package designed simulate quickly: write design get glance model predictions. Yet, package also features advanced R users, make sure check vignettes ready.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"fitting-heidi-to-empirical-data","dir":"Articles","previous_headings":"","what":"Fitting HeiDI to empirical data","title":"calm_fits","text":"demo, fit HeiDI empirical data (Patitucci et al., 2016, Experiment 1). involve writing function produces model responses organized empirical data, using function maximum likelihood estimation (MLE). begin short overview data, move model function, finally fit model.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"the-data","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"The data","title":"calm_fits","text":"data (pati) contains responses (lever presses lp, nose pokes np) 32 subjects (rats) across 6 blocks training (2 sessions per block). animals trained associate two levers one two unconditioned stimuli (pellets sucrose). Let’s take look . thicker lines group averages; rest individual subjects. ignore specific mapping levers USs , counterbalanced across subjects. However, counterbalancing end relevant (see ahead).","code":"glimpse(pati) #> Rows: 768 #> Columns: 6 #> $ subject 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1… #> $ block 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3… #> $ lever L, L, L, L, L, L, R, R, R, R, R, R, L, L, L, L, L, L, R, R, R… #> $ us \"P\", \"P\", \"P\", \"P\", \"P\", \"P\", \"S\", \"S\", \"S\", \"S\", \"S\", \"S\", \"… #> $ response lp, lp, lp, lp, lp, lp, lp, lp, lp, lp, lp, lp, np, np, np, n… #> $ rpert 0.9000, 1.5500, 3.3500, 4.1500, 4.6500, 4.3250, 0.4000, 0.162… pati |> ggplot(aes(x = block, y = rpert, colour = us)) + geom_line(aes(group = interaction(us, subject)), alpha = .3) + stat_summary(geom = \"line\", fun = \"mean\", linewidth = 1) + labs(x = \"Block\", y = \"Responses per trial\", colour = \"US\") + facet_grid(~response)"},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"writing-the-model-function","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Writing the model function","title":"calm_fits","text":"biggest hurdle fitting model empirical data write function , given vector parameters model arguments, generates responses organized empirical data. Let’s begin summarizing group data first, know aim . now prepare arguments model function (pass run_experimentexperiment. minor issue HeiDI sensitive order effects. Hence, arguments prepare must reflect behavior model “general” experimental procedure, quirks unfortunate run trials. , simply address issue running several iterations model (random trial orders) averaging models evaluating likelihood parameters. design? experiment presented Patittuci et al. (2016) fairly simple, can reduced presentations two levers, followed different appetitive outcome. , assume two outcomes independent . also take liberties number trials specify, reduce computing time. Note specified two counterbalancings groups. must reproduce counterbalancings data trying fit close possible. Otherwise, optimization process might latch onto experimentally-irrelevant variables. example, can seen pati lever pressing whenever lever paired pellets. didn’t counterbalance identities levers USs, optimization might result one levers less salient . can now begin write model function. First, good see results run_experiment returns. Although run_experiment function returns S4 class many things, care one : rs (model responses). , can write model function. Let’s dissect function three parts. put parameters (optimizer parameters) experiment using parameters method. run model select relevant information (rs). summarise model responses return .1 Let’s see function action. order empirical data model responses must match. emphasize point enough: nothing within fit function checks reorders data . sole responsible making sure pieces data order. simple way print model results return (see ). made sure everything looking good, can fit model.","code":"pati_summ <- pati |> group_by(block, us, response) |> summarise(rpert = mean(rpert), .groups = \"drop\") head(pati_summ) #> # A tibble: 6 × 4 #> block us response rpert #> #> 1 1 P lp 0.820 #> 2 1 P np 3.41 #> 3 1 S lp 0.561 #> 4 1 S np 3.28 #> 5 2 P lp 1.57 #> 6 2 P np 3.51 # The design data.frame des_df <- data.frame( group = c(\"CB1\", \"CB2\"), training = c( \"12L>(Pellet)/12R>(Sucrose)\", \"12L>(Sucrose)/12R>(Pellet)\" ), rand_train = TRUE ) # The parameters # the actual parameter values don't matter, # as our function will re-write them inside the optimizer call parameters <- get_parameters(des_df, model = \"HD2022\" ) # The arguments experiment <- make_experiment(des_df, parameters = parameters, model = \"HD2022\", iterations = 4 ) exp_res <- run_experiment(experiment) results(exp_res) #> $as #> group phase trial_type trial s1 block_size value model #> 1: CB1 training L>(Pellet) 1 L 2 0.4 HD2022 #> 2: CB1 training R>(Sucrose) 2 L 2 0.0 HD2022 #> 3: CB1 training R>(Sucrose) 3 L 2 0.0 HD2022 #> 4: CB1 training L>(Pellet) 4 L 2 0.4 HD2022 #> 5: CB1 training R>(Sucrose) 5 L 2 0.0 HD2022 #> --- #> 340: CB2 training R>(Pellet) 10 Pellet 2 0.4 HD2022 #> 341: CB2 training L>(Sucrose) 9 R 2 0.0 HD2022 #> 342: CB2 training R>(Pellet) 10 R 2 0.4 HD2022 #> 343: CB2 training L>(Sucrose) 9 Sucrose 2 0.4 HD2022 #> 344: CB2 training R>(Pellet) 10 Sucrose 2 0.0 HD2022 #> #> $acts #> group phase trial_type trial s1 s2 block_size type value #> 1: CB1 training L>(Pellet) 1 LPellet L 2 combvs 0 #> 2: CB1 training L>(Pellet) 1 LPellet Pellet 2 combvs 0 #> 3: CB1 training L>(Pellet) 1 LPellet R 2 combvs 0 #> 4: CB1 training L>(Pellet) 1 LPellet Sucrose 2 combvs 0 #> 5: CB1 training R>(Sucrose) 2 LPellet L 2 combvs 0 #> --- #> 1268: CB2 training R>(Pellet) 10 L Sucrose 2 chainvs 0 #> 1269: CB2 training R>(Pellet) 10 Sucrose L 2 chainvs 0 #> 1270: CB2 training R>(Pellet) 10 Sucrose Pellet 2 chainvs 0 #> 1271: CB2 training R>(Pellet) 10 Sucrose R 2 chainvs 0 #> 1272: CB2 training R>(Pellet) 10 Sucrose Sucrose 2 chainvs 0 #> model #> 1: HD2022 #> 2: HD2022 #> 3: HD2022 #> 4: HD2022 #> 5: HD2022 #> --- #> 1268: HD2022 #> 1269: HD2022 #> 1270: HD2022 #> 1271: HD2022 #> 1272: HD2022 #> #> $rs #> group phase trial_type trial s1 s2 block_size value model #> 1: CB1 training L>(Pellet) 1 L L 2 0 HD2022 #> 2: CB1 training L>(Pellet) 1 L Pellet 2 0 HD2022 #> 3: CB1 training L>(Pellet) 1 L R 2 0 HD2022 #> 4: CB1 training L>(Pellet) 1 L Sucrose 2 0 HD2022 #> 5: CB1 training L>(Pellet) 1 Pellet L 2 0 HD2022 #> --- #> 1372: CB2 training R>(Pellet) 10 R Sucrose 2 0 HD2022 #> 1373: CB2 training R>(Pellet) 10 Sucrose L 2 0 HD2022 #> 1374: CB2 training R>(Pellet) 10 Sucrose Pellet 2 0 HD2022 #> 1375: CB2 training R>(Pellet) 10 Sucrose R 2 0 HD2022 #> 1376: CB2 training R>(Pellet) 10 Sucrose Sucrose 2 0 HD2022 #> #> $vs #> group phase trial_type trial s1 s2 block_size value #> 1: CB1 training L>(Pellet) 1 L L 2 0.000000 #> 2: CB1 training L>(Pellet) 1 L Pellet 2 0.000000 #> 3: CB1 training L>(Pellet) 1 L R 2 0.000000 #> 4: CB1 training L>(Pellet) 1 L Sucrose 2 0.000000 #> 5: CB1 training L>(Pellet) 1 Pellet L 2 0.000000 #> --- #> 1372: CB2 training R>(Pellet) 10 R Sucrose 2 0.000000 #> 1373: CB2 training R>(Pellet) 10 Sucrose L 2 0.368896 #> 1374: CB2 training R>(Pellet) 10 Sucrose Pellet 2 0.000000 #> 1375: CB2 training R>(Pellet) 10 Sucrose R 2 0.000000 #> 1376: CB2 training R>(Pellet) 10 Sucrose Sucrose 2 0.000000 #> model #> 1: HD2022 #> 2: HD2022 #> 3: HD2022 #> 4: HD2022 #> 5: HD2022 #> --- #> 1372: HD2022 #> 1373: HD2022 #> 1374: HD2022 #> 1375: HD2022 #> 1376: HD2022 my_model_function <- function(parameters, experiment) { # manipulating parameters new_parameters <- parameters(experiment)[[1]] new_parameters$alphas[] <- parameters parameters(experiment) <- new_parameters # note parameters method # running the model and selecting rs exp_res <- run_experiment(experiment) # summarizing the model rs <- results(exp_res)$rs |> filter(s2 %in% c(\"Pellet\", \"Sucrose\")) |> mutate( response = ifelse(s1 %in% c(\"Pellet\", \"Sucrose\"), \"np\", \"lp\"), block = ceiling(trial / 4) ) |> rowwise() |> # note this filter below; # we do not allow lever presses if the lever was not presented on the trial filter(response == \"np\" | (response == \"lp\" & grepl(s1, trial_type))) |> mutate(us = ifelse(grepl(\"Pellet\", trial_type), \"P\", \"S\")) |> group_by(block, us, response) |> summarise(value = mean(value), .groups = \"drop\") rs$value } my_model_function(c(.1, .2, .4, .3), experiment = experiment) #> [1] 0.009200000 0.003028571 0.012075000 0.005769643 0.027451634 0.010299086 #> [7] 0.046803321 0.021698787 0.048681560 0.016592848 0.052716098 0.029575459 #> [13] 0.050783660 0.019358818 0.066233126 0.036222556 0.055000834 0.021867550 #> [19] 0.070767634 0.040360835 0.057311961 0.023442829 0.073063348 0.042882258"},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"fitting-the-model","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Fitting the model","title":"calm_fits","text":"fit models using fit_model function. function requires 4 arguments: (empirical) data model function arguments run model function. optimizer options. done great job taking care first three, let’s tackle last. get_optimizer_opts function returns many things: model_pars: name model parameters. , name alphas stimuli. ll ul: lower upper limits parameter search. Consider shrinking speed process. optimizer: numerical optimization technique wish use MLE estimation. family: family distribution assume model. practice, request used determine link function transform model responses, likelihood function used objective function. normal family nothing fancy model responses, estimate extra parameter, scale, scales model responses scale empirical data. comes likelihood functions, family use normal density data model differences. family_pars: family-specific parameter estimated alongside salience parameters. verbose: Whether print parameters objective function values optimize. free modify ; just make sure structure list returned get_optimizer_opts remains . can also pass extra parameters optimizer call using (e.g., par argument optim, parallel ga). , fit model parallel ga, 10 iterations. , can fit model! (patient following along) fit_model function returns lot information track put got . However, typing model console show MLE parameters obtained time negative log likelihood, given data: ’s good , well model run parameters “visually” fit data? can obtain predictions model via predict function. looks pretty good! Save blatant misfits, course. Now know everything need fit calm empirical data. Go forth!","code":"my_optimizer_opts <- get_optimizer_opts( model_pars = names(parameters$alphas), optimizer = \"ga\", ll = c(0, 0, 0, 0), ul = c(1, 1, 1, 1), family = \"normal\" ) my_optimizer_opts #> $model_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" #> #> $optimizer #> [1] \"ga\" #> #> $family #> [1] \"normal\" #> #> $family_pars #> [1] \"normal_scale\" #> #> $all_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" \"normal_scale\" #> #> $initial_pars #> [1] NA NA NA NA #> #> $ll #> L Pellet R Sucrose normal_scale #> 0 0 0 0 0 #> #> $ul #> L Pellet R Sucrose normal_scale #> 1 1 1 1 100 #> #> $verbose #> [1] FALSE the_fit <- fit_model(pati_summ$rpert, model_function = my_model_function, experiment = experiment, optimizer_options = my_optimizer_opts, maxiter = 10, parallel = TRUE ) the_fit #> Calm model fit: #> Parameters: #> L Pellet R Sucrose normal_scale #> 0.1576156 0.8031082 0.2654031 0.6415039 25.9897647 #> #> nLogLik: #> 38.61801 pati_summ$prediction <- predict(the_fit, experiment = experiment) pati_summ |> rename(\"data\" = \"rpert\") |> pivot_longer( cols = c(\"prediction\", \"data\"), names_to = \"type\", values_to = \"value\" ) |> ggplot(ggplot2::aes(x = block, y = value, colour = us, linetype = type)) + geom_line() + theme_bw() + facet_grid(us ~ response)"},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"a-final-note","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data > Fitting the model","what":"A final note","title":"calm_fits","text":"vignette pre-generated, don’t want user fit model time installation. try keep package develops, spot inconsistencies, please drop line.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"the-mathematics-behind-heidi","dir":"Articles","previous_headings":"","what":"The mathematics behind HeiDI","title":"HD2022","text":"HeiDI model four major components: 1) acquisition reciprocal associations stimuli, 2) pooling associations stimulus activations, 3) distribution activations stimulus-specific response units, 4) generation responses.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"acquiring-reciprocal-associations","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"1 - Acquiring reciprocal associations","title":"HD2022","text":"Whenever trial given, HeiDI learns associations among stimuli. association two stimuli, \\(\\) \\(j\\) denoted via \\(v_{,j}\\). association \\(v_{,j}\\) represents directional expectation: expectation \\(j\\) presented \\(\\). Furthermore, value represents nature effect \\(\\) representation \\(j\\). positive, presentation \\(\\) “excites” representation \\(j\\). negative, presentation \\(\\) “inhibits” representation \\(j\\). HeiDI learns “forward” associations stimuli, also reciprocal, “backward” associations. Thus, organisms presented \\(\\rightarrow j\\), organisms learn \\(v_{,j}\\), also \\(v_{j, }\\), expectation receiving \\(\\) presented \\(j\\). Note , sake brevity, learning equations specified forward associations.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"the-stimulus-expectation-rule","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 1 - Acquiring reciprocal associations","what":"1.1 - The stimulus expectation rule","title":"HD2022","text":"HeiDI generates expectations stimuli. expectation stimulus \\(j\\) (\\(e_j\\)) expressed \\[ \\tag{Eq. 1} e_j = \\sum_{k}^{K}x_kv_{k,j} \\] \\(K\\) set containing stimuli experiment, \\(x_k\\) quantity denoting presence absence stimulus \\(k\\) (1 0, respectively)1.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"learning-rule","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 1 - Acquiring reciprocal associations","what":"1.2 - Learning rule","title":"HD2022","text":"HeiDI learns appropriate expectations via error-correction mechanisms. trial \\(t\\), association stimuli \\(\\) \\(j\\) expressed \\[ \\tag{Eq. 2} v_{,j, t} = v_{,j, t-1} + \\Delta v_{,j, t} \\] \\(v_{j,, t-1}\\) forward association \\(\\) \\(j\\) trial \\(t-1\\), \\(\\Delta v_{,j, t}\\) change association result trial \\(t\\). delta term uses pooled error term expressed \\[ \\tag{Eq. 3} \\Delta v_{,j} = x_i\\alpha_i(x_jc\\alpha_j - e_j) \\] \\(\\alpha_i\\) \\(\\alpha_j\\) parameters representing salience stimuli \\(\\) \\(j\\), respectively (\\(0 \\le \\alpha \\le 1\\)), \\(c\\) scaling constant (\\(c = 1\\)). Note term denoting trial, \\(t\\) omitted simplicity.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"pooling-the-strength-of-associations","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"2 - Pooling the strength of associations","title":"HD2022","text":"HeiDI pools stimulus associations activate stimulus-specific representations. activation representation stimulus \\(j\\), \\(a_j\\), defined : \\[ \\tag{Eq. 4} a_{j,M} = o_{j,M} + h_{j,M} \\] \\(o_{j,M}\\) denotes combined associative strength towards stimulus \\(j\\) presence stimuli \\(M\\), \\(h_{j,M}\\) denotes chained associative strength towards stimulus \\(j\\) presence stimuli \\(M\\).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"combined-associative-strength","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 2 - Pooling the strength of associations","what":"2.1 - Combined associative strength","title":"HD2022","text":"quantity \\(o_{j,M}\\) result combining associative strength forward backward associations stimulus \\(j\\) \\[ \\tag{Eq. 5} o_{j,M} = \\sum_{m \\neq j}^{M}v_{m,j} + \\left(\\frac{\\sum_{m \\neq j}^{M}v_{m,j} \\sum_{m \\neq j}^{M}v_{j,m}}{c}\\right) \\] sums run stimuli \\(M\\) presented trial, different stimulus \\(j\\).2 left-hand term describes forward associations stimuli \\(M\\) \\(j\\) affect representation \\(j\\), whereas right-hand term describes backward associations \\(j\\) stimuli \\(M\\) affect representation (although modulated forward associations ).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"chained-associative-strength","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 2 - Pooling the strength of associations","what":"2.2 - Chained associative strength","title":"HD2022","text":"quantity \\(h_{j,M}\\) captures indirect associative strength stimuli \\(M\\) \\(j\\), via absent stimuli. , \\(h_{j,M}\\) defined \\[ \\tag{Eq. 6a} h_{j,M} = \\sum_{m \\neq j}^{M} \\sum_{n}^{N}\\frac{v_{m,n}o_{j,n}}{c} \\] N stimuli presented trial (.e., K-M). Note re-use \\(o\\), quantity defined Eq. 5. equation allows absent stimuli \\(N\\) influence representation stimulus \\(j\\), long association present stimuli \\(M\\). Honey Dwyer (2022), authors specify similarity-based mechanism modulates effect associative chains according similarity salience nominal retrieved stimuli3. , Eq. 6a expanded : \\[ \\tag{Eq. 6b} h_{j,M} = \\sum_{m \\neq j}^{M} \\sum_{n}^{N}S(\\alpha_{n}, \\alpha'_n)\\frac{v_{m,n}o_{j,n}}{c} \\] \\(S\\) similarity function takes nominal salience stimulus n, \\(\\alpha_n\\) (perceived \\(n\\) presented trial) retrieved salience, \\(\\alpha'_n\\) (perceived \\(n\\) retrieved via stimuli M, see ahead). function defined : \\[ \\tag{Eq. 7} S(\\alpha_n, \\alpha'_n) = \\frac{\\alpha_n}{\\alpha_n + |\\alpha_n-\\alpha'_n|} \\times \\frac{\\alpha'_n}{\\alpha'_n+ |\\alpha_n-\\alpha'_n|} \\] Notably, whenever one nominal salience given stimulus, \\(\\alpha_n\\) arithmetic mean among nominal values (see “heidi_similarity” vignette).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"distributing-strength-into-stimulus-specific-response-units","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"3 - Distributing strength into stimulus-specific response units","title":"HD2022","text":"HeiDI distributes pooled stimulus-specific strength among \\(K\\) stimuli, according relative salience. activation response unit \\(j\\), \\(R_j\\) expressed \\[ \\tag{Eq. 8} R_{j,k} = \\frac{\\theta(j)}{\\sum_{k}^{K}\\theta(k)}a_{k,M} \\] \\(j \\K\\). \\(K\\) can include present absent stimuli, \\(\\theta\\) function depends whether stimulus \\(k\\) absent (.e., \\(k \\N\\)) (.e., \\(k \\M\\)), : \\[ \\tag{Eq. 9} \\theta(k) = \\begin{cases} \\left |\\sum_{m}^{M}\\left( v_{m,k}+\\sum_{n \\neq k}^{N}\\frac{v_{m,n}v_{n,k}}{c}\\right) \\right|,& \\text{} k \\N\\\\ \\alpha_k, & \\text{otherwise} \\end{cases} \\] Note quantity absent stimuli absolute, prevent negative \\(\\theta\\) values due inhibitory associations4. Also, note summation term used left-hand side expression absent stimulus. implies present stimuli \\(M\\) contribute salience stimulus \\(k\\). Finally, note right-hand side expression present stimuli contribute via direct association \\(k\\), \\(v_{m,k}\\) also associative chains absent stimuli (c.f., Eq. 6a).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"4 - Generating responses","title":"HD2022","text":"Finally, HeiDI responds. response-generating mechanisms HeiDI currently underspecified. current version, HeiDI’s responses product activation stimulus-specific response units connection units specific motor units. , activation motor unit \\(q\\), \\(r_q\\), given \\[ \\tag{Eq. 10} r_q = R_jw_{j,q} \\] \\(w_{j,q}\\) weight representing association stimulus-specific unit \\(j\\) motor unit \\(q\\).","code":""},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"simulating-similarity-effects","dir":"Articles","previous_headings":"","what":"Simulating similarity effects","title":"heidi_similarity","text":"Honey Dwyer (2022), authors propose similarity retrieved nominal saliencies stimulus representations modulates quantities combination rule. Retrieved saliencies exclusively absent stimuli, result existing associations stimuli (see Eq. 8 model’s vignette). contrast, nominal saliencies denote intensity stimulus representations stimuli presented trial (\\(\\alpha\\)). intuitive example effect saliency similarity responding refers effect weakly retrieved representations behavior. low similarity weakly retrieved representation nominal representation result reduced effect former behavior. example, typical Pavlovian inhibition paradigm \\[(US)/AX\\], inhibitor (e.g., X) strong effect behavior presented weak effect behavior weakly retrieved stimulus strong association (e.g., ). Yet, inspiration proposing general rule fairly specific. attempt explain introduction delay CS US stimuli higher-order conditioning experiments sometimes enhance responding stimulus never paired US (e.g., AX/X(US) X(US)/AX).","code":""},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"reproducing-the-simulation-presented-in-the-paper","dir":"Articles","previous_headings":"Simulating similarity effects","what":"Reproducing the simulation presented in the paper","title":"heidi_similarity","text":"paper, authors plot similarity retrieved saliencies nominal saliencies stimulus X sensory preconditioning experiment short delay X US used (group Reduced) (group ). effect introducing delay simulated X saliency .36; otherwise, saliency .40. saliencies US fixed .30 .50, respectively, conditions.","code":"df <- data.frame( Group = c(\"Same\", \"Reduced\"), P1 = c(\"10A(X_a)\", \"10A(X_a)\"), R1 = c(FALSE, FALSE), P2 = c(\"10(X_a)(US)\", \"10(X_b)(US)\"), R2 = c(FALSE, FALSE) ) params <- get_parameters(df, model = \"HD2022\") params$alphas[] <- c(.30, .40, .50, .36) model <- run_experiment(df, model = \"HD2022\", parameters = params )"},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"plotting-the-similarity-between-saliencies","dir":"Articles","previous_headings":"Simulating similarity effects > Reproducing the simulation presented in the paper","what":"Plotting the similarity between saliencies","title":"heidi_similarity","text":"plot currently supported package, can easily generated passing \\(\\rightarrow X\\) association one alphas internal function used calculate similarity calmr:::.alphaSim.","code":"associations <- results(model)$associations[ s1 == \"A\" & s2 == \"X\" & phase == \"P1\" ] associations[ , nominal_alpha := ifelse(group == \"Reduced\", mean(.36, .40), .40) ][ , similarity := calmr:::.alphaSim(value, nominal_alpha) ] associations |> ggplot(aes(x = trial, y = similarity, linetype = group)) + geom_line() + theme_bw() + labs(x = \"Trial\", y = \"Similarity\", linetype = \"Group\")"},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"plotting-the-distribution-of-responding","dir":"Articles","previous_headings":"Simulating similarity effects > Reproducing the simulation presented in the paper","what":"Plotting the distribution of responding","title":"heidi_similarity","text":"one little bit trickier figure manuscript effectively contains many experiments varying number XA trials starting first-order conditioning phase. address , run multiple simulations different experimental designs. Run model. now can manually plot distribution responding among stimuli model$responses.","code":"ntrials <- 1:10 df <- data.frame( Group = c(paste0(\"S\", ntrials), paste0(\"R\", ntrials)), P1 = rep(paste0(ntrials, \"A(X_a)\"), 2), R1 = FALSE, P2 = rep(c(\"10(X_a)>(US)\", \"10(X_b)>(US)\"), each = 10), R2 = FALSE, P3 = \"1A#\", R3 = FALSE ) head(df) #> Group P1 R1 P2 R2 P3 R3 #> 1 S1 1A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 2 S2 2A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 3 S3 3A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 4 S4 4A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 5 S5 5A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 6 S6 6A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE model <- run_experiment(df, model = \"HD2022\", parameters = params ) responses <- results(model)$responses[phase == \"P3\" & s2 == \"US\"] responses[, `:=`( trial = trial - 11, group_lab = ifelse(substr(group, 1, 1) == \"R\", \"Reduced\", \"Same\") )] responses |> ggplot(aes(x = trial, y = value, colour = s1, linetype = group_lab)) + geom_line() + theme_bw() + labs(x = \"Trial\", y = \"R-value\", colour = \"stimulus\", linetype = \"Group\") + facet_wrap(~s2)"},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"some-final-notes","dir":"Articles","previous_headings":"Simulating similarity effects > Reproducing the simulation presented in the paper","what":"Some final notes","title":"heidi_similarity","text":"paper, Honey Dwyer completely specify rules choosing reference value similarity calculation whenever one nominal stimulus experienced. example, simulation, use two nominal versions X stimulus (X_a X_b), , whenever model compute similarity retrieved (.e., \\(\\rightarrow X\\)) conditioned saliency values, encounter problem choose among least two conditioned values (X_a X_b). Although authors paper chose saliency nominal X conditioned US (.e., X_b), specify choice made , less intuitive situations. way avoid solving issue, current implementation similarity rule uses average nominal stimuli reference value similarity calculation. specific simulation case, implementation reduces effect similarity distribution responding.","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"the-mathematics-behind-mac1975","dir":"Articles","previous_headings":"","what":"The mathematics behind MAC1975","title":"MAC1975","text":"grand departure global error term models RW1972 (Rescorla & Wagner, 1972), MAC1975 model (Mackintosh, 1975) uses local error terms changes stimulus associability (\\(\\alpha\\)) via error comparison mechanism promotes learning uncertain stimuli:","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"generating-expectations","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"1 - Generating expectations","title":"MAC1975","text":"Let \\(v_{k,j}\\) denote associative strength stimulus \\(k\\) stimulus \\(j\\). given trial, expectation stimulus \\(j\\), \\(e_j\\), given : \\[ \\tag{Eq.1} e_j = \\sum_{k}^{K}x_k v_{k,j} \\] \\(x_k\\) denotes presence (1) absence (0) stimulus \\(k\\), set \\(K\\) represents stimuli design.","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"2 - Learning associations","title":"MAC1975","text":"Changes association stimulus \\(\\) \\(j\\), \\(v_{,j}\\), given : \\[ \\tag{Eq.2} \\Delta v_{,j} = x_i \\alpha_i \\beta_j (\\lambda_j - v_{,j}) \\] \\(\\alpha_i\\) associability (attention devoted ) stimulus \\(\\), \\(\\beta_j\\) learning rate parameter determined properties \\(j\\), \\(\\lambda_j\\) maximum association strength supported \\(j\\) (asymptote).","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"learning-to-attend","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"3 - Learning to attend","title":"MAC1975","text":"parameter \\(\\alpha_i\\) changes function learning, proportionally difference absolute errors conveyed \\(\\) predictors1, via: \\[ \\tag{Eq.3} \\Delta \\alpha_{} = x_i\\theta_i \\sum_{j}^{K}\\gamma_j(|\\lambda_j - \\sum_{k \\ne }^{K}v_{k,j}|-|\\lambda_j - v_{,j}|) \\] \\(\\theta_i\\) attentional learning rate parameter stimulus \\(\\) (usually fixed across stimuli). Although Mackintosh (1975) extend model account predictive power within-compound associations, implementation model package . can sometimes result unexpected behavior, , Eq. 3 includes extra parameter \\(\\gamma_j\\) (defaulting 1/K) denotes whether expectation stimulus \\(j\\) contributes attentional learning. , user can set parameters manually reflect contribution different experimental stimuli. example, simple “AB>(US)” design, setting \\(\\gamma_{US}\\) = 1 \\(\\gamma_{} = \\gamma_{B} = 0\\) leads behavior original model.","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"4 - Generating responses","title":"MAC1975","text":"specification response-generating mechanisms MAC1975. However, simplest response function can adopted identity function stimulus expectations. , responses reflecting nature \\(j\\), \\(r_j\\), given : \\[ \\tag{Eq.4} r_j = e_j \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"rw1972","dir":"Articles","previous_headings":"","what":"RW1972","title":"Model Parameters","text":"","code":"model_parameters(\"RW1972\") ## $name ## [1] \"alphas\" \"betas_on\" \"betas_off\" \"lambdas\" ## ## $default_value ## [1] 0.4 0.4 0.4 1.0"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"mac1975","dir":"Articles","previous_headings":"","what":"MAC1975","title":"Model Parameters","text":"","code":"model_parameters(\"MAC1975\") ## $name ## [1] \"alphas\" \"min_alphas\" \"max_alphas\" \"betas_on\" \"betas_off\" ## [6] \"lambdas\" \"thetas\" \"gammas\" ## ## $default_value ## [1] 0.4 0.1 1.0 0.4 0.4 1.0 0.2 0.3"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"pkh1982","dir":"Articles","previous_headings":"","what":"PKH1982","title":"Model Parameters","text":"","code":"model_parameters(\"PKH1982\") ## $name ## [1] \"alphas\" \"min_alphas\" \"max_alphas\" \"betas_ex\" \"betas_in\" ## [6] \"lambdas\" \"thetas\" \"gammas\" ## ## $default_value ## [1] 0.4 0.1 1.0 0.4 0.3 1.0 1.0 0.3"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"sm2007","dir":"Articles","previous_headings":"","what":"SM2007","title":"Model Parameters","text":"","code":"model_parameters(\"SM2007\") ## $name ## [1] \"alphas\" \"lambdas\" \"omegas\" \"rhos\" \"gammas\" \"taus\" \"order\" ## ## $default_value ## [1] 0.4 1.0 0.2 1.0 1.0 0.2 1.0"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"hdi2020hd2022","dir":"Articles","previous_headings":"","what":"HDI2020/HD2022","title":"Model Parameters","text":"","code":"model_parameters(\"HDI2020\") ## $name ## [1] \"alphas\" ## ## $default_value ## [1] 0.4 model_parameters(\"HD2022\") ## $name ## [1] \"alphas\" ## ## $default_value ## [1] 0.4"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"td","dir":"Articles","previous_headings":"","what":"TD","title":"Model Parameters","text":"","code":"model_parameters(\"TD\") ## $name ## [1] \"alphas\" \"betas_on\" \"betas_off\" \"lambdas\" \"gamma\" \"sigma\" ## ## $default_value ## [1] 0.05 0.40 0.40 1.00 0.95 0.90"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"anccr","dir":"Articles","previous_headings":"","what":"ANCCR","title":"Model Parameters","text":"","code":"model_parameters(\"ANCCR\") ## $name ## [1] \"reward_magnitude\" \"betas\" \"cost\" ## [4] \"temperature\" \"threshold\" \"k\" ## [7] \"w\" \"minimum_rate\" \"sampling_interval\" ## [10] \"use_exact_mean\" \"t_ratio\" \"t_constant\" ## [13] \"alpha\" \"alpha_reward\" \"use_timed_alpha\" ## [16] \"alpha_exponent\" \"alpha_init\" \"alpha_min\" ## [19] \"add_beta\" \"jitter\" ## ## $default_value ## [1] 1.000 1.000 0.000 1.000 0.600 1.000 0.500 0.001 0.200 0.000 1.200 NA ## [13] 0.020 0.200 0.000 1.000 1.000 0.000 0.000 1.000"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"rand","dir":"Articles","previous_headings":"","what":"RAND","title":"Model Parameters","text":"","code":"model_parameters(\"RAND\") ## $name ## [1] \"alphas\" ## ## $default_value ## [1] 0.4"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calm.html","id":"running-experiments-in-parallel","dir":"Articles","previous_headings":"","what":"Running experiments in parallel","title":"parallelism_in_calm","text":"advent time-based models, version 0.51 calm uses future package parallelize operations. Thanks design philosophy future, running things parallel takes single line code.","code":""},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calm.html","id":"why-run-things-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Why run things in parallel?","title":"parallelism_in_calm","text":"many situations find run model many iterations, either design contains enough kinds trials order effects worry, want run model different parameters. Let’s run HeiDI model (Honey et al., 2020) long, random design. Let’s also enable verbosity via calm_verbosity, uses cool progressr package. can see timings , elapsed column. Let’s try parallelizing now.","code":"library(calm) # enables progress bars (try it on your computer) # calm_verbosity(TRUE) pav_inhib <- data.frame( group = \"group\", phase1 = \"50(US)/50AB/50#A\", rand1 = TRUE ) # set options to introduce more randomness pars <- get_parameters(pav_inhib, model = \"HDI2020\") exp <- make_experiment(pav_inhib, parameters = pars, model = \"HDI2020\", iterations = 100, miniblocks = FALSE ) # time it start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 1.92 0.06 3.33"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calm.html","id":"running-an-experiment-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Running an experiment in parallel","title":"parallelism_in_calm","text":"run experiment, parallel, need enable future plan. “plan” one many ways future package can parallelize things (consult documentation). Regardless, running calm single computer, ’ll using plan(multisession) case, parallel evaluation slower. future package trades ease use bulkier overheads. overheads tend constant, parallelization better payoff run iterations.","code":"library(future) plan(multisession) start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 0.79 0.03 4.49 # go back to non-parallel evaluations plan(sequential)"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calmr.html","id":"running-experiments-in-parallel","dir":"Articles","previous_headings":"","what":"Running experiments in parallel","title":"parallelism_in_calmr","text":"advent time-based models, version 0.51 calmr uses future package parallelize operations. Thanks design philosophy future, running things parallel take single line code.","code":""},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calmr.html","id":"why-run-things-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Why run things in parallel?","title":"parallelism_in_calmr","text":"many situations find run model many iterations, either design contains enough kinds trials order effects worry, want run model different parameters. Let’s run HeiDI model (Honey et al., 2020) long, random design. Let’s also enable verbosity via calmr_verbosity(), uses progressr package. Let’s try parallelizing now.","code":"library(calmr) # enables progress bars (try it on your computer) # calmr_verbosity(TRUE) pav_inhib <- data.frame( group = \"group\", phase1 = \"50(US)/50AB/50#A\", rand1 = TRUE ) # set options to introduce more randomness pars <- get_parameters(pav_inhib, model = \"HDI2020\") exp <- make_experiment(pav_inhib, parameters = pars, model = \"HDI2020\", iterations = 100, miniblocks = FALSE ) # time it start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 1.17 0.05 3.59"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calmr.html","id":"running-an-experiment-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Running an experiment in parallel","title":"parallelism_in_calmr","text":"run experiment, parallel, need enable future plan. “plan” one many ways future package can parallelize things (really consult documentation). Regardless, running calmr single computer, ’ll using plan(multisession) case, parallel evaluation faster (see user time ). future package trades ease use bulkier overheads, overheads tend constant, parallelization better payoff run iterations.","code":"library(future) plan(multisession) start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 0.74 0.07 6.33 # go back to non-parallel evaluations plan(sequential)"},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"the-mathematics-behind-pkh1982","dir":"Articles","previous_headings":"","what":"The mathematics behind PKH1982","title":"PKH1982","text":"Another departure global error term models RW1972 (Rescorla & Wagner, 1972), PKH1982 model (Pearce et al., 1982) use error term learning excitatory associations (inhibitory associations), ties stimulus associability (\\(\\alpha\\)) absolute global prediction error. note: implementation model closely follows technical note CAL-R group possible. Divergences noted.","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"generating-expectations","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"1 - Generating expectations","title":"PKH1982","text":"Let \\(v_{k,j}\\) denote excitatory strength stimulus \\(k\\) stimulus \\(j\\), \\(v_{k,\\overline j}\\) inhibitory strength stimulus \\(k\\) stimulus \\(j\\) (effectively, “j” representation). given trial, net expectation stimulus \\(j\\), \\(e_j\\), given : \\[ \\tag{Eq.1} e_j = \\sum_{k}^{K}x_k v_{k,j} - \\sum_{k}^{K}x_k v_{k,\\overline j} \\] \\(x_k\\) denotes presence (1) absence (0) stimulus \\(k\\), set \\(K\\) represents stimuli design.","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"2 - Learning associations","title":"PKH1982","text":"Changes excitatory inhibitory associations stimuli given : \\[ \\tag{Eq.2a} \\Delta v_{,j} = \\delta_jx_i \\beta_{ex,j} \\alpha_i \\lambda_j \\] \\[ \\tag{Eq.2b} \\Delta v_{,\\overline j} = x_i \\beta_{,j} \\alpha_i |\\overline{\\lambda_j}| \\] \\(\\beta_{ex,j}\\) \\(\\beta_{,j}\\) represent learning rates excitatory inhibitory associations, respectively, determined stimulus \\(j\\), \\(\\alpha_i\\) associability stimulus \\(\\), respectively, \\(\\lambda_j\\) \\(\\overline {\\lambda_j}\\) excitatory asymptote overexpectation stimulus \\(j\\), respectively. Importantly, \\(\\delta_j\\) Eq.2a parameter equal 1 expectation stimulus \\(j\\), lower excitatory asymptote (.e., \\(e_j < \\lambda_j\\)), 0 . implies model stops strengthening \\(v_{,j}\\) expectation \\(j\\) higher excitatory asymptote. mentioned introductory note, PKH1982 model learn excitatory associations via correction error. However, model learn inhibitory associations via correction error, overexpectation term , \\(\\overline {\\lambda_j}\\) equal \\(min(\\lambda_j - e_j, 0)\\), \\(min\\) minimum function. implies \\(\\overline {\\lambda_j}\\) takes non-zero values expectation \\(j\\) higher intensity trial (\\(\\lambda_j\\)).","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"learning-to-attend","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"3 - Learning to attend","title":"PKH1982","text":"associability parameter \\(\\alpha_i\\) changes completely trial trial function learning (note lack \\(\\Delta\\) ), change equal difference absolute global error, via: \\[ \\tag{Eq.3} \\Delta \\alpha_{} = x_i \\sum_{j}^{K}\\gamma_j(|\\lambda_j - e_j|) \\] \\(\\gamma_j\\) denotes contribution prediction error based jth stimulus. regard, important note Pearce et al. (1982) extend model account predictive power within-compound associations, yet implementation model package . can sometimes result unexpected behaviour, , Eq. 3 includes extra parameter \\(\\gamma_j\\) (defaulting 1/K) denotes whether expectation stimulus \\(j\\) contributes attentional learning. , user can set parameters manually reflect contribution different experimental stimuli. example, simple “AB>(US)” design, setting \\(\\gamma_{US}\\) = 1 \\(\\gamma_{} = \\gamma_{B} = 0\\) leads behavior original model. PKH1982 model improves upon Pearce & Hall (1980) model adding extra parameter controls rate associability changes. qualify changes associability determined Eq.3 via \\(\\Delta\\alpha_{}^{n}\\) (meaning happened trial \\(n\\)), can quantify total associability stimulus \\(\\) trial \\(n\\) via: \\[ \\tag{Eq.4} \\alpha_{}^{n} = \\begin{cases} (1-\\theta_i) \\alpha_{}^{n-1} + \\theta_i\\Delta\\alpha_{j}^n &\\text{, } x_i = 1\\\\ \\alpha_{}^{n} & \\text{, otherwise} \\end{cases} \\] \\(\\theta_i\\) parameter determining rate associability decays (via \\(1-\\theta_i\\)), rate increments attention occur. Note changes associability apply stimuli presented trial (.e., \\(x_i = 1\\)); attention absent stimuli remains unchanged.","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"4 - Generating responses","title":"PKH1982","text":"specification response-generating mechanisms PKH1982. However, simplest response function can adopted identity function stimulus expectations. , responses reflecting nature \\(j\\), \\(r_j\\), given : \\[ \\tag{Eq.5} r_j = e_j \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/RAND.html","id":"the-mathematics-behind-rand","dir":"Articles","previous_headings":"","what":"The mathematics behind RAND","title":"RAND","text":"RAND RW-based model associations randomized every trial. Therefore, model responds randomly. model meant comparisons .","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"the-mathematics-behind-rw1972","dir":"Articles","previous_headings":"","what":"The mathematics behind RW1972","title":"RW1972","text":"influential associative learning model, RW1972 (Rescorla & Wagner, 1972), learns global error posits changes stimulus associability.","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"generating-expectations","dir":"Articles","previous_headings":"The mathematics behind RW1972","what":"1 - Generating expectations","title":"RW1972","text":"Let \\(v_{k,j}\\) denote associative strength stimulus \\(k\\) stimulus \\(j\\). given trial, expectation stimulus \\(j\\), \\(e_j\\), given : \\[ \\tag{Eq.1} e_j = \\sum_{k}^{K}x_k v_{k,j} \\] \\(x_k\\) denotes presence (1) absence (0) stimulus \\(k\\), set \\(K\\) represents stimuli design.","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind RW1972","what":"2 - Learning associations","title":"RW1972","text":"Changes association stimulus \\(\\) \\(j\\), \\(v_{,j}\\), given : \\[ \\tag{Eq.2} \\Delta v_{,j} = \\alpha_i \\beta_j (\\lambda_j - e_j) \\] \\(\\alpha_i\\) associability stimulus \\(\\), \\(\\beta_j\\) learning rate parameter determined properties \\(j\\)1, \\(\\lambda_j\\) maximum association strength supported \\(j\\) (asymptote).","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind RW1972","what":"3 - Generating responses","title":"RW1972","text":"specification response-generating mechanisms RW1972. However, simplest response function can adopted identity function stimulus expectations. , responses reflecting nature \\(j\\), \\(r_j\\), given : \\[ \\tag{Eq.3} r_j = e_j \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"the-mathematics-behind-socr","dir":"Articles","previous_headings":"","what":"The mathematics behind SOCR","title":"SM2007","text":"first formalization comparator hypothesis (Miller & Matzel, 1988), sometimes competing retrieval model (SOCR; Stout & Miller, 2007) learns local error responds function relative associative strength present retrieved stimuli.","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"1 - Learning associations","title":"SM2007","text":"SOCR model uses two different learning equations strengthening weakening associations. Whenever two stimuli contiguous, strengthening occurs. case, strengthening association stimulus \\(\\) \\(j\\) trial \\(t\\), \\(v_{,j}^t\\) given : \\[ \\tag{Eq.1a} \\Delta v_{,j}^t = x^t_i \\alpha_i \\alpha_j (\\lambda_j - v_{,j}^{t-1}) \\] \\(x^t_i\\) denotes presence (1) absence (0) stimulus \\(\\) trial \\(t\\). , SOCR model learns stimuli presented. parameters \\(\\alpha_i\\) \\(\\alpha_j\\) saliencies stimuli j, respectively, \\(\\lambda_j\\) maximum association strength supported \\(j\\) (asymptote). Whenever stimulus \\(\\) presented alone (.e., stimulus \\(j\\) absent), weakening association given : \\[ \\tag{Eq.1b} \\Delta v_{,j}^t = x_i \\alpha_i \\times -\\omega_j v_{,j}^{t-1} \\] \\(\\omega_j\\) determines weakening rate stimulus \\(j\\).1","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"activating-stimuli","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"2 - Activating stimuli","title":"SM2007","text":"SOCR posits competition stimuli presented /associatively retrieved. Dropping trial notation sake simplicity, degree stimulus \\(\\) activates stimulus \\(j\\), \\(act_{,j}\\), given : \\[ \\tag{Eq.2} act_{, j} = x_i v_{,j} + x_j\\rho_j\\alpha_j \\] \\(\\rho_j\\) (bound 0 +\\(\\infty\\)) determines much salience stimulus \\(j\\) contributes unconditioned activation. first-order activation values key quantities involved comparison processes.","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"generating-responses-and-comparison-processes","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"3 - Generating responses and comparison processes","title":"SM2007","text":"Stimulus \\(\\) generates j-oriented responding time retrieval function relative ability activate stimulus \\(j\\). relative ability expressed comparison process, given : \\[ \\tag{Eq.3} r^j_i = act_{,j} - \\Sigma_{k \\neq ,j} ^K \\gamma_k \\times o_{,k,j} \\times r^k_i \\times r^j_k \\] \\(r^j_i\\) relative activation stimulus \\(j\\) stimulus \\(\\), \\(K\\) set experimental stimuli including \\(\\) \\(j\\), \\(\\gamma_k\\) parameter determining degree stimulus \\(k\\), comparison stimulus, contributes comparison process (bound 0 1), \\(o_{,k,j}\\) operator switch determines whether \\(\\) \\(k\\) associations \\(j\\) engage facilitation competition. Finally, \\(r^k_i\\) relative activation stimulus \\(k\\) stimulus \\(\\), representing ability stimulus \\(\\) activate comparison, \\(r^j_k\\) relative activation stimulus \\(j\\) stimulus \\(k\\), representing ability comparison stimulus \\(k\\) activate stimulus \\(j\\).2 notably, last two quantities (\\(r^k_i\\) \\(r^j_k\\)) also determined corresponding instantiations Eq. 3. , involve comparison processes . number potential comparison processes technically infinite (comparison process can nest two extra comparison processes ), user must determine order model using extra global parameter (order). n-th order models (\\(n > 0\\)), model behave like extended comparator hypothesis (Denniston et al., 2001), implementing \\(n\\) comparison processes time relative activations calculated. order = 0, SM2007 behave like originally written consider one comparison process. Indeed, n-th order models accomplished via recursion using 0-th order model stopping condition. condition reached, \\(r^k_i\\) \\(r^j_k\\) terms Eq. 3 become \\(act_{,k}\\) \\(act_{k,j}\\), respectively.","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"switching-between-facilitation-and-competition","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"4 - Switching between facilitation and competition","title":"SM2007","text":"operator switch Eq. 3, \\(o_{,k,j}\\), changes subjects learn discriminate directly (via \\(\\)) indirectly activated (via \\(k\\)) representations stimulus \\(j\\). change quantity depends value \\(v_{,j}\\), follows: \\[ \\tag{Eq.4} \\Delta o_{,k,j} = \\begin{cases} \\tau_j\\alpha_iv_{,k}v_{k,j}(1-o_{,k,j}) &\\text{, } v_{,j} = 0\\\\ 1-o_{,k,j} & \\text{, otherwise} \\end{cases} \\] negative values \\(o\\) indicate facilitation positive values \\(o\\) indicate competition. default value operator switches outset training set -1 default. parameter \\(\\tau_j\\) specifies learning rate operator switches related stimulus \\(j\\).","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"the-mathematics-behind-td","dir":"Articles","previous_headings":"","what":"The mathematics behind TD","title":"TD","text":"temporal difference (TD) model (Sutton & Barto, 1990) extension ideas underlying RW model (Rescorla & Wagner, 1972). notably TD model abandons construct “trial”, favoring instead time-based formulations. Also notable introduction eligibility traces, allow model bridge temporal gaps deal credit assigment problem. Implementation note: calmr version 0.6.2, stimulus representation TD based complete serial compounds (.e., time-specific stimulus elements entirely discriminable ), eligibility traces replacing type. General Note: several descriptions TD model , however, ones found opaque comes implementation. Hence, following description model focus implementational details.","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"maintaining-stimulus-representations","dir":"Articles","previous_headings":"","what":"1 - Maintaining stimulus representations","title":"TD","text":"TD maintains stimulus traces eligibility traces. elegibility stimulus \\(\\) time \\(t\\), \\(e_i^t\\), given : \\[ \\tag{Eq. 1} e_i^t = e_i^{t-1} \\sigma \\gamma + x_i^t \\] \\(\\sigma\\) \\(\\gamma\\) decay discount parameters, respectively, \\(x_i^t\\) activation stimulus \\(\\) time \\(t\\) (1 0 present absent stimuli, respectively). Internally, \\(e_i\\) represented vector length \\(d\\), \\(d\\) number stimulus compounds (general sense word compound, terms complete serial compounds, CSC). example, 2s stimulus model time resolution 0.5s \\(d = 4\\), second entry vector represents eligibility compound active stimulus present 1s. Similarly, \\(x_i^t\\) entails specific compound stimulus \\(\\) time \\(t\\), general activation \\(\\) time. example, suppose two, 2s stimuli, \\(\\) \\(B\\) presented overlap 1s, \\(\\)’s onset occurring first. Can guess stimulus compounds active \\(t = 2\\) time resolution 0.5s?1","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"generating-expectations","dir":"Articles","previous_headings":"","what":"2 - Generating expectations","title":"TD","text":"TD model generates stimulus expectations2 based presented stimuli, strength eligibility traces. expectation stimulus \\(j\\) time \\(t\\), \\(V_j^t\\), given : \\[ \\tag{Eq. 2} V_j^t = w_j^{t'} x^t = \\sum_i^K w_{,j}^t x_i^t \\] \\(w_j^t\\) matrix stimulus weights time \\(t\\) pointing towards \\(j\\), \\('\\) denotes transposition, \\(w_{,j}\\) denotes entry square matrix denoting association \\(\\) \\(j\\). eligibility traces , entries matrix weights specific stimulus compounds. Internally, \\(w_j^t\\) constructed trial--trial, step--step basis, depending stimulus compounds active time.","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"learning-associations","dir":"Articles","previous_headings":"","what":"3 - Learning associations","title":"TD","text":"Owing name, TD model updates associations based temporally discounted prediction upcoming stimuli. temporal difference error term given : \\[ \\tag{Eq. 3} \\delta_j^t = \\lambda_j^t + \\gamma V_j^t - V_j^{t-1} \\] \\(\\lambda_j\\) value stimulus \\(j\\) time \\(t\\), also determines assymptote stimulus weights towards \\(j\\). temporal difference error term used update \\(w\\) via: \\[ \\tag{Eq. 4} w_{,j}^t = w_{,j}^t + \\alpha_i \\beta(x_j^t) \\delta_j^t e_i^t \\] \\(\\alpha_i\\) learning rate parameter stimulus \\(\\), \\(\\beta(x_j)\\) function returns one two learning rate parameters (\\(\\beta_{}\\) \\(\\beta_{}\\)) depending whether \\(j\\) presented time \\(t\\).","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"generating-responses","dir":"Articles","previous_headings":"","what":"4 - Generating responses","title":"TD","text":"many associative learning models, transformation stimulus expectations responding unspecified/left hands user. TD model return response vector, suffices assume responding identity function expected stimulus values, follows: \\[ \\tag{Eq. 5} r_j^t = V_j^t \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/using_time_models.html","id":"time-models-in-calmr","dir":"Articles","previous_headings":"","what":"Time models in calmr","title":"using_time_models","text":"Version 0.5 calmr introduced first time-based model, ANCCR (Jeong et al., 2022), , wrote several additional tools future time-based models.","code":""},{"path":"https://victornavarro.org/calmr/articles/using_time_models.html","id":"changes-to-trial-based-models","dir":"Articles","previous_headings":"Time models in calmr","what":"Changes to trial-based models","title":"using_time_models","text":"biggest change calmr version 0.5 use “>” character effect trial-based models, rather, lack thereof. , “>” character used specify single split within trial. example, “>(US)” encode typical situation stimulus followed US. used mimic traditional situation expect organism start (conditionally) responding US delivered. , trial-based models two steps within trial: expectation step first half trial retrieved (responded ) absent stimuli, learning step, stimuli trial associated . first pass (start throwing extinction trials, better yet, probe trials “#” character test associations).","code":""},{"path":"https://victornavarro.org/calmr/articles/using_time_models.html","id":"specifying-a-design-for-time-based-models","dir":"Articles","previous_headings":"Time models in calmr","what":"Specifying a design for time-based models","title":"using_time_models","text":"designs time-based models nearly identical trial-based models. However, clever use “>” character enrich . Let’s specify serial feature discrimination experiment: can manually specify timing experiment calling get_timings() function. Manipulating list returned function result manipulation timing experimental events. now let’s get parameters ANCCR model. Let’s make model’s experience look first 20 entries. can see , several rows per trial, specifying different stimulus. Time-based models like ANCCR run time log make ample use temporal difference events. Let’s run model see plots. ’s ! Easy, right?","code":"library(calmr) #> #> Attaching package: 'calmr' #> The following object is masked from 'package:base': #> #> parse fpfn <- data.frame( group = c(\"FP\", \"FN\"), phase1 = c(\"100F>T>(US)/100T\", \"100F>T/100T>(US)\"), r1 = c(TRUE, TRUE) ) parse_design(fpfn) #> CalmrDesign built from data.frame: #> group phase1 r1 #> 1 FP 100F>T>(US)/100T TRUE #> 2 FN 100F>T/100T>(US) TRUE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 FP phase1 F>T>(US) 100 FALSE F;T;US #> 2 FP phase1 T 100 FALSE T #> 3 FN phase1 F>T 100 FALSE F;T #> 4 FN phase1 T>(US) 100 FALSE T;US ts <- get_timings(fpfn, model = \"ANCCR\") ts #> $use_exponential #> [1] TRUE #> #> $trial_ts #> trial post_trial_delay mean_ITI max_ITI #> 1 F>T>(US) 1 30 90 #> 2 T 1 30 90 #> 3 F>T 1 30 90 #> 4 T>(US) 1 30 90 #> #> $transition_ts #> trial transition transition_delay #> 1 F>T>(US) F>T 1 #> 2 F>T>(US) T>(US) 1 #> 3 F>T F>T 1 #> 4 T>(US) T>(US) 1 pars <- get_parameters(fpfn, model = \"ANCCR\") # increase learning rates pars$alpha_reward <- 0.8 pars$alpha <- 0.08 # increase sampling interval to speed up the model pars$sampling_interval <- 5 pars #> $reward_magnitude #> F T US #> 1 1 1 #> #> $betas #> F T US #> 1 1 1 #> #> $cost #> [1] 0 #> #> $temperature #> [1] 1 #> #> $threshold #> [1] 0.6 #> #> $k #> [1] 1 #> #> $w #> [1] 0.5 #> #> $minimum_rate #> [1] 0.001 #> #> $sampling_interval #> [1] 5 #> #> $use_exact_mean #> [1] 0 #> #> $t_ratio #> [1] 1.2 #> #> $t_constant #> [1] NA #> #> $alpha #> [1] 0.08 #> #> $alpha_reward #> [1] 0.8 #> #> $use_timed_alpha #> [1] 0 #> #> $alpha_exponent #> [1] 1 #> #> $alpha_init #> [1] 1 #> #> $alpha_min #> [1] 0 #> #> $add_beta #> [1] 0 #> #> $jitter #> [1] 1 experiment <- make_experiment(fpfn, parameters = pars, timings = ts, model = \"ANCCR\" ) head(experiences(experiment)[[1]], 20) #> model group phase tp tn is_test block_size trial stimulus time reward_mag #> 1 ANCCR FP phase1 1 F>T>(US) FALSE 2 1 F 54.04962 1 #> 2 ANCCR FP phase1 1 F>T>(US) FALSE 2 1 T 55.04962 1 #> 3 ANCCR FP phase1 1 F>T>(US) FALSE 2 1 US 56.04962 1 #> 4 ANCCR FP phase1 2 T FALSE 2 2 T 60.01176 1 #> 5 ANCCR FP phase1 1 F>T>(US) FALSE 2 3 F 90.91516 1 #> 6 ANCCR FP phase1 1 F>T>(US) FALSE 2 3 T 91.91516 1 #> 7 ANCCR FP phase1 1 F>T>(US) FALSE 2 3 US 92.91516 1 #> 8 ANCCR FP phase1 2 T FALSE 2 4 T 161.25401 1 #> 9 ANCCR FP phase1 1 F>T>(US) FALSE 2 5 F 198.87818 1 #> 10 ANCCR FP phase1 1 F>T>(US) FALSE 2 5 T 199.87818 1 #> 11 ANCCR FP phase1 1 F>T>(US) FALSE 2 5 US 200.87818 1 #> 12 ANCCR FP phase1 2 T FALSE 2 6 T 217.63850 1 #> 13 ANCCR FP phase1 2 T FALSE 2 7 T 231.61138 1 #> 14 ANCCR FP phase1 1 F>T>(US) FALSE 2 8 F 240.85012 1 #> 15 ANCCR FP phase1 1 F>T>(US) FALSE 2 8 T 241.85012 1 #> 16 ANCCR FP phase1 1 F>T>(US) FALSE 2 8 US 242.85012 1 #> 17 ANCCR FP phase1 1 F>T>(US) FALSE 2 9 F 261.89037 1 #> 18 ANCCR FP phase1 1 F>T>(US) FALSE 2 9 T 262.89037 1 #> 19 ANCCR FP phase1 1 F>T>(US) FALSE 2 9 US 263.89037 1 #> 20 ANCCR FP phase1 2 T FALSE 2 10 T 318.91125 1 experiment <- run_experiment(experiment) # Action values patch_plots(plot(experiment, type = \"action_values\")) # ANCCR patch_plots(plot(experiment, type = \"anccrs\")) # Dopamine transients patch_plots(plot(experiment, type = \"dopamines\"))"},{"path":[]},{"path":"https://victornavarro.org/calmr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Victor Navarro. Author, maintainer, copyright holder.","code":""},{"path":"https://victornavarro.org/calmr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Navarro V (2024). calmr: Canonical Associative Learning Models Representations. https://github.com/victor-navarro/calmr, https://victornavarro.org/calmr/.","code":"@Manual{, title = {calmr: Canonical Associative Learning Models and their Representations}, author = {Victor Navarro}, year = {2024}, note = {https://github.com/victor-navarro/calmr, https://victornavarro.org/calmr/}, }"},{"path":"https://victornavarro.org/calmr/index.html","id":"calmr","dir":"","previous_headings":"","what":"Canonical Associative Learning Models and their Representations","title":"Canonical Associative Learning Models and their Representations","text":"Canonical Associative Learning Models Representations","code":""},{"path":"https://victornavarro.org/calmr/index.html","id":"installing-the-latest-stable-version","dir":"","previous_headings":"","what":"Installing the latest stable version","title":"Canonical Associative Learning Models and their Representations","text":"may install latest stable version CRAN:","code":"install.packages(\"calmr\")"},{"path":"https://victornavarro.org/calmr/index.html","id":"installing-the-latest-version","dir":"","previous_headings":"","what":"Installing the latest version","title":"Canonical Associative Learning Models and their Representations","text":"feeling daring, can install latest version package. need devtools install package GitHub. managed build vignettes, ’s vignette showing basics package. (Worry , package’s website also ). want simulations using companion app, must install calmr.app package launch app.","code":"install.packages(\"devtools\") devtools::install_github(\"victor-navarro/calmr\") vignette(\"calmr_basics\", package = \"calmr\") devtools::install_github(\"victor-navarro/calmr.app\") calmr.app::launch_app()"},{"path":"https://victornavarro.org/calmr/index.html","id":"try-the-online-shiny-app","dir":"","previous_headings":"","what":"Try the online Shiny app","title":"Canonical Associative Learning Models and their Representations","text":"want check app without committing install, can check (wary: server might run free monthly quota). https://victor-navarro.shinyapps.io/calmr_app/","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":null,"dir":"Reference","previous_headings":"","what":"AIC of CalmrFit — AIC,CalmrFit-method","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"Returns Akaike Information Criterion model fit via calmr::fit_model","code":""},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"","code":"# S4 method for CalmrFit AIC(object, ..., k = 2)"},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"object object class CalmrFit-class. ... Unused k Numeric. Penalty term (default = 2)","code":""},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"numeric","code":""},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"AIC defined 2*k - 2*-NLL, k penalty term NLL negative log likelihood model.","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the ANCCR model — ANCCR","title":"Train the ANCCR model — ANCCR","text":"Train ANCCR model","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the ANCCR model — ANCCR","text":"","code":"ANCCR(parameters, experience, mapping, debug = FALSE, debug_t = -1, ...)"},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the ANCCR model — ANCCR","text":"parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment debug Logical specifying whether print debug information. debug_t Whether invoke browser end timestep equal debug_t. ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the ANCCR model — ANCCR","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Train the ANCCR model — ANCCR","text":"model highly experimental state. Use caution.","code":""},{"path":"https://victornavarro.org/calmr/reference/app.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the calm shiny application — app","title":"Run the calm shiny application — app","text":"Run calm shiny application","code":""},{"path":"https://victornavarro.org/calmr/reference/app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the calm shiny application — app","text":"","code":"app(browser = TRUE, install_pkg = FALSE)"},{"path":"https://victornavarro.org/calmr/reference/app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the calm shiny application — app","text":"browser TRUE, app launched browser. calm.app package github. Defaults FALSE.","code":""},{"path":"https://victornavarro.org/calmr/reference/app.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Run the calm shiny application — app","text":"shiny app distributed separately package.","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":null,"dir":"Reference","previous_headings":"","what":"BIC of CalmrFit — BIC,CalmrFit-method","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"Returns Bayesian Information Criterion model fit via calmr::fit_model","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"","code":"# S4 method for CalmrFit BIC(object, ...)"},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"object object class CalmrFit-class. ... Unused","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"numeric","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"AIC defined k*log(n) - 2*-NLL, k number parameters model n number observations","code":""},{"path":"https://victornavarro.org/calmr/reference/build_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Build and return a model — build_model","title":"Build and return a model — build_model","text":"Build return model","code":""},{"path":"https://victornavarro.org/calmr/reference/build_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build and return a model — build_model","text":"","code":"build_model(model_name = NULL, env = parent.frame())"},{"path":"https://victornavarro.org/calmr/reference/build_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build and return a model — build_model","text":"model_name string specific model. Currently supports one c(\"HDI2020\", \"HD2022\").","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm designs — CalmDesign-class","title":"S4 class for Calm designs — CalmDesign-class","text":"S4 class Calm designs","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm designs — CalmDesign-class","text":"design: list containing design information. mapping: list containing object mapping. raw_design: original data.frame. augmented: Whether object augmented.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment CalmDesign — augment,CalmDesign-method","title":"Augment CalmDesign — augment,CalmDesign-method","text":"Methods mapping, trials, extractor functions.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment CalmDesign — augment,CalmDesign-method","text":"","code":"# S4 method for CalmDesign augment(object, model, ...) .anccrize_design(object) # S4 method for CalmDesign show(object) mapping(object) # S4 method for CalmDesign mapping(object) trials(object) # S4 method for CalmDesign trials(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment CalmDesign — augment,CalmDesign-method","text":"object CalmDesign, returned parse_design model modelname string. One supported_models() ... Additional parameters depending model.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmExperiment methods — show,CalmExperiment-method","title":"CalmExperiment methods — show,CalmExperiment-method","text":"Creates plots (plot) aggregated results CalmExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmExperiment methods — show,CalmExperiment-method","text":"","code":"# S4 method for CalmExperiment show(object) # S4 method for CalmExperiment design(x) # S4 method for CalmExperiment trials(object) parameters(x) <- value # S4 method for CalmExperiment parameters(x) # S4 method for CalmExperiment parameters(x) <- value # S4 method for CalmExperiment experiences(x) # S4 method for CalmExperiment results(object) # S4 method for CalmExperiment raw_results(object) # S4 method for CalmExperiment parsed_results(object) # S4 method for CalmExperiment length(x) parse(object) # S4 method for CalmExperiment parse(object) # S4 method for CalmExperiment aggregate(x, ...) # S4 method for CalmExperiment plot(x, type = NULL, ...) graph(x, ...) # S4 method for CalmExperiment graph(x, ...)"},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmExperiment methods — show,CalmExperiment-method","text":"object CalmExperiment object x CalmExperiment value list parameter lists. ... Additional parameters passed graph_calm_model type character vector specifying types plots create. See ??supported_plots. Defaults NULL.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmExperiment methods — show,CalmExperiment-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"CalmExperiment methods — show,CalmExperiment-method","text":"type = NULL, supported plots returned.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calm experiments. — CalmExperiment-class","title":"S4 class for calm experiments. — CalmExperiment-class","text":"S4 class calm experiments.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calm experiments. — CalmExperiment-class","text":"design: CalmDesign object. model: string specifying model used. groups: string specifying groups design. parameters: list parameters used, per group. experiences: list experiences model. results: CalmExperimentResult object. .model: Internal. model associated iteration. .group: Internal. group associated iteration. .iter: Internal. iteration number.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmFit-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm Fit — CalmFit-class","title":"S4 class for Calm Fit — CalmFit-class","text":"S4 class Calm Fit","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmFit-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm Fit — CalmFit-class","text":"nloglik: Numeric. Negative log likelihood fit best_pars: Numeric. Best fitting parameters model_pars: Numeric. Parameters used model function link_pars: Numeric. Parameters used link function data: Numeric. Data used fit model_function: Function. Model function link_function: Function. Link function ll_function: Function. Objective function (usually nloglikelihood) optimizer_options: List. Options used optimizer extra_pars: List. Extra parameters passed fit call (...)","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmFit Methods — show,CalmFit-method","title":"CalmFit Methods — show,CalmFit-method","text":"CalmFit Methods CalmFit methods","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmFit Methods — show,CalmFit-method","text":"","code":"# S4 method for CalmFit show(object) # S4 method for CalmFit predict(object, type = \"response\", ...) NLL(object) # S4 method for CalmFit NLL(object) # S4 method for CalmFit AIC(object, k = 2) # S4 method for CalmFit BIC(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmFit Methods — show,CalmFit-method","text":"object CalmFit type string specifying type prediction generate ... Additional arguments k Penalty term","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"CalmFit Methods — show,CalmFit-method","text":"AIC defined 2*k - 2*-NLL, k penalty term NLL negative log likelihood model. BIC defined k*log(n) - 2*-NLL, k number parameters model n number observations","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmModel-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm Models — CalmModel-class","title":"S4 class for Calm Models — CalmModel-class","text":"S4 class Calm Models","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmModel-class.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"S4 class for Calm Models — CalmModel-class","text":"Currently unused.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmModel-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm Models — CalmModel-class","text":"model model name string model_fn model function state list model internal state parameters list model model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrComparison-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Comparisons — CalmrComparison-class","title":"S4 class for Calmr Comparisons — CalmrComparison-class","text":"S4 class Calmr Comparisons","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrComparison-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Comparisons — CalmrComparison-class","text":"results: Data.frame. unparsed model results models: Character vector. models compared layers: Character vector. layers compared model_layer_names: Character vector. Combination two ","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr designs — CalmrDesign-class","title":"S4 class for calmr designs — CalmrDesign-class","text":"S4 class calmr designs","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr designs — CalmrDesign-class","text":"design: list containing design information. mapping: list containing object mapping. raw_design: original data.frame.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrDesign methods — CalmrDesign-methods","title":"CalmrDesign methods — CalmrDesign-methods","text":"S4 methods CalmrDesign class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrDesign methods — CalmrDesign-methods","text":"","code":"# S4 method for CalmrDesign show(object) # S4 method for CalmrDesign mapping(object) # S4 method for CalmrDesign trials(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrDesign methods — CalmrDesign-methods","text":"object CalmrDesign object","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrDesign methods — CalmrDesign-methods","text":"show() returns NULL (invisibly). mapping() returns list trial mappings. trials() returns NULL (invisibly).","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr designs — CalmrDesign","title":"S4 class for Calmr designs — CalmrDesign","text":"Inherits tbl class","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr designs — CalmrDesign","text":"design: tbl containing object. mapping: list containing object mapping. raw_design: original data.frame. augmented: Whether object augmented.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"Methods for CalmResult — show,CalmResult-method","title":"Methods for CalmResult — show,CalmResult-method","text":"Methods CalmResult","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Methods for CalmResult — show,CalmResult-method","text":"","code":"# S4 method for CalmResult show(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmResult-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Methods for CalmResult — show,CalmResult-method","text":"object CalmResult object","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm Results — CalmResult-class","title":"S4 class for Calm Results — CalmResult-class","text":"S4 class Calm Results","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm Results — CalmResult-class","text":"aggregated_results list fully aggregated results. parsed_results list parsed results, .e., fn(model_output). raw_results list model outputs.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Experiments — CalmrExperiment-class","title":"S4 class for Calmr Experiments — CalmrExperiment-class","text":"S4 class Calmr Experiments","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Experiments — CalmrExperiment-class","text":"results: Data.frame. unparsed model results parsed_results: List. parsed aggregated model results is_parsed: Logical. Whether model results parsed","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrExperiment methods — CalmrExperiment-methods","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"S4 methods CalmrExperiment class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"","code":"# S4 method for CalmrExperiment show(object) # S4 method for CalmrExperiment design(x) # S4 method for CalmrExperiment trials(object) # S4 method for CalmrExperiment parameters(x) # S4 method for CalmrExperiment parameters(x) <- value # S4 method for CalmrExperiment experiences(x) # S4 method for CalmrExperiment experiences(x) <- value # S4 method for CalmrExperiment results(object) # S4 method for CalmrExperiment raw_results(object) # S4 method for CalmrExperiment parsed_results(object) # S4 method for CalmrExperiment length(x) # S4 method for CalmrExperiment parse(object, outputs = NULL) # S4 method for CalmrExperiment aggregate(x, outputs = NULL) # S4 method for CalmrExperiment plot(x, type = NULL, ...) # S4 method for CalmrExperiment graph(x, ...) # S4 method for CalmrExperiment timings(x) # S4 method for CalmrExperiment timings(x) <- value"},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"object, x CalmrExperiment object. value list parameters (list parameter lists). outputs character vector specifying model outputs parse. type character vector specifying type(s) plots create. Defaults NULL. See supported_plots. ... Extra arguments passed calmr_model_graph() calmr_model_plot().","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"show() returns NULL (invisibly). design() returns CalmrDesign contained object. trials() returns NULL (invisibly). parameters() returns list parameters contained object. parameters()<- returns object updating parameters. experiences() returns list data.frame objects containing model training routines. experiences()<- returns object updating experiences. results() returns data.table objects aggregated results. raw_results() returns list raw model results. parsed_results() returns list data.table objects parsed results. length() returns integer specifying total length experiment (groups iterations). parse() returns object parsing raw results. aggregate() returns object aggregating parsed results. plot() returns list 'ggplot' plot objects. graph() returns list 'ggplot' plot objects. timings() returns list timings contained object. timings()<- returns object updating timings.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr experiments. — CalmrExperiment-class","title":"S4 class for calmr experiments. — CalmrExperiment-class","text":"S4 class calmr experiments.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr experiments. — CalmrExperiment-class","text":"design: CalmrDesign object. model: string specifying model used. groups: string specifying groups design. parameters: list parameters used, per group. timings: list timings used design. experiences: list experiences model. results: CalmrExperimentResult object. .model: Internal. model associated iteration. .group: Internal. group associated iteration. .iter: Internal. iteration number.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrExperimentResult.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr experiment results — CalmrExperimentResult-class","title":"S4 class for calmr experiment results — CalmrExperimentResult-class","text":"S4 class calmr experiment results","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperimentResult.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr experiment results — CalmrExperimentResult-class","text":"aggregated_results list data.table objects aggregated results. parsed_results list containing data.table objects parsed results. raw_results list raw model outputs.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr Fit — CalmrFit-class","title":"S4 class for calmr Fit — CalmrFit-class","text":"S4 class calmr Fit","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr Fit — CalmrFit-class","text":"nloglik: Numeric. Negative log likelihood fit best_pars: Numeric. Best fitting parameters model_pars: Numeric. Parameters used model function link_pars: Numeric. Parameters used link function data: Numeric. Data used fit model_function: Function. Model function link_function: Function. Link function ll_function: Function. Objective function (usually nloglikelihood) optimizer_options: List. Options used optimizer extra_pars: List. Extra parameters passed fit call (...)","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrFit methods — CalmrFit-methods","title":"CalmrFit methods — CalmrFit-methods","text":"S4 methods CalmrFit class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrFit methods — CalmrFit-methods","text":"","code":"# S4 method for CalmrFit show(object) # S4 method for CalmrFit predict(object, type = \"response\", ...) # S4 method for CalmrFit NLL(object) # S4 method for CalmrFit AIC(object, k = 2) # S4 method for CalmrFit BIC(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrFit methods — CalmrFit-methods","text":"object CalmrFit object. type string specifying type prediction generate. ... Extra named arguments. k Penalty term AIC method.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrFit methods — CalmrFit-methods","text":"show() returns NULL (invisibly). predict() returns numeric vector. NLL() returns negative log likelihood model. AIC() returns Akaike Information Criterion (AIC) model. BIC() returns Bayesian Information Criterion (BIC) model.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"CalmrFit methods — CalmrFit-methods","text":"type = \"response\", predict() function passed model responses link function used fit model. AIC defined 2*k - 2*-NLL, k penalty term NLL negative log likelihood model. BIC defined p*log(n) - 2*-NLL, p number parameters model n number observations","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Fit — CalmrFit","title":"S4 class for Calmr Fit — CalmrFit","text":"S4 class Calmr Fit","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Fit — CalmrFit","text":"nloglik: Numeric. Negative log likelihood fit best_pars: Numeric. Best fitting parameters model_pars: Numeric. Parameters used model function link_pars: Numeric. Parameters used link function data: Numeric. Data used fit model_function: Function. Model function link_function: Function. Link function ll_function: Function. Objective function (usually nloglikelihood) optimizer_options: List. Options used optimizer extra_pars: List. Extra parameters passed fit call (...)","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrModel-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Models — CalmrModel-class","title":"S4 class for Calmr Models — CalmrModel-class","text":"S4 class Calmr Models","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrModel-class.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"S4 class for Calmr Models — CalmrModel-class","text":"Currently unused.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrModel-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Models — CalmrModel-class","text":"model model name string model_fn model function state list model internal state parameters list model model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrResult methods — CalmrResult-methods","title":"CalmrResult methods — CalmrResult-methods","text":"S4 methods CalmrResults class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrResult methods — CalmrResult-methods","text":"","code":"# S4 method for CalmrResult show(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrResult methods — CalmrResult-methods","text":"object CalmrResults object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrResult methods — CalmrResult-methods","text":"show() returns NULL (invisibly).","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr results — CalmrResult-class","title":"S4 class for calmr results — CalmrResult-class","text":"S4 class calmr results","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr results — CalmrResult-class","text":"aggregated_results list data.table objects aggregated results. parsed_results list containing data.table objects parsed results. raw_results list raw model outputs.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr representational similarity analysis — CalmrRSA-class","title":"S4 class for calmr representational similarity analysis — CalmrRSA-class","text":"S4 class calmr representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr representational similarity analysis — CalmrRSA-class","text":"corr_mat: array containing correlation matrix distances: list pairwise distance matrices args: list arguments used create object. test_data: list permutation data, populated testing object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrRSA methods — CalmrRSA-methods","title":"CalmrRSA methods — CalmrRSA-methods","text":"S4 methods CalmrRSA class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrRSA methods — CalmrRSA-methods","text":"","code":"# S4 method for CalmrRSA show(object) # S4 method for CalmrRSA test(object, n_samples = 1000, p = 0.95) # S4 method for CalmrRSA plot(x)"},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrRSA methods — CalmrRSA-methods","text":"object, x CalmrRSA object. n_samples number samples permutation test (default = 1e3) p critical threshold level permutation test (default = 0.95)","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrRSA methods — CalmrRSA-methods","text":"show() returns NULL (invisibly). test() returns CalmrRSA object permutation test data. plot() returns list 'ggplot' plot objects.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr representational similarity analysis — CalmrRSA","title":"S4 class for Calmr representational similarity analysis — CalmrRSA","text":"S4 class Calmr representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr representational similarity analysis — CalmrRSA","text":"corr_mat: Array. Correlation matrix distances: List. Pairwise distance matrices arguments: List. Arguments used create object. test_data: List. Test data, populated testing object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSATest-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr RSA Test — CalmrRSATest-class","title":"S4 class for Calmr RSA Test — CalmrRSATest-class","text":"S4 class Calmr RSA Test","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSATest-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr RSA Test — CalmrRSATest-class","text":"RSA: Object class CalmrRSA sig_mat: Array. Correlation significance matrix lower_crit: Array. Lower bound significance upper_crit: Array. Upper bound significance n_samples: Numeric. Number bootstrap samples p: Numeric. Alpha level significance","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm representational similarity analysis — CalmRSA-class","title":"S4 class for Calm representational similarity analysis — CalmRSA-class","text":"S4 class Calm representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm representational similarity analysis — CalmRSA-class","text":"corr_mat: Array. Correlation matrix distances: List. Pairwise distance matrices args: List. Arguments used create object. test_data: List. Test data, populated testing object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmRSA Methods — show,CalmRSA-method","title":"CalmRSA Methods — show,CalmRSA-method","text":"CalmRSA Methods Test CalmRSA object via permutation test","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmRSA Methods — show,CalmRSA-method","text":"","code":"# S4 method for CalmRSA show(object) test(object, n_samples = 1000, p = 0.95) # S4 method for CalmRSA test(object, n_samples = 1000, p = 0.95) # S4 method for CalmRSA plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmRSA Methods — show,CalmRSA-method","text":"object CalmRSA object n_samples number samples permutation test (default = 1e3) p critical threshold level permutation test (default = 0.95) x CalmRSA object plot y Unused. ... Extra parameters passed plot call","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmRSA Methods — show,CalmRSA-method","text":"CalmRSA object test results","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_app.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the calmr GUI — calmr_app","title":"Run the calmr GUI — calmr_app","text":"Starts shiny application","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the calmr GUI — calmr_app","text":"","code":"calmr_app(browser = getOption(\"shiny.launch.browser\", interactive()))"},{"path":"https://victornavarro.org/calmr/reference/calmr_app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the calmr GUI — calmr_app","text":"browser TRUE, app launched browser.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a graph with calmr data — calmr_model_graph","title":"Create a graph with calmr data — calmr_model_graph","text":"patch_graphs() patches graphs 'patchwork'","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a graph with calmr data — calmr_model_graph","text":"","code":"calmr_model_graph( x, loops = TRUE, limits = max(abs(x$value)) * c(-1, 1), colour_key = FALSE, t = max(x$trial), options = get_graph_opts() ) patch_graphs(graphs, selection = names(graphs)) get_graph_opts(graph_size = \"small\")"},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a graph with calmr data — calmr_model_graph","text":"x data.frame-like data use plot. Contains column named value. loops Logical. Whether draw arrows back forth limits Numerical. Limits color scale. Defaults max(abs(x$value))*c(-1,1). colour_key Logical. Whether show color key t trial weights obtained (defaults maximum trial data). options list graph options, returned get_graph_opts(). graphs list (named) graphs, returned graph() calmr_model_graph() selection character numeric vector determining plots patch. graph_size string (either \"small\" \"large\"). return default values small large graphs trial Numerical. trial graph.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a graph with calmr data — calmr_model_graph","text":"'ggplot' object patch_graphs() returns 'patchwork' object list graph options, passed ggnetwork::geom_nodes().","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a graph with calmr data — calmr_model_graph","text":"probably getting graphs via graph method CalmrExperiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a plot with calmr data — calmr_model_plot","title":"Create a plot with calmr data — calmr_model_plot","text":"plot_common_scale() rescales list plots common scale. get_plot_opts() returns generic plotting options. patch_plots() patches plots using patchwork package.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a plot with calmr data — calmr_model_plot","text":"","code":"calmr_model_plot(data, type, model, ...) plot_common_scale(plots) get_plot_opts(common_scale = TRUE) patch_plots(plots, selection = names(plots), plot_options = get_plot_opts())"},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a plot with calmr data — calmr_model_plot","text":"data data.table containing aggregated data CalmrExperiment type character specifying type plot. model character specifying model. ... parameters passed plotting functions. plots list (named) plots, returned plot() calmr_model_plot() common_scale Logical specifying whether plots common scale. selection character numeric vector determining plots patch plot_options list plot options returned get_plot_opts()","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a plot with calmr data — calmr_model_plot","text":"'ggplot' object. plot_common_scale() returns list plots. get_plot_opts() returns list. patch_plots() returns patchwork object.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a plot with calmr data — calmr_model_plot","text":"probably getting plots via plot() method CalmrExperiment.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":null,"dir":"Reference","previous_headings":"","what":"Set verbosity options for calmr — calmr_verbosity","title":"Set verbosity options for calmr — calmr_verbosity","text":"Whether show verbosity messages progress bars","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set verbosity options for calmr — calmr_verbosity","text":"","code":"calmr_verbosity(verbose)"},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set verbosity options for calmr — calmr_verbosity","text":"verbose logical","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set verbosity options for calmr — calmr_verbosity","text":"list progressr handlers (invisibly).","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set verbosity options for calmr — calmr_verbosity","text":"Progress bars handled progressr package. just convenience function. See package 'progressr' details.","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a plot with calm data — calm_model_plot","title":"Create a plot with calm data — calm_model_plot","text":"Create plot calm data","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a plot with calm data — calm_model_plot","text":"","code":"calm_model_plot(dat, type)"},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a plot with calm data — calm_model_plot","text":"dat data.frame-like data use plot type character specifying type plot","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a plot with calm data — calm_model_plot","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a plot with calm data — calm_model_plot","text":"probably getting plots via plot method CalmExperiments.","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":null,"dir":"Reference","previous_headings":"","what":"Set verbosity options for calm — calm_verbosity","title":"Set verbosity options for calm — calm_verbosity","text":"Whether show verbosity messages progress bars","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set verbosity options for calm — calm_verbosity","text":"","code":"calm_verbosity(verbose)"},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set verbosity options for calm — calm_verbosity","text":"verbose logical","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set verbosity options for calm — calm_verbosity","text":"Progress bars handled progressr package.","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":null,"dir":"Reference","previous_headings":"","what":"Run models given a set of parameters — compare_models","title":"Run models given a set of parameters — compare_models","text":"Run models given set parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run models given a set of parameters — compare_models","text":"","code":"compare_models(x, models = NULL, ...)"},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run models given a set of parameters — compare_models","text":"x list CalmrExperiment objects design data.frame. models character vector length m, specifying models run. Ignored x list CalmrExperiment objects. ... Arguments passed make_experiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run models given a set of parameters — compare_models","text":"list CalmrExperiment objects","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run models given a set of parameters — compare_models","text":"","code":"# By making experiment beforehand (recommended) df <- get_design(\"blocking\") models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") exps <- lapply(models, function(m) { make_experiment(df, parameters = get_parameters(df, model = m), model = m ) }) comp <- compare_models(exps) # By passing minimal arguments (not recommended; default parameters) comp <- compare_models(df, models = models)"},{"path":"https://victornavarro.org/calmr/reference/dot-calmr_assert.html","id":null,"dir":"Reference","previous_headings":"","what":"Go-to stops for calmr assertions — .calmr_assert","title":"Go-to stops for calmr assertions — .calmr_assert","text":"Go-stops calmr assertions","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-calmr_assert.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Go-to stops for calmr assertions — .calmr_assert","text":"","code":".calmr_assert(what, given, ...)"},{"path":"https://victornavarro.org/calmr/reference/dot-combV.html","id":null,"dir":"Reference","previous_headings":"","what":"Model support functions — .combV","title":"Model support functions — .combV","text":"assortment functions support models (mostly HeiDI)","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-combV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model support functions — .combV","text":"","code":".combV(V, pre_func, post_func, db_trial = NA)"},{"path":"https://victornavarro.org/calmr/reference/dot-parse.html","id":null,"dir":"Reference","previous_headings":"","what":"Model parsers — .parse","title":"Model parsers — .parse","text":"assorment functions help models","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-parse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model parsers — .parse","text":"","code":".parse(mod, type)"},{"path":"https://victornavarro.org/calmr/reference/dot-parse_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"An assorment of functions to help parse models — .parse_experiment","title":"An assorment of functions to help parse models — .parse_experiment","text":"assorment functions help parse models","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-parse_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assorment of functions to help parse models — .parse_experiment","text":"","code":".parse_experiment(experiment)"},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit model to data — fit_heidi","title":"Fit model to data — fit_heidi","text":"Obtain MLE estimates model, given data","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit model to data — fit_heidi","text":"","code":"fit_model(data, model_function, model_args, optimizer_options, ...)"},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit model to data — fit_heidi","text":"data numeric vector containing data fit model . model_function function runs model returns data.frame r-values, organized data. model_args arguments train model function. Usually returned make_model_args. optimizer_options list options optimizer, returned get_optimizer_opts. ... Extra parameters passed optimizer call","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit model to data — fit_heidi","text":"list nloglik: negative log-likelihood model best_pars: MLE parameters model_pars: model-specific MLE parameters link_pars: link-specific MLE parameters data: data used fit model model_function: model function supplied user link_function: link function used process ll_function: log-likelihood function used search process model_args: model function arguments supplied user optimizer_options: optimizer options supplied user extra_pars: extra parameters passed optimizer call via ...","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Fit model to data — fit_heidi","text":"See calmr_fits vignette examples","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"An assortment of functions to help fit models — get_optimizer_opts","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"assortment functions help fit models","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"","code":"get_optimizer_opts( model_pars, initial_pars = rep(NA, length(model_pars)), ll = rep(NA, length(model_pars)), ul = rep(NA, length(model_pars)), optimizer = NULL, family = NULL )"},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"model_pars character vector specifying name parameters fit. initial_pars numeric vector specifying initial parameter values #' evaluate model (required optim). Defaults 0 parameter. ll, ul numeric vector specifying lower upper limits parameters fit, respectively optimizer string specifying optimizer use. One c(\"optim\", \"ga\") family string specifying family function generate responses (calculate likelihood function ). One c(\"identity\", \"normal\", \"poisson\").","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"Whenever family function identity used, family-specific parameters always appended end relevant lists.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit model to data — fit_model","title":"Fit model to data — fit_model","text":"Obtain MLE estimates model, given data.","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit model to data — fit_model","text":"","code":"fit_model(data, model_function, optimizer_options, file = NULL, ...)"},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit model to data — fit_model","text":"data numeric vector containing data fit model . model_function function runs model returns data.frame value, organized data. optimizer_options list options optimizer, returned get_optimizer_opts. file path save model fit. arguments fit call found identical file, model just gets loaded. ... Extra parameters passed optimizer call.","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit model to data — fit_model","text":"CalmrFit object","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Fit model to data — fit_model","text":"See calmr_fits vignette examples","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit model to data — fit_model","text":"","code":"# Make some fake data df <- data.frame(g = \"g\", p1 = \"3A>(US)\", r1 = TRUE) pars <- get_parameters(df, model = \"RW1972\") pars$alphas[\"US\"] <- 0.9 exper <- make_experiment(df, parameters = pars, model = \"RW1972\") res <- run_experiment(exper, outputs = \"responses\") responses <- results(res)$responses$value # define model function model_fun <- function(p, ex) { np <- parameters(ex) np[[1]]$alphas[] <- p parameters(ex) <- np results(run_experiment(ex))$responses$value } # Get optimizer options optim_opts <- get_optimizer_opts( model_pars = names(pars$alphas), ll = rep(.05, 2), ul = rep(.95, 2), optimizer = \"optim\", family = \"identity\" ) optim_opts$initial_pars[] <- rep(.6, 2) fit_model(responses, model_fun, optim_opts, ex = exper, method = \"L-BFGS-B\", control = list(maxit = 1) ) #> Calmr model fit #> -------------- #> Parameters: #> A US #> 0.4386228 0.8962406 #> -------------- #> #> nLogLik: 11.029"},{"path":"https://victornavarro.org/calmr/reference/gen_ss_weights.html","id":null,"dir":"Reference","previous_headings":"","what":"Model support functions — gen_ss_weights","title":"Model support functions — gen_ss_weights","text":"assortment functions support models (mostly HeiDI)","code":""},{"path":"https://victornavarro.org/calmr/reference/gen_ss_weights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model support functions — gen_ss_weights","text":"","code":"gen_ss_weights(stims, default_val = 0)"},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":null,"dir":"Reference","previous_headings":"","what":"Get basic designs — get_design","title":"Get basic designs — get_design","text":"Get basic designs","code":""},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get basic designs — get_design","text":"","code":"get_design(design_name = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get basic designs — get_design","text":"design_name string specifying design name (default = NULL)","code":""},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get basic designs — get_design","text":"design_name NULL, data.frame containing design. Otherwise, list containing available designs.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get basic designs — get_design","text":"","code":"names(get_design()) #> [1] \"blocking\" \"relative_validity\" \"controlled_blocking\" get_design(\"blocking\") #> Group P1 R1 P2 R2 #> 1 Blocking 10N>(US) FALSE 10NL>(US)/10#L FALSE #> 2 Control FALSE 10NL>(US)/10#L FALSE"},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for an experiment — get_exp_opts","title":"Get options for an experiment — get_exp_opts","text":"Get options experiment","code":""},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for an experiment — get_exp_opts","text":"","code":"get_exp_opts(iterations = 1, miniblocks = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for an experiment — get_exp_opts","text":"iterations Numeric denoting number iterations run. Default = 1. miniblocks logical denoting whether create trial miniblocks possible. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for an experiment — get_exp_opts","text":"list default user-given options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get options for an experiment — get_exp_opts","text":"miniblocks option direct sampling function create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get options for an experiment — get_exp_opts","text":"","code":"get_exp_opts(iterations = 10) #> $iterations #> [1] 10 #> #> $miniblocks #> [1] TRUE #>"},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for calmr graph — get_graph_opts","title":"Get options for calmr graph — get_graph_opts","text":"Get options calmr graph","code":""},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for calmr graph — get_graph_opts","text":"","code":"get_graph_opts(graph_size = \"small\")"},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for calmr graph — get_graph_opts","text":"graph_size string (either \"small\" \"large\"). return default values small large graphs","code":""},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for calmr graph — get_graph_opts","text":"list graph options, passed ggnetwork::geom_nodes().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for calmr model — get_heidi_opts","title":"Get options for calmr model — get_heidi_opts","text":"Get options calmr model","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for calmr model — get_heidi_opts","text":"","code":"get_exp_opts(iterations = 1, miniblocks = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for calmr model — get_heidi_opts","text":"iterations integer denoting number iterations run. Default = 1. miniblocks logical denoting whether create trial miniblocks possible. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for calmr model — get_heidi_opts","text":"list default user-given options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get options for calmr model — get_heidi_opts","text":"miniblocks option direct sampling function (make_model_args) create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result lead miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get options for calmr model — get_heidi_opts","text":"","code":"get_exp_opts(iterations = 10) #> $iterations #> [1] 10 #> #> $miniblocks #> [1] TRUE #>"},{"path":"https://victornavarro.org/calmr/reference/get_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a model function — get_model","title":"Return a model function — get_model","text":"Given model string, returns model function can used elsewhere package.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a model function — get_model","text":"","code":"get_model(model_name)"},{"path":"https://victornavarro.org/calmr/reference/get_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a model function — get_model","text":"model_name string specifying model returned. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for a model — get_model_opts","title":"Get options for a model — get_model_opts","text":"Get options model","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for a model — get_model_opts","text":"","code":"get_exp_opts(iterations = 1, miniblocks = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for a model — get_model_opts","text":"iterations integer denoting number iterations run. Default = 1. miniblocks logical denoting whether create trial miniblocks possible. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for a model — get_model_opts","text":"list default user-given options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get options for a model — get_model_opts","text":"miniblocks option direct sampling function (make_model_args) create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get options for a model — get_model_opts","text":"","code":"get_exp_opts(iterations = 10) #> $iterations #> [1] 10 #> #> $miniblocks #> [1] TRUE #>"},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":null,"dir":"Reference","previous_headings":"","what":"Obtain model parameters — get_model_params","title":"Obtain model parameters — get_model_params","text":"Obtain model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Obtain model parameters — get_model_params","text":"","code":"get_model_params(design, model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Obtain model parameters — get_model_params","text":"design data.frame containing experimental design. model string specifying model. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Obtain model parameters — get_model_params","text":"data.frame model parameters, depending model.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get optimizer options — get_optimizer_opts","title":"Get optimizer options — get_optimizer_opts","text":"Get optimizer options","code":""},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get optimizer options — get_optimizer_opts","text":"","code":"get_optimizer_opts( model_pars, initial_pars = rep(NA, length(model_pars)), ll = rep(NA, length(model_pars)), ul = rep(NA, length(model_pars)), optimizer = NULL, family = NULL )"},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get optimizer options — get_optimizer_opts","text":"model_pars character vector specifying name parameters fit. initial_pars numeric vector specifying initial parameter values #' evaluate model (required optim). Defaults 0 parameter. ll, ul numeric vector specifying lower upper limits parameters fit, respectively optimizer string specifying optimizer use. One c(\"optim\", \"ga\") family string specifying family function generate responses (calculate likelihood function ). One c(\"identity\", \"normal\", \"poisson\").","code":""},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get optimizer options — get_optimizer_opts","text":"list optimizer options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get optimizer options — get_optimizer_opts","text":"Whenever family function identity used, family-specific parameters always appended end relevant lists.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":null,"dir":"Reference","previous_headings":"","what":"Get output from CalmrExperiment — get_output","title":"Get output from CalmrExperiment — get_output","text":"Returns tibble containing parsed outputs CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get output from CalmrExperiment — get_output","text":"","code":"get_output(object, type = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get output from CalmrExperiment — get_output","text":"object object class CalmrExperiment-class. type type output","code":""},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get output from CalmrExperiment — get_output","text":"data.frame model output","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Get model parameters — get_parameters","title":"Get model parameters — get_parameters","text":"Get model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get model parameters — get_parameters","text":"","code":"get_parameters(design, model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get model parameters — get_parameters","text":"design data.frame containing experimental design. model string specifying model. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get model parameters — get_parameters","text":"list model parameters depending model","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get model parameters — get_parameters","text":"","code":"block <- get_design(\"blocking\") get_parameters(block, model = \"SM2007\") #> $alphas #> L N US #> 0.4 0.4 0.4 #> #> $lambdas #> L N US #> 1 1 1 #> #> $omegas #> L N US #> 0.2 0.2 0.2 #> #> $rhos #> L N US #> 1 1 1 #> #> $gammas #> L N US #> 1 1 1 #> #> $taus #> L N US #> 0.2 0.2 0.2 #> #> $order #> [1] 1 #>"},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":null,"dir":"Reference","previous_headings":"","what":"Returns a data.frame with parameters for stimuli contained in design — get_params","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"Returns data.frame parameters stimuli contained design","code":""},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"","code":"get_model_params(design, default_par)"},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"design tibble experimental design, returned parse_design default_par float 0 1.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"data.frame columns stimulus alphas, stimulus name salience, respectively.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":null,"dir":"Reference","previous_headings":"","what":"Get timing design parameters — get_timings","title":"Get timing design parameters — get_timings","text":"Get timing design parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get timing design parameters — get_timings","text":"","code":"get_timings(design, model)"},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get timing design parameters — get_timings","text":"design data.frame containing experimental design. model One supported_timed_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get timing design parameters — get_timings","text":"list timing design parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get timing design parameters — get_timings","text":"","code":"block <- get_design(\"blocking\") get_timings(block, model = \"TD\") #> $use_exponential #> [1] TRUE #> #> $time_resolution #> [1] 0.5 #> #> $trial_ts #> trial post_trial_delay mean_ITI max_ITI #> 1 N>(US) 1 30 90 #> 2 NL>(US) 1 30 90 #> 3 #L 1 30 90 #> #> $period_ts #> trial period stimulus stimulus_duration #> 1 N>(US) N N 1 #> 2 N>(US) (US) US 1 #> 3 NL>(US) NL N 1 #> 4 NL>(US) NL L 1 #> 5 NL>(US) (US) US 1 #> 6 #L L L 1 #> #> $transition_ts #> trial transition transition_delay #> 1 N>(US) N>(US) 1 #> 2 NL>(US) NL>(US) 1 #>"},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Graph model associations — graph,CalmrExperiment-method","title":"Graph model associations — graph,CalmrExperiment-method","text":"Creates network graph model associations","code":""},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Graph model associations — graph,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment graph(x, ...)"},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Graph model associations — graph,CalmrExperiment-method","text":"x object class CalmrModel-class CalmrExperiment-class. ... Additional parameters passed graph_weights function.","code":""},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Graph model associations — graph,CalmrExperiment-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a graph with calmr data — calmr_model_graph","title":"Create a graph with calmr data — calmr_model_graph","text":"Create graph calmr data","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a graph with calmr data — calmr_model_graph","text":"","code":"calmr_model_graph( x, loops = TRUE, limits = max(abs(x$value)) * c(-1, 1), colour_key = FALSE, t = max(x$trial), options = get_graph_opts() )"},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a graph with calmr data — calmr_model_graph","text":"x data.frame-like data use plot. Contains column named value. loops Logical. Whether draw arrows back forth limits Numerical. Limits color scale. Defaults max(abs(x$value))*c(-1,1). colour_key Logical. Whether show color key t trial weights obtained (defaults maximum trial data). options list graph options, returned get_graph_opts(). trial Numerical. trial graph.","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a graph with calmr data — calmr_model_graph","text":"'ggplot' object","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a graph with calmr data — calmr_model_graph","text":"probably getting graphs via graph() method CalmrExperiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the HD2022 model — HD2022","title":"Train the HD2022 model — HD2022","text":"Train HD2022 model","code":""},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the HD2022 model — HD2022","text":"","code":"HD2022(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the HD2022 model — HD2022","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the HD2022 model — HD2022","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the HDI2020 model — HDI2020","title":"Train the HDI2020 model — HDI2020","text":"Train HDI2020 model","code":""},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the HDI2020 model — HDI2020","text":"","code":"HDI2020(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the HDI2020 model — HDI2020","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the HDI2020 model — HDI2020","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_app.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the calmr GUI — heidi_app","title":"Run the calmr GUI — heidi_app","text":"Starts shiny application","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the calmr GUI — heidi_app","text":"","code":"calmr_app(browser = getOption(\"shiny.launch.browser\", interactive()))"},{"path":"https://victornavarro.org/calmr/reference/heidi_app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the calmr GUI — heidi_app","text":"browser TRUE, app launched browser.","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"An assortment of functions to help calmr — heidi_helpers","title":"An assortment of functions to help calmr — heidi_helpers","text":"get_model_params generates data.frame stimulus salience parameters. gen_ss_weights generates named matrix model weights. model_vs, parse_acts, parse_rs, parse_as parse_experiment parse raw outputs train_pav_model tibbles. filter_calmr_results convenience function filter specific phase trial_type data.","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assortment of functions to help calmr — heidi_helpers","text":"","code":"get_model_params(design, default_par = 0.2) gen_ss_weights(stims, default_val = 0) model_vs(mod) parse_acts(mod) parse_rs(mod) parse_as(mod) parse_experiment(raw_results) filter_calmr_results(parsed_results, filters)"},{"path":"https://victornavarro.org/calmr/reference/heidi_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"An assortment of functions to help calmr — heidi_helpers","text":"design data.frame containing experimental design. default_par float 0 1. stims character vector stimuli default_val Default alpha value mod model list, returned train_pav_model raw_results tibble model information, returned run_experiment parsed_results list parsed results, returned parse_experiment filters named list containing \"phase\" \"trial_type\" character vectors, filtering data","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/heidi_plots.html","id":null,"dir":"Reference","previous_headings":"","what":"Plotting functions for calmr models — plot_vs","title":"Plotting functions for calmr models — plot_vs","text":"plot_vs, plot_acts, plot_rs, plot_as plot weights, activations, r-values alphas model. make_plots convenience function generate plots one go. plot_common_scale rescales y-axis group plots, scale. get_plot_opts returns plotting options. graph creates graph model's weights given trial. get_graph_opts returns graphing options. make_graphs convenience function create group graphs, given model. patch_plots patch_graphs return composite plots graphs.","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_plots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plotting functions for calmr models — plot_vs","text":"","code":"plot_vs(vals) plot_acts(vals, bars = F) plot_rs(vals, simple = F) plot_as(vals) make_plots(parsed_model) plot_common_scale(plots) get_plot_opts(common_scale = TRUE) graph( weights, limits = max(abs(range(weights$value))) * c(-1, 1), t = max(weights$trial), graph_opts = get_graph_opts() ) get_graph_opts(graph_size = \"small\") make_graphs( parsed_model, limits = max(abs(range(parsed_model$vs$value))) * c(-1, 1), t = max(parsed_model$vs$trial), graph_opts = get_graph_opts() ) patch_graphs(graphs, selection = names(graphs)) patch_plots( plots, selection = NULL, type = NULL, plot_options = get_plot_opts() )"},{"path":"https://victornavarro.org/calmr/reference/heidi_plots.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plotting functions for calmr models — plot_vs","text":"vals data.frame containing parsed values. bars logical stipulating whether summarize use stacked bars, instead points lines. simple logical stipulating whether simplify plot collapsing across sources. parsed_model parsed model, returned parse_experiment. plots named list plots common_scale logical. Whether plot data common y-scale. weights data.frame containing parsed weights, returned parse_experiment limits vector length 2 specifying range weights. Defaults negative positive maximum absolute weights. t integer denoting trial weights graphed. Defaults last trial data. graph_opts list options graphing weights graph_size string specifying desired graph size, c(\"large\", \"small\"). Default \"large\". graphs list graphs, returned make_graphs selection character vector selected plots type string specifying type plots requested. One c(\"vs\", \"rs_simple\", \"rs_complex\", \"acts_learning\", \"acts_bar\", \"\") plot_options list options","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if object is Calmr experiment — is_experiment","title":"Check if object is Calmr experiment — is_experiment","text":"Check object Calmr experiment","code":""},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if object is Calmr experiment — is_experiment","text":"","code":"is_experiment(object)"},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if object is Calmr experiment — is_experiment","text":"object object checked","code":""},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if object is Calmr experiment — is_experiment","text":"logical","code":""},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the MAC1975 model — MAC1975","title":"Train the MAC1975 model — MAC1975","text":"Train MAC1975 model","code":""},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the MAC1975 model — MAC1975","text":"","code":"MAC1975(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the MAC1975 model — MAC1975","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the MAC1975 model — MAC1975","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"Make CalmrExperiment — make_experiment","title":"Make CalmrExperiment — make_experiment","text":"Makes CalmrExperiment object containing arguments necessary run experiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make CalmrExperiment — make_experiment","text":"","code":"make_experiment( design, model, parameters = NULL, timings = NULL, iterations = 1, miniblocks = TRUE, .callback_fn = NULL, ... )"},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make CalmrExperiment — make_experiment","text":"design design data.frame. model string specifying model name. One supported_models(). parameters Optional. Parameters model returned get_parameters(). timings Optional. Timings time-based design returned get_timings() iterations integer specifying number iterations per group. Default = 1. miniblocks Whether organize trials miniblocks. Default = TRUE. .callback_fn function keeping track progress. Internal use. ... Extra parameters passed functions.","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make CalmrExperiment — make_experiment","text":"CalmrExperiment object.","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Make CalmrExperiment — make_experiment","text":"miniblocks option direct sampling function create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make CalmrExperiment — make_experiment","text":"","code":"des <- data.frame(Group = \"G1\", P1 = \"10A>(US)\", R1 = TRUE) ps <- get_parameters(des, model = \"HD2022\") make_experiment( design = des, parameters = ps, model = \"HD2022\", iterations = 2 ) #> ----------------------------- #> CalmrExperiment with model: #> HD2022 #> ----------------------------- #> Design: #> Group P1 R1 #> 1 G1 10A>(US) TRUE #> ----------------------------- #> Parameters: #> $G1 #> $G1$alphas #> A US #> 0.4 0.4 #>"},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a tibble to fit a calmr model — make_heidi_args","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"Make tibble fit calmr model","code":""},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"","code":"make_model_args(design, pars, opts = get_exp_opts())"},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"design design tibble, returned parse_design pars data.frame containing parameters returned get_model_params opts list options returned get_exp_opts","code":""},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"tibble arguments required run model. row represents group experimental design.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"","code":"df <- data.frame(Group = c('Group 1', 'Group 2'), P1 = c('10AB(US)', '10A(US)'), R1 = c(TRUE, TRUE)) des <- parse_design(df) ps <- get_model_params(des, 0.2) make_model_args(design = des, pars = ps, opts = get_exp_opts(iterations = 1)) #> # A tibble: 2 x 15 #> # Rowwise: iteration #> iteration group tps is_test phase block_size trial_pre_func trial_post_func #> #> 1 1 Group~ #> 2 1 Group~ #> # ... with 7 more variables: trial_pre_nomi , trial_post_nomi , #> # trial_names , stim_alphas , unique_functional_stimuli , #> # unique_nominal_stimuli , nomi_func_map "},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a tibble to fit a calmr model — make_model_args","title":"Make a tibble to fit a calmr model — make_model_args","text":"Make tibble fit calmr model","code":""},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a tibble to fit a calmr model — make_model_args","text":"","code":"make_model_args(design, pars = NULL, model = NULL, opts = get_exp_opts())"},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a tibble to fit a calmr model — make_model_args","text":"design design data.frame pars data.frame containing parameters returned get_model_params model string specifying model name. One supported_models() opts list options returned get_exp_opts","code":""},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a tibble to fit a calmr model — make_model_args","text":"tibble arguments required run model. row represents group experimental design.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make a tibble to fit a calmr model — make_model_args","text":"","code":"des <- data.frame(Group = \"G1\", P1 = \"10A>(US)\", R1 = TRUE) ps <- get_model_params(des, model = \"HD2022\") op <- get_exp_opts(iterations = 1) make_model_args(design = des, pars = ps, model = \"HD2022\", opts = op) #> # A tibble: 1 x 6 #> model iteration group experience mapping alphas #> #> 1 HD2022 1 G1 "},{"path":"https://victornavarro.org/calmr/reference/model_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"An assortment of functions to help models — model_helpers","title":"An assortment of functions to help models — model_helpers","text":"get_model_params generates data.frame stimulus salience parameters. gen_ss_weights generates named matrix model weights. model_vs, parse_acts, parse_rs, parse_as parse_experiment_results parse raw outputs model tibbles. filter_calmr_results convenience function filter specific phase trial_type data.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assortment of functions to help models — model_helpers","text":"","code":"gen_ss_weights(stims, default_val = 0) parse_model(model) parse_experiment_results(experiment, aggregate = T) aggregate_experiment_results(parsed_experiment) filter_calmr_results(parsed_experiment, filters)"},{"path":"https://victornavarro.org/calmr/reference/model_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"An assortment of functions to help models — model_helpers","text":"stims character vector stimuli default_val Default alpha value filters named list containing \"phase\" \"trial_type\" character vectors, filtering data design data.frame containing experimental design. mod model list raw_results tibble model information, returned run_experiment parsed_results list parsed results, returned parse_experiment_results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Miscellaneous information functions — information_functions","title":"Miscellaneous information functions — information_functions","text":"supported_models Returns models supported package. supported_plots, model_outputs Returns plots, outputs supported argument model. supported_families Returns families supported fit_model. supported_optimizers returns optimizers supported fit_model. supported_plots returns plots supported argument model. get_model Returns function specified argument model. parameter_info Returns parameter information model (model = NULL)","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Miscellaneous information functions — information_functions","text":"","code":"supported_models() supported_optimizers() supported_families() supported_plots(model = NULL) get_model(model) parameter_info(model = NULL) model_outputs(model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Miscellaneous information functions — information_functions","text":"model string specifying model. One supported_models()","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Miscellaneous information functions — information_functions","text":"character vector character vector character vector character vector model NULL. list otherwise. function list \"name\" (character vector parameter names \"default_value\" (numeric vector parameter values) character vector model NULL. list otherwise.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":null,"dir":"Reference","previous_headings":"","what":"Model information functions — model_information","title":"Model information functions — model_information","text":"assortment functions return model information.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model information functions — model_information","text":"","code":"supported_models() supported_timed_models() supported_optimizers() supported_families() supported_plots(model = NULL) get_model(model) model_parameters(model = NULL) model_outputs(model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model information functions — model_information","text":"model string specifying model. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model information functions — model_information","text":"supported_models() returns character vector. supported_timed_models() returns character vector. supported_optimizers() returns character vector. supported_families() returns character vector. supported_plots() returns character vector list (model NULL). get_model() returns model function. model_parameters() returns list list lists (model NULL). model_outputs() returns character vector list (model NULL).","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model information functions — model_information","text":"","code":"# Outputs and plots supported by the RW1972 model model_outputs(\"RW1972\") #> [1] \"associations\" \"responses\" # Getting the model function implementing the PKH1982 model pkh_func <- get_model(\"PKH1982\") head(pkh_func, 10) #> #> 1 function (ev = NULL, iv = NULL, parameters, experience, mapping, #> 2 ...) #> 3 { #> 4 .assert_no_functional(mapping) #> 5 ntrials <- length(experience$tp) #> 6 fsnames <- mapping$unique_functional_stimuli #> 7 if (is.null(ev)) { #> 8 ev <- gen_ss_weights(fsnames) #> 9 } #> 10 if (is.null(iv)) { # Getting the parameters required by SM2007 model_parameters(\"SM2007\") #> $name #> [1] \"alphas\" \"lambdas\" \"omegas\" \"rhos\" \"gammas\" \"taus\" \"order\" #> #> $default_value #> [1] 0.4 1.0 0.2 1.0 1.0 0.2 1.0 #>"},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":null,"dir":"Reference","previous_headings":"","what":"Miscellaneous information functions — supported_models","title":"Miscellaneous information functions — supported_models","text":"Miscellaneous information functions","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Miscellaneous information functions — supported_models","text":"","code":"supported_models() supported_optimizers() supported_families() supported_plots(model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Miscellaneous information functions — supported_models","text":"model string specifying model. One supported_models()","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Miscellaneous information functions — supported_models","text":"supported_models returns models supported package. supported_plots returns plots supported argument model. supported_families returns families supported fit_model. supported_optimizers returns optimizers supported fit_model. suported_plots returns plots supported argument model.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_plots.html","id":null,"dir":"Reference","previous_headings":"","what":"Plotting functions for calmr models — plot_vs","title":"Plotting functions for calmr models — plot_vs","text":"plot_vs, plot_acts, plot_rs, plot_as plot weights, activations, r-values alphas model. make_plots convenience function generate plots one go. plot_common_scale rescales y-axis group plots, scale. get_plot_opts returns plotting options. graph_weights creates graph_weights model's weights given trial. get_graph_opts returns graphing options. make_graphs convenience function create group graphs, given model. patch_plots patch_graphs return composite plots graphs.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_plots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plotting functions for calmr models — plot_vs","text":"","code":"plot_vs(vals) plot_acts(vals) plot_rs(vals, simple = F) plot_as(vals) plot_os(vals)"},{"path":"https://victornavarro.org/calmr/reference/model_plots.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plotting functions for calmr models — plot_vs","text":"vals data.frame containing parsed values. simple logical stipulating whether simplify plot collapsing across sources. bars logical stipulating whether summarize use stacked bars, instead points lines. parsed_results parsed experiment, returned parse_experiment_results. plots named list plots selection character vector selected plots type string specifying type plots requested. One c(\"vs\", \"rs_simple\", \"rs_complex\", \"acts_learning\", \"acts_bar\", \"\") plot_options list options common_scale logical. Whether plot data common y-scale. weights data.frame containing parsed weights, returned parse_experiment_results t integer denoting trial weights graphed. Defaults last trial data. limits vector length 2 specifying range weights. Defaults negative positive maximum absolute weights. graph_opts list options graphing weights graph_size string specifying desired graph size, c(\"large\", \"small\"). Default \"large\". graphs list graphs, returned make_graphs","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":null,"dir":"Reference","previous_headings":"","what":"NLL of CalmrFit — NLL","title":"NLL of CalmrFit — NLL","text":"Returns negative log likelihood model fit via calmr::fit_model","code":""},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NLL of CalmrFit — NLL","text":"","code":"NLL(object, ...)"},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"NLL of CalmrFit — NLL","text":"object object class CalmrFit-class. ... Unused","code":""},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"NLL of CalmrFit — NLL","text":"numeric","code":""},{"path":"https://victornavarro.org/calmr/reference/options.html","id":null,"dir":"Reference","previous_headings":"","what":"Get optimizer options — get_optimizer_opts","title":"Get optimizer options — get_optimizer_opts","text":"Get optimizer options","code":""},{"path":"https://victornavarro.org/calmr/reference/options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get optimizer options — get_optimizer_opts","text":"","code":"get_optimizer_opts( model_pars, initial_pars = rep(NA, length(model_pars)), ll = rep(NA, length(model_pars)), ul = rep(NA, length(model_pars)), optimizer = NULL, family = NULL )"},{"path":"https://victornavarro.org/calmr/reference/options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get optimizer options — get_optimizer_opts","text":"model_pars character vector specifying name parameters fit. initial_pars numeric vector specifying initial parameter values #' evaluate model (required optim). Defaults 0 parameter. ll, ul numeric vector specifying lower upper limits parameters fit, respectively optimizer string specifying optimizer use. One c(\"optim\", \"ga\") family string specifying family function generate responses (calculate likelihood function ). One c(\"identity\", \"normal\", \"poisson\").","code":""},{"path":"https://victornavarro.org/calmr/reference/options.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get optimizer options — get_optimizer_opts","text":"Whenever family function identity used, family-specific parameters always appended end relevant lists.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve/set parameters from/in CalmrExperiment — parameters","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"Retrieve/set parameters /CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"","code":"parameters(x) parameters(x) <- value"},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"x CalmrExperiment object value list parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"passing list parameters (returned get_parameters), set method overwrite rows experiment. Passing list lists replace row--row basis.","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse design data.frame — parse_design","title":"Parse design data.frame — parse_design","text":"Parse design data.frame","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse design data.frame — parse_design","text":"","code":"parse_design(df)"},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse design data.frame — parse_design","text":"df data.frame dimensions (groups) (2*phases+1).","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse design data.frame — parse_design","text":"CalmrDesign object.","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Parse design data.frame — parse_design","text":"entry even-numbered columns df string formatted per phase_parser().","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse design data.frame — parse_design","text":"","code":"df <- data.frame( Group = c(\"Group 1\", \"Group 2\"), P1 = c(\"10AB(US)\", \"10A(US)\"), R1 = c(TRUE, TRUE) ) parse_design(df) #> CalmrDesign built from data.frame: #> Group P1 R1 #> 1 Group 1 10AB(US) TRUE #> 2 Group 2 10A(US) TRUE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 Group 1 P1 AB(US) 10 FALSE A;B;US #> 2 Group 2 P1 A(US) 10 FALSE A;US"},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":null,"dir":"Reference","previous_headings":"","what":"Patch Calmr graphs — patch_graphs","title":"Patch Calmr graphs — patch_graphs","text":"Convenience function patch graphs 'patchwork'","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patch Calmr graphs — patch_graphs","text":"","code":"patch_graphs(graphs, selection = names(graphs))"},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Patch Calmr graphs — patch_graphs","text":"graphs list named graphs, returned graph() calmr_model_graph() selection character numeric vector determining plots patch.","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Patch Calmr graphs — patch_graphs","text":"'patchwork' object","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":null,"dir":"Reference","previous_headings":"","what":"Patch Calmr plots — patch_plots","title":"Patch Calmr plots — patch_plots","text":"Convenience function patch plots patchwork","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patch Calmr plots — patch_plots","text":"","code":"patch_plots(plots, selection = names(plots), plot_options = get_plot_opts())"},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Patch Calmr plots — patch_plots","text":"plots list named plots, returned calmr::plot selection character numeric vector determining plots patch plot_options list plot options returned get_plot_opts","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Patch Calmr plots — patch_plots","text":"patchwork object","code":""},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":null,"dir":"Reference","previous_headings":"","what":"Rat responses from Patittucci et al. 2016 — pati","title":"Rat responses from Patittucci et al. 2016 — pati","text":"dataset containing rat nose pokes lever presses levers associated different appetitive stimuli.","code":""},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rat responses from Patittucci et al. 2016 — pati","text":"","code":"pati"},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Rat responses from Patittucci et al. 2016 — pati","text":"data.frame following variables: subject subject identifier block 2-session block training (1 8) lever lever presented trial: L = left; R = right us stimulus followed lever: P = pellet; S = sucrose response response: lp = lever press; np = nose poke rpert responses per trial","code":""},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Rat responses from Patittucci et al. 2016 — pati","text":"Patittucci et al. (2016). JEP:ALC","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":null,"dir":"Reference","previous_headings":"","what":"Parses a phase string — phase_parser","title":"Parses a phase string — phase_parser","text":"Parses phase string","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parses a phase string — phase_parser","text":"","code":"phase_parser(phase_string)"},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parses a phase string — phase_parser","text":"phase_string string specifying trials within phase.","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parses a phase string — phase_parser","text":"named list : trial_info: trial-named list lists. general_info: General phase information.","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Parses a phase string — phase_parser","text":"function meant internal use , expose can test strings.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parses a phase string — phase_parser","text":"","code":"# A silly (but valid) string phase_parser(\"10#Rescorla>Wagner\") #> $trial_info #> $trial_info$`10#Rescorla>Wagner` #> $trial_info$`10#Rescorla>Wagner`$name #> [1] \"#Rescorla>Wagner\" #> #> $trial_info$`10#Rescorla>Wagner`$repetitions #> [1] 10 #> #> $trial_info$`10#Rescorla>Wagner`$is_test #> [1] TRUE #> #> $trial_info$`10#Rescorla>Wagner`$periods #> [1] \"Rescorla\" \"Wagner\" #> #> $trial_info$`10#Rescorla>Wagner`$nominals #> $trial_info$`10#Rescorla>Wagner`$nominals$Rescorla #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" #> #> $trial_info$`10#Rescorla>Wagner`$nominals$Wagner #> [1] \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> #> $trial_info$`10#Rescorla>Wagner`$functionals #> $trial_info$`10#Rescorla>Wagner`$functionals$Rescorla #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" #> #> $trial_info$`10#Rescorla>Wagner`$functionals$Wagner #> [1] \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> #> $trial_info$`10#Rescorla>Wagner`$all_nominals #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> $trial_info$`10#Rescorla>Wagner`$all_functionals #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> #> #> $general_info #> $general_info$trial_names #> [1] \"#Rescorla>Wagner\" #> #> $general_info$trial_repeats #> [1] 10 #> #> $general_info$is_test #> [1] TRUE #> #> $general_info$nomi2func #> R e s c o r l a W g n #> \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"g\" \"n\" #> #> $general_info$func2nomi #> R e s c o r l a W g n #> \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"g\" \"n\" #> #> # An invalid string that needs trial repetitions for one of trials. try(phase_parser(\"10#Rescorla/Wagner\")) #> Error in if (is.na(treps)) 1 else treps : argument is of length zero"},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the PKH1982 model — PKH1982","title":"Train the PKH1982 model — PKH1982","text":"Train PKH1982 model","code":""},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the PKH1982 model — PKH1982","text":"","code":"PKH1982(ev = NULL, iv = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the PKH1982 model — PKH1982","text":"ev (optional) named matrix dimensions S,S; S number stimuli. iv (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the PKH1982 model — PKH1982","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot CalmrExperiment — plot,CalmrExperiment-method","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"Creates plot depicting results CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment plot(x, type = NULL, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"x object class CalmrExperiment-class. type string specifying type plot create. See ??supported_plots. ... Additional parameters passed plotting function.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot RSA — plot,CalmrRSA-method","title":"Plot RSA — plot,CalmrRSA-method","text":"Plot correlogram RSA results","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot RSA — plot,CalmrRSA-method","text":"","code":"# S4 method for CalmrRSA plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot RSA — plot,CalmrRSA-method","text":"x object class CalmrRSA-class. ... Additional parameters passed plotting function.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot RSA — plot,CalmrRSA-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot RSA test — plot,CalmrRSATest-method","title":"Plot RSA test — plot,CalmrRSATest-method","text":"Plot correlogram RSA test results","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot RSA test — plot,CalmrRSATest-method","text":"","code":"# S4 method for CalmrRSATest plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot RSA test — plot,CalmrRSATest-method","text":"x object class CalmrRSATest-class. ... Additional parameters passed plotting function.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot RSA test — plot,CalmrRSATest-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot CalmrExperiment — plot","title":"Plot CalmrExperiment — plot","text":"Creates plots (plot) aggregated results CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot CalmrExperiment — plot","text":"","code":"plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot CalmrExperiment — plot","text":"x object class CalmrExperiment. type character vector specifying types plots create. See ??supported_plots. Defaults NULL.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot CalmrExperiment — plot","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Plot CalmrExperiment — plot","text":"type = NULL, supported plots returned.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":null,"dir":"Reference","previous_headings":"","what":"General plotting functions — plotting_functions","title":"General plotting functions — plotting_functions","text":"plot_targetted_tbins() plots targetted time data trial. plot_tbins() plots non-targetted time data trial. plot_targetted_trials() plots targetted trial data. plot_trials() plots non-targetted trial data. plot_targetted_typed_trials() plots targetted trial data type. plot_targetted_complex_trials() plots targetted data third variable.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"General plotting functions — plotting_functions","text":"","code":"plot_targetted_tbins(data, t = max(data$trial)) plot_tbins(data, t = max(data$trial)) plot_targetted_trials(data) plot_trials(data) plot_targetted_typed_trials(data) plot_targetted_complex_trials(data, col)"},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"General plotting functions — plotting_functions","text":"data data.frame-like data plot. t numeric vector specifying trial(s) plot. Defaults last trial data. col string specifying column third variable.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"General plotting functions — plotting_functions","text":"plot_targetted_tbins() returns 'ggplot' object. plot_tbins() returns 'ggplot' object. plot_targetted_trials() returns 'ggplot' object. plot_trials() returns 'ggplot' object. plot_targetted_typed_trials() returns 'ggplot' object. plot_targetted_complex_trials() returns 'ggplot' object.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"General plotting functions — plotting_functions","text":"data must organised returned results() parsed_results().","code":""},{"path":"https://victornavarro.org/calmr/reference/predict-CalmrFit-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Predict from CalmrFit — predict,CalmrFit-method","title":"Predict from CalmrFit — predict,CalmrFit-method","text":"Obtain prediction CalmrFit","code":""},{"path":"https://victornavarro.org/calmr/reference/predict-CalmrFit-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Predict from CalmrFit — predict,CalmrFit-method","text":"","code":"# S4 method for CalmrFit predict(object, type = \"response\", ...)"},{"path":"https://victornavarro.org/calmr/reference/predict-CalmrFit-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Predict from CalmrFit — predict,CalmrFit-method","text":"object object class CalmrFit-class. type string. response, model responses transformed via link function. ... Additional parameters passed function (object@model_function).","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the HeiDI model (quickly) — quick_heidi","title":"Run the HeiDI model (quickly) — quick_heidi","text":"Runs model minimal parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the HeiDI model (quickly) — quick_heidi","text":"","code":"run_experiment(design, param_df = NULL, options = NULL, parse = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the HeiDI model (quickly) — quick_heidi","text":"design data.frame dimensions G,2*P+1; G number groups P number phases. param_df data.frame dimensions N,2; N number stimuli experimental design. options list options, returned get_exp_opts. parse logical specifying whether results parsed via parse_experiment. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run the HeiDI model (quickly) — quick_heidi","text":"list parsed results tibble raw results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Run a model (quickly) — quick_model","title":"Run a model (quickly) — quick_model","text":"Runs model minimal parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run a model (quickly) — quick_model","text":"","code":"run_experiment( design, model = NULL, param_df = NULL, options = NULL, parse = TRUE )"},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run a model (quickly) — quick_model","text":"design data.frame dimensions G,2*P+1; G number groups P number phases. param_df data.frame dimensions N,2; N number stimuli experimental design. options list options, returned get_exp_opts. parse logical specifying whether results parsed via parse_experiment_results. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run a model (quickly) — quick_model","text":"list parsed results tibble raw results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the RAND model — RAND","title":"Train the RAND model — RAND","text":"Train RAND model","code":""},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the RAND model — RAND","text":"","code":"RAND(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the RAND model — RAND","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the RAND model — RAND","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/results.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract aggregated results from CalmrExperiment — results","title":"Extract aggregated results from CalmrExperiment — results","text":"Extract aggregated results CalmrExperiment Extract aggregated results CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/results.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract aggregated results from CalmrExperiment — results","text":"","code":"results(object) results(object)"},{"path":"https://victornavarro.org/calmr/reference/results.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract aggregated results from CalmrExperiment — results","text":"object object class CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/results.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract aggregated results from CalmrExperiment — results","text":"tbl containing models (rows) model outputs (columns) tbl containing models (rows) model outputs (columns)","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"Perform representational similarity analysis CalmExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"","code":"# S4 method for CalmExperiment rsa(x, comparisons, test = FALSE, ...)"},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"x tbl m o (models outputs) aggregated results. comparisons model-named list containing model outputs compare. test Whether test RSA via permutation test. Default = FALSE. ... Additional parameters passed stats::dist stats::cor","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"CalmRSA object","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"object returned function can later tested via test method.","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"","code":"# Comparing the associations in three models exp <- data.frame( Group = c(\"A\", \"B\"), P1 = c(\"2(A)>(US)/1B>(US)\", \"1(A)>(US)/2B>(US)\"), R1 = TRUE ) exp <- parse_design(exp) models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") parameters <- sapply(models, get_parameters, design = exp) options <- get_exp_opts() exp_res <- compare_models(exp, models = models, parameters = parameters, options = options ) comparisons <- list( \"HD2022\" = c(\"vs\"), \"RW1972\" = c(\"vs\"), \"PKH1982\" = c(\"eivs\") ) res <- rsa(exp_res, comparisons = comparisons) test(res, n_samples = 100) #> CalmRSA object #> --------------- #> Correlation matrix: #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs 1.0000000 1.0000000 -0.9223956 #> RW1972.vs 1.0000000 1.0000000 -0.9223956 #> PKH1982.eivs -0.9223956 -0.9223956 1.0000000 #> #> Significance matrix: #> #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs FALSE FALSE FALSE #> RW1972.vs FALSE FALSE FALSE #> PKH1982.eivs FALSE FALSE FALSE #> #> 100 permutation samples, two-tailed test with alpha = 0.05."},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"Perform representational similarity analysis CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment rsa(x, comparisons, test = FALSE, ...)"},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"x tbl m o (models outputs) aggregated results. comparisons model-named list containing model outputs compare. test Whether test RSA via permutation test. Default = FALSE. ... Additional parameters passed stats::dist stats::cor","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"CalmrRSA object","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"object returned function can later tested via test method.","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"","code":"# Comparing the associations in three models exp <- data.frame( Group = c(\"A\", \"B\"), P1 = c(\"2(A)>(US)/1B>(US)\", \"1(A)>(US)/2B>(US)\"), R1 = TRUE ) exp <- parse_design(exp) models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") parameters <- sapply(models, get_parameters, design = exp) options <- get_exp_opts() exp_res <- compare_models(exp, models = models, parameters = parameters, options = options ) comparisons <- list( \"HD2022\" = c(\"vs\"), \"RW1972\" = c(\"vs\"), \"PKH1982\" = c(\"eivs\") ) res <- rsa(exp_res, comparisons = comparisons) test(res, n_samples = 100) #> CalmrRSA object #> --------------- #> Correlation matrix: #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs 1.0000000 1.0000000 -0.9223956 #> RW1972.vs 1.0000000 1.0000000 -0.9223956 #> PKH1982.eivs -0.9223956 -0.9223956 1.0000000 #> #> Significance matrix: #> #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs FALSE FALSE FALSE #> RW1972.vs FALSE FALSE FALSE #> PKH1982.eivs FALSE FALSE FALSE #> #> 100 permutation samples, two-tailed test with alpha = 0.05."},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform representational similarity analysis — rsa","title":"Perform representational similarity analysis — rsa","text":"Perform representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform representational similarity analysis — rsa","text":"","code":"rsa(x, comparisons, test = FALSE, ...)"},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform representational similarity analysis — rsa","text":"x list CalmrExperiment objects comparisons model-named list containing model outputs compare. test Whether test RSA via permutation test. Default = FALSE. ... Additional parameters passed stats::dist() stats::cor()","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform representational similarity analysis — rsa","text":"CalmrRSA object","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Perform representational similarity analysis — rsa","text":"object returned function can later tested via test() method.","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform representational similarity analysis — rsa","text":"","code":"# Comparing the associations in three models exp <- data.frame( Group = c(\"A\", \"B\"), P1 = c(\"2(A)>(US)/1B>(US)\", \"1(A)>(US)/2B>(US)\"), R1 = TRUE ) models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") parameters <- sapply(models, get_parameters, design = exp) exp_res <- compare_models(exp, models = models ) comparisons <- list( \"HD2022\" = c(\"associations\"), \"RW1972\" = c(\"associations\"), \"PKH1982\" = c(\"associations\") ) res <- rsa(exp_res, comparisons = comparisons) test(res, n_samples = 20) #> CalmrRSA object #> --------------- #> Correlation matrix: #> HD2022.associations RW1972.associations #> HD2022.associations 1.00000000 0.05460654 #> RW1972.associations 0.05460654 1.00000000 #> PKH1982.associations -0.92239565 0.33530125 #> PKH1982.associations #> HD2022.associations -0.9223956 #> RW1972.associations 0.3353012 #> PKH1982.associations 1.0000000 #> --------------- #> Significance matrix: #> HD2022.associations RW1972.associations #> HD2022.associations FALSE FALSE #> RW1972.associations FALSE FALSE #> PKH1982.associations FALSE FALSE #> PKH1982.associations #> HD2022.associations FALSE #> RW1972.associations FALSE #> PKH1982.associations FALSE #> From 20 permutation samples, two-tailed test with alpha = 0.05."},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"Run experiment — run_experiment","title":"Run experiment — run_experiment","text":"Runs experiment minimal parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run experiment — run_experiment","text":"","code":"run_experiment(x, outputs = NULL, parse = TRUE, aggregate = TRUE, ...)"},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run experiment — run_experiment","text":"x CalmrExperiment design data.frame outputs character vector specifying outputs parse aggregate. Defaults NULL, case model outputs parsed/aggregated. parse logical specifying whether raw results parsed. Default = TRUE. aggregate logical specifying whether parsed results aggregated. Default = TRUE. ... Arguments passed functions","code":""},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run experiment — run_experiment","text":"CalmrExperiment results.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run experiment — run_experiment","text":"","code":"# Using a data.frame only (throws warning) df <- get_design(\"relative_validity\") run_experiment(df, model = \"RW1972\") #> Warning: Using default model parameters. #> ----------------------------- #> CalmrExperiment with model: #> RW1972 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 True 10AB(US)/10AC TRUE 1#A TRUE #> 2 Pseudo 5AB(US)/5AB/5AC(US)/5AC TRUE 1#A TRUE #> ----------------------------- #> Parameters: #> $True #> $True$alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $True$betas_on #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $True$betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $True$lambdas #> A B C US #> 1 1 1 1 #> #> #> $Pseudo #> $Pseudo$alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $Pseudo$betas_on #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $Pseudo$betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $Pseudo$lambdas #> A B C US #> 1 1 1 1 #> # Using custom parameters df <- get_design(\"relative_validity\") pars <- get_parameters(df, model = \"HD2022\") pars$alphas[\"US\"] <- 0.6 run_experiment(df, parameters = pars, model = \"HD2022\") #> ----------------------------- #> CalmrExperiment with model: #> HD2022 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 True 10AB(US)/10AC TRUE 1#A TRUE #> 2 Pseudo 5AB(US)/5AB/5AC(US)/5AC TRUE 1#A TRUE #> ----------------------------- #> Parameters: #> $True #> $True$alphas #> A B C US #> 0.4 0.4 0.4 0.6 #> #> #> $Pseudo #> $Pseudo$alphas #> A B C US #> 0.4 0.4 0.4 0.6 #> # Using make_experiment, for more iterations df <- get_design(\"blocking\") pars <- get_parameters(df, model = \"SM2007\") exper <- make_experiment(df, parameters = pars, model = \"SM2007\", iterations = 4 ) run_experiment(exper) #> ----------------------------- #> CalmrExperiment with model: #> SM2007 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 Blocking 10N>(US) FALSE 10NL>(US)/10#L FALSE #> 2 Control FALSE 10NL>(US)/10#L FALSE #> ----------------------------- #> Parameters: #> $Blocking #> $Blocking$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Blocking$lambdas #> L N US #> 1 1 1 #> #> $Blocking$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$rhos #> L N US #> 1 1 1 #> #> $Blocking$gammas #> L N US #> 1 1 1 #> #> $Blocking$taus #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$order #> [1] 1 #> #> #> $Control #> $Control$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Control$lambdas #> L N US #> 1 1 1 #> #> $Control$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Control$rhos #> L N US #> 1 1 1 #> #> $Control$gammas #> L N US #> 1 1 1 #> #> $Control$taus #> L N US #> 0.2 0.2 0.2 #> #> $Control$order #> [1] 1 #> # Only parsing the associations in the model, without aggregation run_experiment(exper, outputs = \"associations\", aggregate = FALSE) #> ----------------------------- #> CalmrExperiment with model: #> SM2007 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 Blocking 10N>(US) FALSE 10NL>(US)/10#L FALSE #> 2 Control FALSE 10NL>(US)/10#L FALSE #> ----------------------------- #> Parameters: #> $Blocking #> $Blocking$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Blocking$lambdas #> L N US #> 1 1 1 #> #> $Blocking$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$rhos #> L N US #> 1 1 1 #> #> $Blocking$gammas #> L N US #> 1 1 1 #> #> $Blocking$taus #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$order #> [1] 1 #> #> #> $Control #> $Control$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Control$lambdas #> L N US #> 1 1 1 #> #> $Control$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Control$rhos #> L N US #> 1 1 1 #> #> $Control$gammas #> L N US #> 1 1 1 #> #> $Control$taus #> L N US #> 0.2 0.2 0.2 #> #> $Control$order #> [1] 1 #>"},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the HeiDI model — run_heidi","title":"Run the HeiDI model — run_heidi","text":"Runs model specific arguments.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the HeiDI model — run_heidi","text":"","code":"run_model(args, parse = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the HeiDI model — run_heidi","text":"args tibble returned make_model_args. parse logical specifying whether results parsed. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run the HeiDI model — run_heidi","text":"list parsed results tibble raw results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Run a model — run_model","title":"Run a model — run_model","text":"Runs model specific arguments.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run a model — run_model","text":"","code":"run_model(args, parse = T, ...)"},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run a model — run_model","text":"args tibble returned make_model_args. parse logical specifying whether results parsed.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run a model — run_model","text":"CalmrExperiment object.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the RW1972 model — RW1972","title":"Train the RW1972 model — RW1972","text":"Train RW1972 model","code":""},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the RW1972 model — RW1972","text":"","code":"RW1972(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the RW1972 model — RW1972","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the RW1972 model — RW1972","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":null,"dir":"Reference","previous_headings":"","what":"Get/set the colour/fill palette for plots — set_calmr_palette","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"Get/set colour/fill palette plots","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"","code":"set_calmr_palette(palette = NULL)"},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"palette string specifying available palettes. NULL, returns available palettes.","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"old palette (invisibly) palette NULL. Otherwise, character vector available palettes.","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"Changes affect palette used graphs.","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Set reward parameters for ANCCR model — set_reward_parameters","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"Set reward parameters ANCCR model","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"","code":"set_reward_parameters(parameters, rewards = c(\"US\"))"},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"parameters list parameters, returned get_parameters() rewards character vector specifying reward stimuli. Default = c(\"US\")","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"list parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"default behaviour get_parameters ANCCR model set every reward-related parameter non-zero default value. function set parameters zero non-reward stimuli","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the SM2007 model — SM2007","title":"Train the SM2007 model — SM2007","text":"Train SM2007 model","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the SM2007 model — SM2007","text":"","code":"SM2007( v = NULL, o = NULL, parameters, experience, mapping, debug = FALSE, comparator_func = .witnauer_comparator_proc, ... )"},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the SM2007 model — SM2007","text":"v (optional) named matrix dimensions S,S; S number stimuli. o (optional) named matrix dimensions S,S,S (operator switches). parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment debug logical specifying whether print information comparison process. Defaults FALSE. comparator_func function used comparison process. Either .witnauer_comparator_funcor .comparator_func. ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the SM2007 model — SM2007","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Train the SM2007 model — SM2007","text":"Correct usage v o parameters requires matrices adhere specific format. v, entry ,j represents association stimulus stimulus j. o, entry ,k,j represents operator switch stimulus comparator k respect stimulus j.","code":""},{"path":"https://victornavarro.org/calmr/reference/summary-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarise CalmrExperiment — summary,CalmrExperiment-method","title":"Summarise CalmrExperiment — summary,CalmrExperiment-method","text":"Shows summary CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/summary-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarise CalmrExperiment — summary,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment summary(object, ...)"},{"path":"https://victornavarro.org/calmr/reference/summary-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarise CalmrExperiment — summary,CalmrExperiment-method","text":"object object class CalmrExperiment-class. ... Additional parameters passed summary function.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the TD model — TD","title":"Train the TD model — TD","text":"Train TD model","code":""},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the TD model — TD","text":"","code":"TD(parameters, experience, mapping, debug = FALSE, debug_t = -1, ...)"},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the TD model — TD","text":"parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment","code":""},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the TD model — TD","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Train the TD model — TD","text":"model highly experimental state. Use caution.","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Trains a Pavlovian HeiDI — train_pav_heidi","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"Trains Pavlovian HeiDI","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"","code":"train_pav_model( sals, V, tps, trial_pre_func, trial_post_func, trial_pre_nomi, trial_post_nomi, nomi_func_map, trial_names, phase, block_size, is_test )"},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"sals named vector stimulus saliences. V named matrix dimensions S,S; S number stimuli. tps vector trial pointers training, function trials. trial_pre_func list length T, character vectors specifying functional stimuli involved expectation part trial. T number unique trials experiment. trial_post_func , correction part trial. trial_pre_nomi list length T, character vectors specifying nominal stimuli involved expectation part trial. trial_post_nomi , correction part trial. nomi_func_map data.frame mappings nominal functional stimuli trial_names character vector length T names trials phase character vector length T names phases block_size integer vector length T specifying block size per trial is_test logical vector specifying whether trial result learning (update V). element TRUE, update occurs.","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"list vs, rs - Arrays dimensions P,S,S; P number trials used train model S number stimuli involved experiment. Respectively, vs rs contain stimulus weights stimulus-specific responses. combs, chains - Lists length P combined chained activation values. tps, trial_pre_func, trial_post_func, trial_pre_nomi, trial_post_nomi, nomi_func_map, trial_names, phase, block_size, is_test - Carryover arguments processing.","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"array V contains associations stimuli involved experiment. Entry ,j specifies associative strength stimulus stimulus j. Entry j,specifies opposite direction.","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":null,"dir":"Reference","previous_headings":"","what":"Parses a string stipulating trials — trial_parser","title":"Parses a string stipulating trials — trial_parser","text":"Parses string stipulating trials","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parses a string stipulating trials — trial_parser","text":"","code":"trial_parser(trial_string)"},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parses a string stipulating trials — trial_parser","text":"trial_string string","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parses a string stipulating trials — trial_parser","text":"list trial_names: character vector specifying names trials contained string trial_repeats: numeric vector specifying number times trial given trial_pre_functional: list character vectors specifying unique functional stimuli expectation part trial trial_post_functional: list character vectors specifying unique functional stimuli correction part trial trial_pre_nominal: list character vectors specifying nominal stimuli expectation part trial trial_post_nominal: list character vectors specifying nominal stimuli expectation part trial nomi_func_map: data.frame specifying mapping functional nominal stimuli unique_nominal stimuli: character vector unique nominal stimuli unique_functional_stimuli: character vector unique functional stimuli is_test: logical vector specifying whether trial result learning","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Parses a string stipulating trials — trial_parser","text":"Supports complex stimuli parentheses (e.g., \"5A>(US)\") Supports multiple nominal versions stimuli (e.g., \"3(A_a)>(US_a)/3(A_b)>(US_b)\") Supports probe trials followed hash (e.g., \"3X#\") trials \">\" character, assumed specified stimuli used expectation step. , \"post\" entries list contain NAs, necessary. trials, \"post\" stimuli none (character(0) vector).","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parses a string stipulating trials — trial_parser","text":"","code":"trial_parser(\"30A\") #> $trial_names #> [1] \"A\" #> #> $trial_repeats #> [1] 30 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"A\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> character(0) #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"A\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"A\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> character(0) #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"A\" #> #> #> $nomi2func #> A #> \"A\" #> #> $func2nomi #> A #> \"A\" #> #> $unique_nominal_stimuli #> [1] \"A\" #> #> $unique_functional_stimuli #> [1] \"A\" #> #> $is_test #> [1] FALSE #> trial_parser(\"30XA>U/30(YA)>A\") #> $trial_names #> [1] \"XA>U\" \"(YA)>A\" #> #> $trial_repeats #> [1] 30 30 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"X\" \"A\" #> #> $trial_pre_functional[[2]] #> [1] \"YA\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> [1] \"U\" #> #> $trial_post_functional[[2]] #> [1] \"A\" #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"X\" \"A\" \"U\" #> #> $trial_functional[[2]] #> [1] \"YA\" \"A\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"X\" \"A\" #> #> $trial_pre_nominal[[2]] #> [1] \"YA\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> [1] \"U\" #> #> $trial_post_nominal[[2]] #> [1] \"A\" #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"X\" \"A\" \"U\" #> #> $trial_nominal[[2]] #> [1] \"YA\" \"A\" #> #> #> $nomi2func #> X A YA U #> \"X\" \"A\" \"YA\" \"U\" #> #> $func2nomi #> X A YA U #> \"X\" \"A\" \"YA\" \"U\" #> #> $unique_nominal_stimuli #> [1] \"X\" \"A\" \"U\" \"YA\" #> #> $unique_functional_stimuli #> [1] \"X\" \"A\" \"YA\" \"U\" #> #> $is_test #> [1] FALSE FALSE #> trial_parser(\"1X#/2X>(US)#\") #> $trial_names #> [1] \"X#\" \"X>(US)#\" #> #> $trial_repeats #> [1] 1 2 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"X\" #> #> $trial_pre_functional[[2]] #> [1] \"X\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> character(0) #> #> $trial_post_functional[[2]] #> [1] \"US\" #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"X\" #> #> $trial_functional[[2]] #> [1] \"X\" \"US\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"X\" #> #> $trial_pre_nominal[[2]] #> [1] \"X\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> character(0) #> #> $trial_post_nominal[[2]] #> [1] \"US\" #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"X\" #> #> $trial_nominal[[2]] #> [1] \"X\" \"US\" #> #> #> $nomi2func #> X US #> \"X\" \"US\" #> #> $func2nomi #> X US #> \"X\" \"US\" #> #> $unique_nominal_stimuli #> [1] \"X\" \"US\" #> #> $unique_functional_stimuli #> [1] \"X\" \"US\" #> #> $is_test #> [1] TRUE TRUE #> trial_parser(\"1X>(US_a)/1Y>(US_b)\") #> $trial_names #> [1] \"X>(US_a)\" \"Y>(US_b)\" #> #> $trial_repeats #> [1] 1 1 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"X\" #> #> $trial_pre_functional[[2]] #> [1] \"Y\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> [1] \"US\" #> #> $trial_post_functional[[2]] #> [1] \"US\" #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"X\" \"US\" #> #> $trial_functional[[2]] #> [1] \"Y\" \"US\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"X\" #> #> $trial_pre_nominal[[2]] #> [1] \"Y\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> [1] \"US_a\" #> #> $trial_post_nominal[[2]] #> [1] \"US_b\" #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"X\" \"US_a\" #> #> $trial_nominal[[2]] #> [1] \"Y\" \"US_b\" #> #> #> $nomi2func #> X Y US_a US_b #> \"X\" \"Y\" \"US\" \"US\" #> #> $func2nomi #> X Y US US #> \"X\" \"Y\" \"US_a\" \"US_b\" #> #> $unique_nominal_stimuli #> [1] \"X\" \"Y\" \"US_a\" \"US_b\" #> #> $unique_functional_stimuli #> [1] \"X\" \"Y\" \"US\" #> #> $is_test #> [1] FALSE FALSE #>"},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-063","dir":"Changelog","previous_headings":"","what":"calmr 0.6.3","title":"calmr 0.6.3","text":"Added set_calmr_palette() function control colour/fill scales used plot results (#1). Fixed bug make_experiment() triggered empty phases miniblocks. Changed get_timings() require specific model name.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-062","dir":"Changelog","previous_headings":"","what":"calmr 0.6.2","title":"calmr 0.6.2","text":"Aggregation ANCCR data now ignores time; time entries averaged. Added Temporal Difference model name “TD”. model experimental state. Experiments time-based models now require separate list construct time-based experiences. See get_timings(). Added experiences<-, timings, timings<- methods CalmrExperiment class. Revamped plotting functions parsing functions. Revamped output names models make intelligible. Fixed bug related aggregation pools HDI2020 HD2022. Consolidated man pages.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-061","dir":"Changelog","previous_headings":"","what":"calmr 0.6.1","title":"calmr 0.6.1","text":"CRAN release: 2024-03-14 Added outputs argument run_experiment(), parse(), aggregate(), allowing user parse/aggregate model outputs. Documentation corrections CRAN resubmission.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-060","dir":"Changelog","previous_headings":"","what":"calmr 0.6.0","title":"calmr 0.6.0","text":"Added dependency data.table resulting great speedups large experiments. Replaced dependency cowplot dependency patchwork. Removed dependencies tibble, dplyr, tidyr, packages tidyverse. Removed shiny app package. previous app now distributed separately via calmr.app package available GitHub. Test coverage reached 100%. package now ready CRAN submission.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-051","dir":"Changelog","previous_headings":"","what":"calmr 0.5.1","title":"calmr 0.5.1","text":"Added parallelization progress bars via future, future.apply, progressr. Function calmr_verbosity can set verbosity package.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-050","dir":"Changelog","previous_headings":"","what":"calmr 0.5.0","title":"calmr 0.5.0","text":"Implementation ANCCR (Jeong et al., 2022), first time-based model included calmr. Added parameter distinction trial-wise period-wise parameters. Added internal augmentation arguments depending model. trial-based models use pre/post distinctions anymore. Using “>” special character affect models anymore. “>” special character used specify periods within trial. example, “>B>C” implies followed B followed C. See using_time_models vignette additional information. Named stimuli now support numbers trailing characters (e.g., “(US1)” valid now.)","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-040","dir":"Changelog","previous_headings":"","what":"calmr 0.4.0","title":"calmr 0.4.0","text":"Major refactoring classes models. help development moving forward. Added several methods access CalmrExperiment contents, including c (bind experiments) results, plot, graph, design, parameters. Created CalmrDesign CalmrResult classes. Rewrote parsers less verbose rely less tidyverse suite piping. Substantially reduced complexity make_experiment function (previous make_experiment). Introduced distinction stimulus-specific global parameters. Parameters now lists instead data.frames. Modified UI calmr app include sidebar. Simplified app removing options. Nearly duplicated number tests.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-030","dir":"Changelog","previous_headings":"","what":"calmr 0.3.0","title":"calmr 0.3.0","text":"Added first version SOCR model (SM2007) well two vignettes explaining math behind implementation quick simulations. Documentation progress.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-020","dir":"Changelog","previous_headings":"","what":"calmr 0.2.0","title":"calmr 0.2.0","text":"Added multiple models package app (RW1972, PKH1982, MAC1975). Implementation basic S4 classes model, experiment, fit, RSA comparison objects, well methods. Added genetic algorithms (via GA) parameter estimation. Added basic tools perform representational similarity analysis. Documentation progress.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-010","dir":"Changelog","previous_headings":"","what":"calmr 0.1.0","title":"calmr 0.1.0","text":"heidi now calmr. package now aims maintain several associative learning models implement tools use. Major overhaul training function (train_pav_model). relevant calculations now done function functional stimuli instead just US. Support specification expectation/correction steps within trial via “>”. example, trial “>(US)” use generate expectation, learn stimuli correction step. previous plotting function R-values revamped allow simple complex versions. complex version facets r-values predictor basis, uses colour lines target. Bugfix related stimulus saliencies.","code":""}] +[{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"the-mathematics-behind-anccr","dir":"Articles","previous_headings":"","what":"The mathematics behind ANCCR","title":"ANCCR","text":"ANCCR (Jeong et al., 2022) model, stands adjusted net contingency causal relations, proposes mesolimbic dopaminergic conveys adjusted net contingency causal relationships (biologically meaningful targets). mathematics (logic) behind model go well beyond can cover , now, suffice say model: Uses “Hebbian” mechanism learn retrospective associations experiencing meaningful causal target. Derives prospective associations using Bayes’s rule. Combines associations contingency terms represent dopaminergic activity. Uses sign dopaminergic activity strengthen weaken causal weights. Responds function prospective associations causal links.","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"maintaining-stimulus-representations","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"1 - Maintaining stimulus representations","title":"ANCCR","text":"degree stimulus \\(\\) time \\(t\\) “active” memory denoted : \\[ \\tag{Eq.1} E_i(t) = \\Sigma_{t_i \\leq t}e^{-(\\frac{t-t_i}{t\\_constant})} \\] \\(t_i\\) time steps time \\(t\\), \\(t\\_constant\\) time constant (usually meant inter-reward rate)1","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"learning-stimulus-associations","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"2 - Learning stimulus associations:","title":"ANCCR","text":"model learns retrospective associations meaningful causal targets occur. Whether event \\(j\\) meaningful causal target given : \\[ \\tag{Eq.2} \\Phi_j = \\begin{cases} 1,& \\text{} \\Phi_j(t) = 1\\\\ 1,& \\text{}DA_j + \\beta_j > \\theta\\\\ 0,& \\text{otherwise} \\end{cases} \\] \\(\\Phi\\) plays role indicator function, \\(DA_j\\) total dopamine activity time event \\(j\\), \\(\\beta_j\\) unconditioned value event \\(j\\) \\(\\theta\\) global threshold parameter.2 Note indicator function self-preserving: stimulus becomes meaningful causal target, stop . stimulus \\(j\\) observed, predecessor representation contingency, PRC, stimulus \\(\\) updated via: \\[ \\tag{Eq.3} PRC_{\\leftarrow j} = M_{\\leftarrow j} - M_{} \\] \\(M_{\\leftarrow j}\\) predecessor representation \\(\\) given \\(j\\) occurred, \\(M_{}\\) base rate \\(\\) occurs. quantities given : \\[ \\tag{Eq.4a} M_{\\leftarrow j} = M_{\\leftarrow j}' + \\Phi_j\\alpha(E_{\\leftarrow j} - M_{\\leftarrow j}') \\] \\[ \\tag{Eq.4b} M_{} = M_{}' + k\\alpha(E_{} - M_{}') \\] \\(M_{\\leftarrow j}'\\) \\(M_{}'\\) quantities \\(j\\) observed, \\(k\\) \\(\\alpha\\) learning rate parameters, \\(E_{\\leftarrow j}\\) eligibility trace stimulus \\(\\) time \\(j\\) occurs (see Eq. 1). , PRC can used derive prospective association, aptly named successor representation contingency, SRC via Bayes rule: \\[ \\tag{Eq.5} SRC_{\\rightarrow j} = PRC_{\\leftarrow j} \\frac{M_j}{M_i} \\] base rate \\(j\\), \\(M_j\\) calculated via Eq.4b.","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"releasing-dopamine","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"3 - Releasing Dopamine","title":"ANCCR","text":"model postulates dopaminergic signaling encodes adjusted net contingencies causal relations stimuli, ANCCRs. total dopaminergic activity time event \\(\\) equal : \\[ \\tag{Eq.6} DA_i = \\Sigma_j (ANCCR_{\\rightarrow j}\\Phi_j) \\] ANCCR stimulus \\(\\) stimulus \\(j\\) given : \\[ \\tag{Eq.7} ANCCR_{\\rightarrow j} = NC_{\\leftrightarrow j} CW_{\\rightarrow j} - \\sum_{k \\neq }(ANCCR_{k \\leftrightarrow j}\\Delta_{k \\leftarrow }\\Phi_{k \\leftrightarrow }) \\] \\(NC_{\\leftrightarrow j}\\) net contingency stimuli \\(\\) \\(j\\), \\(CW_{\\rightarrow j}\\) causal weight \\(\\) \\(j\\), \\(\\Delta_{k \\leftarrow }\\) recency stimulus \\(k\\) respect stimulus \\(\\), \\(\\Phi_{k \\leftrightarrow }\\) indicator function denoting whether \\(k\\) \\(\\) putative causal relationship . net contingency stimuli \\(\\) \\(j\\), \\(NC_{\\leftrightarrow j}\\), given : \\[ \\tag{Eq.8} NC_{\\leftrightarrow j} = wSRC_{\\rightarrow j} + (1-w)PRC_{\\leftarrow j} \\] weighted sum successor predecessor representation contingencies. net contingency used calculate indicator function , : \\[ \\tag{Eq.9} \\Phi_{k \\leftrightarrow } = \\begin{cases} 1,& \\text{} NC_{\\leftrightarrow j} > \\theta\\\\ 0,& \\text{otherwise} \\end{cases} \\] \\(\\theta\\) threshold parameter used Eq.23, indicator function stimulus , \\(\\Phi_{\\leftrightarrow }\\), 0. recency term, \\(\\Delta_{k \\leftarrow }\\), given : \\[ \\tag{Eq.10} \\Delta_{k \\leftarrow } = e^{-(\\frac{t_j-t_i}{t\\_constant})} \\] \\(t\\_constant\\) parameter used Eq.1. Note however Eq.9 include sum term Eq. 1. Finally, causal weight stimulus \\(\\) stimulus \\(j\\) given : \\[ \\tag{Eq.11} CW_{\\rightarrow j} = CW_{\\rightarrow j}' + \\alpha_{reward}\\delta_{\\rightarrow j} \\] \\(CW_{\\rightarrow j}'\\) previous causal weight, \\(\\alpha_{reward}\\) learning rate parameter exclusive causal weights, \\(\\delta_{\\rightarrow j}\\) delta term depending sign total dopaminergic activity, given : \\[ \\tag{Eq.12} \\delta_{\\rightarrow j} = \\begin{cases} CW_{j \\rightarrow j} - CW_{\\rightarrow j}, & \\text{} DA_j \\ge 0\\\\ (0-CW_{\\rightarrow j})\\frac{n_i^{-1}\\Delta{\\leftarrow j} \\Phi_{\\leftrightarrow j}}{\\Sigma_{k \\neq j}(n_k^{-1}\\Delta_{k \\leftarrow j} \\Phi_{k \\leftrightarrow j})},& \\text{otherwise} \\end{cases} \\] \\(CW_{j \\rightarrow j}\\) reward magnitude stimulus \\(j\\). plain words, dopaminergic activity positive, causal weights (present absent stimuli) strengthen. Conversely, dopaminergic activity negative, causal weights (present absent stimuli) weaken, proportional normalized frequency recency (long putative causal relations \\(j\\)).","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind ANCCR","what":"4 - Generating responses","title":"ANCCR","text":"Responding ANCCR lightly specified. value responding upon presentation stimulus \\(\\) given : \\[ \\tag{Eq.13} Q_i = \\Sigma_k(SRC_{\\rightarrow k} CW_{\\rightarrow k}) \\] can mapped onto probabilities via softmax function4.","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"a-diagram","dir":"Articles","previous_headings":"The mathematics behind ANCCR > 4 - Generating responses","what":"A diagram","title":"ANCCR","text":"diagram shows dependencies model. excluding indicator functions parameters simplicity.5","code":""},{"path":"https://victornavarro.org/calmr/articles/ANCCR.html","id":"note","dir":"Articles","previous_headings":"The mathematics behind ANCCR > 4 - Generating responses","what":"Note","title":"ANCCR","text":"implementation model port MATLAB code Jeong et al. shared GitHub repository associated paper. output R model checked outputs MATLAB model, using training routines (“eventlogs” parlance) generated using MATLAB code. training routines generated calmr differ somewhat, accommodate generality. example, version 0.6.1, possible specify probabilistic relations cues rewards. Instead, left user specify exact probability via trial numbers (e.g., 80% reward probability can specified “80A>(US)/20A”). naming parameters also differs codebases.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"the-design-data-frame","dir":"Articles","previous_headings":"","what":"The design data.frame","title":"Getting started with calmr","text":"Let’s specify blocking design. rules design data.frame: row represents group. first column contains group labels. remaining columns organized pairs (trials phase, whether randomize ) trials phase column specified using rigid notation. observations : Trials preceded number. number represents number times trial given phase. “10A(US)” means “(US)” trial given 10 times. presence absence unconditioned stimulus denoted traditional “+” “-” symbols. Instead, use parenthesis denote “complex” stimuli. can thought element complex name (.e., one character). , “(US)” specifies single element represent US. vein, multiple characters parentheses denote individual elements. example, “AB” implies presence two stimuli, B. “/” character used trial separator (imply randomization ). Thus, “1A/1B” specifies single “” trial single “B” trial given phase. Recall randomization trials within phase specified column (, R1, R2, R3). “#” character used denote probe trials. contrast real life, probe trials entail update model’s associations. , probe trials can used track development key associations, repercussion model learns normal training trials. want check whether phase string work package, can use phase_parser(). Warning: function returns list lot information used models package, rule thumb see ton text, phase string working.","code":"library(calmr) #> #> Attaching package: 'calmr' #> The following object is masked from 'package:base': #> #> parse my_blocking <- data.frame( Group = c(\"Exp\", \"Control\"), Phase1 = c(\"10A(US)\", \"10C(US)\"), R1 = c(FALSE, FALSE), Phase2 = c(\"10AB(US)\", \"10AB(US)\"), R2 = c(FALSE, FALSE), Test = c(\"1#A/1#B\", \"1#A/1#B\"), R3 = c(FALSE, FALSE) ) # parsing the design and showing the original and what was detected parsed <- parse_design(my_blocking) parsed #> CalmrDesign built from data.frame: #> Group Phase1 R1 Phase2 R2 Test R3 #> 1 Exp 10A(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> 2 Control 10C(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 Exp Phase1 A(US) 10 FALSE A;US #> 2 Exp Phase2 AB(US) 10 FALSE A;B;US #> 3 Exp Test #A 1 TRUE A #> 4 Exp Test #B 1 TRUE B #> 5 Control Phase1 C(US) 10 FALSE C;US #> 6 Control Phase2 AB(US) 10 FALSE A;B;US #> 7 Control Test #A 1 TRUE A #> 8 Control Test #B 1 TRUE B # not specifying the number of AB trials. Error! phase_parser(\"AB/10AC\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # putting the probe symbol out of order. Error! phase_parser(\"#10A\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # considering a configural cue for elements AB trial <- phase_parser(\"10AB(AB)(US)\") # different USs trial <- phase_parser(\"10A(US1)/10B(US2)\") # tons of information! Phase parser is meant for internal use only. # you are better of using `parse_design()` on a design `data.frame` str(trial) #> List of 2 #> $ trial_info :List of 2 #> ..$ 10A(US1):List of 8 #> .. ..$ name : chr \"A(US1)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"A(US1)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ functionals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ all_nominals : chr [1:2] \"A\" \"US1\" #> .. ..$ all_functionals: chr [1:2] \"A\" \"US1\" #> ..$ 10B(US2):List of 8 #> .. ..$ name : chr \"B(US2)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"B(US2)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ functionals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ all_nominals : chr [1:2] \"B\" \"US2\" #> .. ..$ all_functionals: chr [1:2] \"B\" \"US2\" #> $ general_info:List of 5 #> ..$ trial_names : chr [1:2] \"A(US1)\" \"B(US2)\" #> ..$ trial_repeats: num [1:2] 10 10 #> ..$ is_test : logi [1:2] FALSE FALSE #> ..$ nomi2func : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> ..$ func2nomi : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\""},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"the-parameters-list","dir":"Articles","previous_headings":"","what":"The parameters list","title":"Getting started with calmr","text":"Now need pick model parameters. get models currently supported calmr, can call supported_models(). choosing model, can get default parameters design get_parameters(). reference model parametrized, check model’s reference page. example, reference page “RW1972” model . , many equations tire eyes, can consult model parameter reference.","code":"supported_models() #> [1] \"HDI2020\" \"HD2022\" \"RW1972\" \"MAC1975\" \"PKH1982\" \"SM2007\" \"RAND\" #> [8] \"ANCCR\" \"TD\" my_pars <- get_parameters(my_blocking, model = \"RW1972\") # Increasing the beta parameter for US presentations my_pars$betas_on[\"US\"] <- .6 my_pars #> $alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $betas_on #> A B C US #> 0.4 0.4 0.4 0.6 #> #> $betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $lambdas #> A B C US #> 1 1 1 1"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"simulating","dir":"Articles","previous_headings":"The parameters list","what":"Simulating","title":"Getting started with calmr","text":", can run simulation using run_experiment() function. function also takes extra arguments manipulate number iterations run experiment (important designs randomized trials), whether organize trials miniblocks, extra configuration complex models (see help page make_experiment() additional details). , keep simple run experiment single iteration. advanced R user able dig data straight away. However, package also includes methods get quick look results.","code":"my_experiment <- run_experiment( my_blocking, # note we do not need to pass the parsed design model = \"RW1972\", parameters = my_pars ) # returns a `CalmrExperiment` object class(my_experiment) #> [1] \"CalmrExperiment\" #> attr(,\"package\") #> [1] \"calmr\" # CalmrExperiment is an S4 class, so it has slots slotNames(my_experiment) #> [1] \"design\" \"model\" \"groups\" \"parameters\" \"timings\" #> [6] \"experiences\" \"results\" \".model\" \".group\" \".iter\" # some of the experience given to group Exp on the first (and only) iteration head(my_experiment@experiences[[1]]) #> model group phase tp tn is_test block_size trial #> 1 RW1972 Exp Phase1 1 A(US) FALSE 1 1 #> 2 RW1972 Exp Phase1 1 A(US) FALSE 1 2 #> 3 RW1972 Exp Phase1 1 A(US) FALSE 1 3 #> 4 RW1972 Exp Phase1 1 A(US) FALSE 1 4 #> 5 RW1972 Exp Phase1 1 A(US) FALSE 1 5 #> 6 RW1972 Exp Phase1 1 A(US) FALSE 1 6 # the number of times we ran the model (groups x iterations) length(experiences(my_experiment)) #> [1] 2 # an experiment has results with different levels of aggregation class(my_experiment@results) #> [1] \"CalmrExperimentResult\" #> attr(,\"package\") #> [1] \"calmr\" slotNames(my_experiment@results) #> [1] \"aggregated_results\" \"parsed_results\" \"raw_results\" # shorthand method to access aggregated_results results(my_experiment) #> $associations #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0.0000000 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0.0000000 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0.0000000 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0.0000000 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0.0000000 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0.9939534 RW1972 #> 701: Control Test #B 22 2 US A 0.4999999 RW1972 #> 702: Control Test #B 22 2 US B 0.4999999 RW1972 #> 703: Control Test #B 22 2 US C 0.6626356 RW1972 #> 704: Control Test #B 22 2 US US 0.0000000 RW1972 #> #> $responses #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0 RW1972 #> 701: Control Test #B 22 2 US A 0 RW1972 #> 702: Control Test #B 22 2 US B 0 RW1972 #> 703: Control Test #B 22 2 US C 0 RW1972 #> 704: Control Test #B 22 2 US US 0 RW1972"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"plotting","dir":"Articles","previous_headings":"","what":"Plotting","title":"Getting started with calmr","text":"Let’s use plot method create plots. model supports different types plots according results can produce (e.g., associations, responses, saliences, etc.) case, RW model supports associations (associations) responses (responses).","code":"# get all the plots for the experiment plots <- plot(my_experiment) names(plots) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" #> [3] \"Exp - Response Strength (RW1972)\" #> [4] \"Control - Response Strength (RW1972)\" # or get a specific type of plot specific_plot <- plot(my_experiment, type = \"associations\") names(specific_plot) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" # show which plots are supported by the model we are using supported_plots(\"RW1972\") #> [1] \"associations\" \"responses\""},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"stimulus-associations","dir":"Articles","previous_headings":"Plotting","what":"Stimulus associations","title":"Getting started with calmr","text":"columns plots phases design rows denote source association. colors within panel determine target association. example, associations towards US shown yellow.","code":"plot(my_experiment, type = \"associations\") #> $`Exp - Association Strength (RW1972)` #> #> $`Control - Association Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"responding","dir":"Articles","previous_headings":"Plotting","what":"Responding","title":"Getting started with calmr","text":"Fairly similar , responding function stimuli presented trial.","code":"plot(my_experiment, type = \"responses\") #> $`Exp - Response Strength (RW1972)` #> #> $`Control - Response Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"graphing","dir":"Articles","previous_headings":"","what":"Graphing","title":"Getting started with calmr","text":"can also take look state model’s associations point experiment, using graph method. graphs created using ggnetwork package.","code":"# some general options for ggnetwork my_graph_opts <- get_graph_opts(\"small\") # passing the argument t to specify the trial we're interested in. # end of acquisition patch_graphs(graph(my_experiment, t = 10, options = my_graph_opts)) # end of blocking patch_graphs(graph(my_experiment, t = 20, options = my_graph_opts))"},{"path":"https://victornavarro.org/calmr/articles/calmr.html","id":"final-thoughts","dir":"Articles","previous_headings":"","what":"Final thoughts","title":"Getting started with calmr","text":"design philosophy behind calmr package revolves around simplicity ease access. user needs specify design well model generate model predictions. fact, also app lets users access basic package functionality using GUI. said, package plenty features advanced R users. ’re one , make sure check vignettes ready.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"using-the-calmr-app","dir":"Articles","previous_headings":"","what":"Using the calmr app","title":"calmr_app","text":"want deal programming side calmr simply want simulate experimental design see model , might interested using calmr application. calmr application offers GUI allows simulate experiments without writing code. want use online app, can find https://victor-navarro.shinyapps.io/calmr_app/. Alternatively, can install calmr.app companion package launch app via calmr.app::launch_app(). rest tutorial assumes app open ready run. Let’s break GUI.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"design-table","dir":"Articles","previous_headings":"The GUI","what":"Design Table","title":"calmr_app","text":"design table specify experimental design run. Using Group- Group+, can remove add groups design. Using Phase- Phase+, can remove add phases design. Parse Design button used parse design, required step run simulation. later. P1 P2 columns specify phases experiment simulated left right. entry columns specifies trials given corresponding groups (G1 G2, case). entries must obey special syntax (see calmr_basics additional information). now, suffice say : number trials specified via digits left trial. example, 10A(US) specifies ten “(US)” trials. Stimuli (elements) specified letters. example, 10AB(US) specifies elements B US. Named stimuli specified within parentheses. example, (US) implies element named “US” instead compound containing elements “U” “S”. Multiple trials per phase separated via forward slash (/). Additionally, one can choose randomize trials within phase ticking boxes R1 R2 columns. important note whatever set interact “Create trial blocks” option Options tab sidebar (see ahead). ’s full breakdown combinations behavior: Table checked preferences checked: Trials shuffled within blocks possible (based greater common factor). example, 2A/2B gets shuffled 2 blocks containing one one B trial, 2A/1B gets shuffled 1 block containing two trials one B trial. Table unchecked preferences checked: Trials deterministically intermixed within blocks possible. example, 2A/2B gets shuffled 2 blocks, resulting sequence ABAB. Table checked preferences unchecked: Trials shuffled completely random. Table unchecked preferences unchecked: Trials given order appearance. example, 2A/2B results AABB sequence. Go ahead parse design. new things appear GUI.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"parameters","dir":"Articles","previous_headings":"The GUI","what":"Parameters","title":"calmr_app","text":"parsing valid design, can set parameters experiment. number parameters change function model. case, Rescorla-Wagner model 4 parameters per stimulus. default values fairly sensible, can modify parameter hand favorite spreadsheet software. parameterization model calmr can sometimes differ appears literature. following table contains links documentation pages model (warning: equations).","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"results","dir":"Articles","previous_headings":"The GUI","what":"Results","title":"calmr_app","text":"new button appear parsing experiment. final click button run model populate “Results” “Association Graphs” portions app. Go ahead run experiment. new button allow download results spreadsheet. calmr app, results shown visually. Clicking bar graph (one containing “Blocking - Response Strength …” ) show plots available. first portion plot’s name denotes group’s name. , plot shows strength associations among stimuli experiment across trials (blocks), faceted phases columns, origin stimuli rows. example, yellow lines denote strength B US. top column corresponds (look label right) middle column corresponds B. Go ahead explore available plots. usually self-explanatory, consult documentation package case something unclear (especially using obscure models).","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"association-graphs","dir":"Articles","previous_headings":"The GUI","what":"Association Graphs","title":"calmr_app","text":"bottom portion app shows network graphs depicting strength associations model given trial, groups. Yellow denotes excitatory strength (.e., positive values), gray denotes neutral strength (.e., values close zero), purple (shown ) shows inhibitory strength (.e., negative values). Move “Trial” slider explore associations model change across experiment.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"other-bits","dir":"Articles","previous_headings":"The GUI","what":"Other bits","title":"calmr_app","text":"sections implement bulk functionalities calmr app. following sections describe additional options found useful.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"options","dir":"Articles","previous_headings":"The GUI > Other bits","what":"Options","title":"calmr_app","text":"set number iterations run experiment (important model behavior sensitive trial order effects), whether want create trial blocks. also set can choose plot common scale y-axis (active default).","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_app.html","id":"a-final-message","dir":"Articles","previous_headings":"The GUI","what":"A final message","title":"calmr_app","text":"Hope enjoy app! find bugs, comments, like something implemented, feel free post message package’s Github repository drop line navarrov [] cardiff.ac.uk.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"your-first-simulation","dir":"Articles","previous_headings":"","what":"Your first simulation","title":"calmr_basics","text":"perform first simulation need: data.frame specifying experiment design, list parameters model using.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"the-design-data-frame","dir":"Articles","previous_headings":"","what":"The design data.frame","title":"calmr_basics","text":"Let’s specify blocking design. rules design data.frame: row represents group. first column contains group labels. remaining columns organized pairs (trials phase, whether randomize ) trials phase column specified using rigid notation. observations : Trials preceded number. number represents number times trial given phase. “10A(US)” means “(US)” trial given 10 times. presence absence unconditioned stimulus denoted traditional “+” “-” symbols. Instead, use parenthesis denote “complex” stimuli. can thought element complex name (.e., one character). , “(US)” specifies single element represent US. vein, multiple characters parentheses denote individual elements. example, “AB” implies presence two stimuli, B. “/” character used trial separator (imply randomization ). Thus, “1A/1B” specifies single “” trial single “B” trial given phase. Recall randomization trials within phase specified column (, R1, R2, R3). “#” character used denote probe trials. contrast real life, probe trials entail update model’s associations. , probe trials can used track development key associations, repercussion model learns normal training trials. want check whether phase string work package, can use phase_parser(). function returns list lot information, let’s print fields.","code":"library(calmr) my_blocking <- data.frame( Group = c(\"Exp\", \"Control\"), Phase1 = c(\"10A(US)\", \"10C(US)\"), R1 = c(FALSE, FALSE), Phase2 = c(\"10AB(US)\", \"10AB(US)\"), R2 = c(FALSE, FALSE), Test = c(\"1#A/1#B\", \"1#A/1#B\"), R3 = c(FALSE, FALSE) ) # parsing the design and showing the original and what was detected parsed <- parse_design(my_blocking) parsed # not specifying the number of AB trials. Error! phase_parser(\"AB/10AC\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # putting the probe symbol out of order. Error! phase_parser(\"#10A\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # considering a configural cue for elements AB trial <- phase_parser(\"10AB(AB)(US)\") # different USs trial <- phase_parser(\"10A(US1)/10B(US2)\") # tons of information! Phase parser is meant for internal use only. # you are better of using `parse_design()` on a design `data.frame` str(trial) #> List of 2 #> $ trial_info :List of 2 #> ..$ 10A(US1):List of 8 #> .. ..$ name : chr \"A(US1)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"A(US1)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ functionals :List of 1 #> .. .. ..$ A(US1): chr [1:2] \"A\" \"US1\" #> .. ..$ all_nominals : chr [1:2] \"A\" \"US1\" #> .. ..$ all_functionals: chr [1:2] \"A\" \"US1\" #> ..$ 10B(US2):List of 8 #> .. ..$ name : chr \"B(US2)\" #> .. ..$ repetitions : num 10 #> .. ..$ is_test : logi FALSE #> .. ..$ periods : chr \"B(US2)\" #> .. ..$ nominals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ functionals :List of 1 #> .. .. ..$ B(US2): chr [1:2] \"B\" \"US2\" #> .. ..$ all_nominals : chr [1:2] \"B\" \"US2\" #> .. ..$ all_functionals: chr [1:2] \"B\" \"US2\" #> $ general_info:List of 5 #> ..$ trial_names : chr [1:2] \"A(US1)\" \"B(US2)\" #> ..$ trial_repeats: num [1:2] 10 10 #> ..$ is_test : logi [1:2] FALSE FALSE #> ..$ nomi2func : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> ..$ func2nomi : Named chr [1:4] \"A\" \"US1\" \"B\" \"US2\" #> .. ..- attr(*, \"names\")= chr [1:4] \"A\" \"US1\" \"B\" \"US2\""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"the-parameters-list","dir":"Articles","previous_headings":"","what":"The parameters list","title":"calmr_basics","text":"Now need pick model parameters. get models currently supported calmr, can call supported_models(). choosing model, can get default parameters design get_parameters().","code":"supported_models() #> [1] \"HDI2020\" \"HD2022\" \"RW1972\" \"MAC1975\" \"PKH1982\" \"SM2007\" \"RAND\" #> [8] \"ANCCR\" \"TD\" my_pars <- get_parameters(my_blocking, model = \"RW1972\") # Increasing the beta parameter for US presentations my_pars$betas_on[\"US\"] <- .6 my_pars #> $alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $betas_on #> A B C US #> 0.4 0.4 0.4 0.6 #> #> $betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $lambdas #> A B C US #> 1 1 1 1"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"simulating","dir":"Articles","previous_headings":"The parameters list","what":"Simulating","title":"calmr_basics","text":", can run simulation using run_experiment() function. function also takes extra arguments manipulate number iterations run experiment , whether organize trials miniblocks (see help page make_experiment() additional details). , run experiment 5 iterations. advanced R user able dig data straight away. However, package also includes methods get quick look results.","code":"my_experiment <- run_experiment( my_blocking, # note we do not need to pass the parsed design model = \"RW1972\", parameters = my_pars, iterations = 5 ) # returns a `CalmrExperiment` object class(my_experiment) #> [1] \"CalmrExperiment\" #> attr(,\"package\") #> [1] \"calmr\" # CalmrExperiment is an S4 class, so it has slots slotNames(my_experiment) #> [1] \"design\" \"model\" \"groups\" \"parameters\" \"timings\" #> [6] \"experiences\" \"results\" \".model\" \".group\" \".iter\" # the experience given to group Exp on the first iteration my_experiment@experiences[[1]] #> model group phase tp tn is_test block_size trial #> 1 RW1972 Exp Phase1 1 A(US) FALSE 1 1 #> 2 RW1972 Exp Phase1 1 A(US) FALSE 1 2 #> 3 RW1972 Exp Phase1 1 A(US) FALSE 1 3 #> 4 RW1972 Exp Phase1 1 A(US) FALSE 1 4 #> 5 RW1972 Exp Phase1 1 A(US) FALSE 1 5 #> 6 RW1972 Exp Phase1 1 A(US) FALSE 1 6 #> 7 RW1972 Exp Phase1 1 A(US) FALSE 1 7 #> 8 RW1972 Exp Phase1 1 A(US) FALSE 1 8 #> 9 RW1972 Exp Phase1 1 A(US) FALSE 1 9 #> 10 RW1972 Exp Phase1 1 A(US) FALSE 1 10 #> 11 RW1972 Exp Phase2 2 AB(US) FALSE 1 11 #> 12 RW1972 Exp Phase2 2 AB(US) FALSE 1 12 #> 13 RW1972 Exp Phase2 2 AB(US) FALSE 1 13 #> 14 RW1972 Exp Phase2 2 AB(US) FALSE 1 14 #> 15 RW1972 Exp Phase2 2 AB(US) FALSE 1 15 #> 16 RW1972 Exp Phase2 2 AB(US) FALSE 1 16 #> 17 RW1972 Exp Phase2 2 AB(US) FALSE 1 17 #> 18 RW1972 Exp Phase2 2 AB(US) FALSE 1 18 #> 19 RW1972 Exp Phase2 2 AB(US) FALSE 1 19 #> 20 RW1972 Exp Phase2 2 AB(US) FALSE 1 20 #> 21 RW1972 Exp Test 3 #A TRUE 2 21 #> 22 RW1972 Exp Test 4 #B TRUE 2 22 # the number of times we ran the model (groups x iterations) length(experiences(my_experiment)) #> [1] 10 # an experiment has results with different levels of aggregation class(my_experiment@results) #> [1] \"CalmrExperimentResult\" #> attr(,\"package\") #> [1] \"calmr\" slotNames(my_experiment@results) #> [1] \"aggregated_results\" \"parsed_results\" \"raw_results\" # shorthand method to access aggregated_results results(my_experiment) #> $associations #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0.0000000 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0.0000000 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0.0000000 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0.0000000 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0.0000000 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0.9939534 RW1972 #> 701: Control Test #B 22 2 US A 0.4999999 RW1972 #> 702: Control Test #B 22 2 US B 0.4999999 RW1972 #> 703: Control Test #B 22 2 US C 0.6626356 RW1972 #> 704: Control Test #B 22 2 US US 0.0000000 RW1972 #> #> $responses #> group phase trial_type trial block_size s1 s2 value model #> 1: Exp Phase1 A(US) 1 1 A A 0 RW1972 #> 2: Exp Phase1 A(US) 1 1 A B 0 RW1972 #> 3: Exp Phase1 A(US) 1 1 A C 0 RW1972 #> 4: Exp Phase1 A(US) 1 1 A US 0 RW1972 #> 5: Exp Phase1 A(US) 1 1 B A 0 RW1972 #> --- #> 700: Control Test #B 22 2 C US 0 RW1972 #> 701: Control Test #B 22 2 US A 0 RW1972 #> 702: Control Test #B 22 2 US B 0 RW1972 #> 703: Control Test #B 22 2 US C 0 RW1972 #> 704: Control Test #B 22 2 US US 0 RW1972"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"plotting","dir":"Articles","previous_headings":"","what":"Plotting","title":"calmr_basics","text":"Let’s use plot method create plots. model supports different types plots according results can produce (e.g., associations, responses, saliences, etc.) case, RW model supports associations (associations) responses (responses).","code":"# get all the plots for the experiment plots <- plot(my_experiment) names(plots) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" #> [3] \"Exp - Response Strength (RW1972)\" #> [4] \"Control - Response Strength (RW1972)\" # or get a specific type of plot specific_plot <- plot(my_experiment, type = \"associations\") names(specific_plot) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" # show which plots are supported by the model we are using supported_plots(\"RW1972\") #> [1] \"associations\" \"responses\""},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"stimulus-associations","dir":"Articles","previous_headings":"Plotting","what":"Stimulus associations","title":"calmr_basics","text":"columns plots phases design rows denote source association. colors within panel determine target association.","code":"plot(my_experiment, type = \"associations\") #> $`Exp - Association Strength (RW1972)` #> #> $`Control - Association Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"responding","dir":"Articles","previous_headings":"Plotting","what":"Responding","title":"calmr_basics","text":"Fairly similar , responding function stimuli presented trial.","code":"plot(my_experiment, type = \"responses\") #> $`Exp - Response Strength (RW1972)` #> #> $`Control - Response Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"graphing","dir":"Articles","previous_headings":"","what":"Graphing","title":"calmr_basics","text":"can also take look state model’s associations point training, using graph method experiment.","code":"my_graph_opts <- get_graph_opts(\"small\") # passing the argument t to specify the trial we're interested in. # end of acquisition patch_graphs(graph(my_experiment, t = 10, options = my_graph_opts)) # end of blocking patch_graphs(graph(my_experiment, t = 20, options = my_graph_opts))"},{"path":"https://victornavarro.org/calmr/articles/calmr_basics.html","id":"final-thoughts","dir":"Articles","previous_headings":"","what":"Final thoughts","title":"calmr_basics","text":"calmr package designed simulate quickly: specify design, parameters, get glance model predictions. However, package also additional features advanced R users. ’re one , make sure check vignettes ready.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"fitting-heidi-to-empirical-data","dir":"Articles","previous_headings":"","what":"Fitting HeiDI to empirical data","title":"calmr_fits","text":"demo, fit HeiDI empirical data (Patitucci et al., 2016, Experiment 1). involve writing function produces model responses organized empirical data, can use function maximum likelihood estimation (MLE). begin short overview data, move model function, finally fit.","code":""},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"the-data","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"The data","title":"calmr_fits","text":"data (pati) contains responses (lever presses lp, nose pokes np) 32 rats, across 6 blocks training (2 sessions per block). animals trained associate two levers two different food rewards (pellets sucrose). Let’s glance. thicker lines group averages; rest individual subjects. ignore specific mapping levers USs counterbalanced across subjects. However, ignore counterbalancing writing model function (see ahead).","code":"summary(pati) #> subject block lever us response #> 1 : 24 Min. :1.0 B: 0 Length:768 lp:384 #> 2 : 24 1st Qu.:2.0 L:384 Class :character np:384 #> 3 : 24 Median :3.5 R:384 Mode :character #> 4 : 24 Mean :3.5 #> 5 : 24 3rd Qu.:5.0 #> 6 : 24 Max. :6.0 #> (Other):624 #> rpert #> Min. :0.0000 #> 1st Qu.:0.9437 #> Median :2.2500 #> Mean :2.4806 #> 3rd Qu.:3.8000 #> Max. :8.4500 #> pati |> ggplot(aes(x = block, y = rpert, colour = us)) + geom_line(aes(group = interaction(us, subject)), alpha = .3) + stat_summary(geom = \"line\", fun = \"mean\", linewidth = 1) + labs(x = \"Block\", y = \"Responses per trial\", colour = \"US\") + facet_grid(~response)"},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"writing-the-model-function","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Writing the model function","title":"calmr_fits","text":"biggest hurdle fitting model empirical data write function , given vector parameters experiment, generates responses organized empirical data. Let’s begin summarizing data first, know aim . design? experiment presented Patitucci et al. (2016) fairly simple, can reduced presentations two levers, followed different appetitive outcome. , assume two outcomes independent . also take liberties number trials specify reduce computing time. beware: HeiDI, like many learning models, sensitive order effects. want model misfit data happened run simulations unlucky run trials. arguments prepare must reflect behavior model “general” experimental procedure, , address issue running several iterations experiment (random order trials) averaging experiments evaluating likelihood parameters. mind, now prepare experiment pass run_experiment(). Note specified two counterbalancings groups. must reproduce counterbalancings data trying fit close possible. Otherwise, optimization process might latch onto experimentally-irrelevant variables. example, can seen pati lever pressing whenever lever paired pellets. didn’t counterbalance identities levers food rewards, optimization might result one levers less salient ! can now begin write model function. First, good see results run_experiment() returns. Although results() returns many model outputs, said earlier, care one : responses (model responses). , can write model function. Let’s dissect function three parts. get parameters experiment, via parameters() method store new_parameters.1 put pars (parameters provided optimizer) alphas new_parameters. run experiment store exp_res. select model responses (responses) model results store responses. Lastly. summarise model responses return .2 ’s lot digest, let’s see function action. Just numbers! order empirical data model responses must match. emphasize point enough: nothing within fit function checks reorders data . sole responsible making sure pieces data order. simple way print model results return compare data. ’s reason full parameter function definition. made sure everything looking good, can fit model.","code":"pati_summ <- setDT(pati)[, list(\"rpert\" = mean(rpert)), by = c(\"block\",\"us\",\"response\") ] # set order (relevant for the future) setorder(pati_summ, block, response, us) head(pati_summ) #> block us response rpert #> 1: 1 P lp 0.8195313 #> 2: 1 S lp 0.5609375 #> 3: 1 P np 3.4109375 #> 4: 1 S np 3.2796875 #> 5: 2 P lp 1.5738281 #> 6: 2 S lp 0.6406250 # The design data.frame des_df <- data.frame( group = c(\"CB1\", \"CB2\"), training = c( \"12L>(Pellet)/12R>(Sucrose)/12#L/12#R\", \"12L>(Sucrose)/12R>(Pellet)/12#L/12#R\" ), rand_train = FALSE ) # The parameters # the actual parameter values don't matter, # as our function will re-write them inside the optimizer call parameters <- get_parameters(des_df, model = \"HD2022\" ) # The arguments experiment <- make_experiment(des_df, parameters = parameters, model = \"HD2022\", iterations = 4 ) experiment exp_res <- run_experiment(experiment) results(exp_res) #> $activations #> group phase trial_type trial block_size s1 value model #> 1: CB1 training L>(Pellet) 1 4 L 0.4000000 HD2022 #> 2: CB1 training R>(Sucrose) 2 4 L 0.0000000 HD2022 #> 3: CB1 training #L 3 4 L 0.4000000 HD2022 #> 4: CB1 training #R 4 4 L 0.0000000 HD2022 #> 5: CB1 training L>(Pellet) 5 4 L 0.4000000 HD2022 #> --- #> 380: CB2 training #R 44 4 Sucrose 0.0000000 HD2022 #> 381: CB2 training L>(Sucrose) 45 4 Sucrose 0.4000000 HD2022 #> 382: CB2 training R>(Pellet) 46 4 Sucrose 0.0000000 HD2022 #> 383: CB2 training #L 47 4 Sucrose 0.3991293 HD2022 #> 384: CB2 training #R 48 4 Sucrose 0.0000000 HD2022 #> #> $associations #> group phase trial_type trial block_size s1 s2 value #> 1: CB1 training L>(Pellet) 1 4 L L 0.0000000 #> 2: CB1 training L>(Pellet) 1 4 L Pellet 0.0000000 #> 3: CB1 training L>(Pellet) 1 4 L R 0.0000000 #> 4: CB1 training L>(Pellet) 1 4 L Sucrose 0.0000000 #> 5: CB1 training L>(Pellet) 1 4 Pellet L 0.0000000 #> --- #> 1532: CB2 training #R 48 4 R Sucrose 0.0000000 #> 1533: CB2 training #R 48 4 Sucrose L 0.3991293 #> 1534: CB2 training #R 48 4 Sucrose Pellet 0.0000000 #> 1535: CB2 training #R 48 4 Sucrose R 0.0000000 #> 1536: CB2 training #R 48 4 Sucrose Sucrose 0.0000000 #> model #> 1: HD2022 #> 2: HD2022 #> 3: HD2022 #> 4: HD2022 #> 5: HD2022 #> --- #> 1532: HD2022 #> 1533: HD2022 #> 1534: HD2022 #> 1535: HD2022 #> 1536: HD2022 #> #> $pools #> group phase trial_type trial block_size s1 s2 type #> 1: CB1 training L>(Pellet) 1 4 L,Pellet L combvs #> 2: CB1 training L>(Pellet) 1 4 L,Pellet Pellet combvs #> 3: CB1 training L>(Pellet) 1 4 L,Pellet R combvs #> 4: CB1 training L>(Pellet) 1 4 L,Pellet Sucrose combvs #> 5: CB1 training R>(Sucrose) 2 4 R,Sucrose L combvs #> --- #> 764: CB2 training #L 47 4 L Sucrose chainvs #> 765: CB2 training #R 48 4 R L chainvs #> 766: CB2 training #R 48 4 R Pellet chainvs #> 767: CB2 training #R 48 4 R R chainvs #> 768: CB2 training #R 48 4 R Sucrose chainvs #> value model #> 1: 0 HD2022 #> 2: 0 HD2022 #> 3: 0 HD2022 #> 4: 0 HD2022 #> 5: 0 HD2022 #> --- #> 764: 0 HD2022 #> 765: 0 HD2022 #> 766: 0 HD2022 #> 767: 0 HD2022 #> 768: 0 HD2022 #> #> $responses #> group phase trial_type trial block_size s1 s2 value model #> 1: CB1 training L>(Pellet) 1 4 L L 0 HD2022 #> 2: CB1 training L>(Pellet) 1 4 L Pellet 0 HD2022 #> 3: CB1 training L>(Pellet) 1 4 L R 0 HD2022 #> 4: CB1 training L>(Pellet) 1 4 L Sucrose 0 HD2022 #> 5: CB1 training L>(Pellet) 1 4 Pellet L 0 HD2022 #> --- #> 1532: CB2 training #R 48 4 R Sucrose 0 HD2022 #> 1533: CB2 training #R 48 4 Sucrose L 0 HD2022 #> 1534: CB2 training #R 48 4 Sucrose Pellet 0 HD2022 #> 1535: CB2 training #R 48 4 Sucrose R 0 HD2022 #> 1536: CB2 training #R 48 4 Sucrose Sucrose 0 HD2022 my_model_function <- function(pars, exper, full = FALSE) { # extract the parameters from the model new_parameters <- parameters(exper)[[1]] # assign alphas new_parameters$alphas[] <- pars # reassign parameters to the experiment parameters(exper) <- new_parameters # note parameters method # running the model and selecting responses exp_res <- run_experiment(exper) # summarizing the model responses <- results(exp_res)$responses # calculate extra variables responses$response <- ifelse(responses$s1 %in% c(\"Pellet\", \"Sucrose\"), \"np\", \"lp\" ) responses$block <- ceiling(responses$trial / 8) # filtering # only probe trials responses <- responses[grepl(\"#\", trial_type)] # only available responses responses <- responses[s2 %in% c(\"Pellet\", \"Sucrose\") & (response == \"np\" | (response == \"lp\" & mapply(grepl, s1, trial_type)))] # aggregate responses <- responses[, list(value = mean(value)), by = c(\"block\",\"s2\",\"response\")] if (full) { return(responses) } responses$value } my_model_function(c(.1, .2, .4, .3), experiment) #> [1] 0.028557609 0.040188221 0.004008696 0.008429327 0.045573899 0.061933782 #> [7] 0.010480790 0.021230102 0.053426837 0.070862133 0.015100913 0.029677071 #> [13] 0.057584182 0.074995358 0.018328387 0.035165746 0.059994400 0.077081202 #> [19] 0.020711121 0.039013071 0.061492438 0.078227391 0.022547790 0.041891069 head(my_model_function(c(.1, .2, .4, .3), experiment, full = TRUE)) #> block s2 response value #> 1: 1 Pellet lp 0.028557609 #> 2: 1 Sucrose lp 0.040188221 #> 3: 1 Pellet np 0.004008696 #> 4: 1 Sucrose np 0.008429327 #> 5: 2 Pellet lp 0.045573899 #> 6: 2 Sucrose lp 0.061933782 head(pati_summ) #> block us response rpert #> 1: 1 P lp 0.8195313 #> 2: 1 S lp 0.5609375 #> 3: 1 P np 3.4109375 #> 4: 1 S np 3.2796875 #> 5: 2 P lp 1.5738281 #> 6: 2 S lp 0.6406250"},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"fitting-the-model","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Fitting the model","title":"calmr_fits","text":"fit models using fit_model() function. function requires 4 arguments: (empirical) data. model function. arguments run model function. optimizer options. done great job taking care first three, let’s tackle last. get_optimizer_opts() function returns many things: model_pars: name model parameters (name alpha stimulus). ll ul: lower upper limits parameter search. optimizer: numerical optimization technique wish use MLE estimation. family: family distribution assume model. practice, request used determine link function transform model responses, likelihood function used objective function. normal family nothing fancy model responses estimate extra parameter, scale, scales model responses scale empirical data. comes likelihood functions, family use normal density data model differences. family_pars: family-specific parameter estimated alongside salience parameters. verbose: Whether print parameters objective function values optimize. free modify ; just make sure structure list returned get_optimizer_opts() remains . can also pass extra parameters optimizer call using (e.g., par argument optim, parallel ga). , fit model parallel ga, 10 iterations. , can fit model! (patient following along) fit_model function returns lot information track put got . However, typing model console show MLE parameters obtained time negative log-likelihood, given data: ’s good , well model run parameters “visually” fit data? can obtain predictions model via predict function. looks pretty good! Save blatant misfits, course. Now know everything need fit calmr empirical data. Go forth!","code":"my_optimizer_opts <- get_optimizer_opts( model_pars = names(parameters$alphas), optimizer = \"ga\", ll = c(0, 0, 0, 0), ul = c(1, 1, 1, 1), family = \"normal\" ) my_optimizer_opts #> $model_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" #> #> $optimizer #> [1] \"ga\" #> #> $family #> [1] \"normal\" #> #> $family_pars #> [1] \"normal_scale\" #> #> $all_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" \"normal_scale\" #> #> $initial_pars #> [1] NA NA NA NA 1 #> #> $ll #> L Pellet R Sucrose normal_scale #> 0 0 0 0 0 #> #> $ul #> L Pellet R Sucrose normal_scale #> 1 1 1 1 100 #> #> $verbose #> [1] FALSE the_fit <- fit_model(pati_summ$rpert, model_function = my_model_function, exper = experiment, optimizer_options = my_optimizer_opts, maxiter = 10, parallel = TRUE ) the_fit # the BIC and AIC BIC(the_fit) #> [1] 102.484 AIC(the_fit) #> [1] 96.5937 pati_summ$prediction <- predict(the_fit, exper = experiment) pati_summ[, data := rpert][, rpert := NULL] pati_summ <- melt(pati_summ, measure.vars = c(\"prediction\", \"data\")) pati_summ |> ggplot(ggplot2::aes( x = block, y = value, colour = us, linetype = variable )) + geom_line() + theme_bw() + facet_grid(us ~ response)"},{"path":"https://victornavarro.org/calmr/articles/calmr_fits.html","id":"a-final-note","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data > Fitting the model","what":"A final note","title":"calmr_fits","text":"vignette pre-generated, don’t want user fit model time installation. try keep package develops, spot inconsistencies, please drop line.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"using-the-calm-app","dir":"Articles","previous_headings":"","what":"Using the calm app","title":"calm_app","text":"beginner useR simply want simulate experimental design see model , might interested using calm application. calm application offers GUI allows simulate experiments without writing code. want use online app, can find : https://victor-navarro.shinyapps.io/calm_app/. Alternatively, installed calm package, can launch app via calm::calm_app(). rest tutorial assumes app open ready run. Let’s break GUI.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"design-table","dir":"Articles","previous_headings":"The GUI","what":"Design Table","title":"calm_app","text":"design table specify experimental design run. Using Group- Group+, can remove add groups design. Using Phase- Phase+, can remove add phases design. Parse Design button used parse design, required step run simulation. later. P1 P2 columns specify phases experiment simulated left right. entry columns specifies trials given corresponding groups (G1 G2, case). entries must obey special syntax (see calm_basics additional information). now, suffice say : number trials specified via digits left trial. example, 10A(US) specifies ten “(US)” trials. Stimuli (elements) specified letters. example, 10AB(US) specifies elements B US. Named stimuli specified within parentheses. example, (US) implies element named “US” instead compound containing elements “U” “S”. Multiple trials per phase separated via forward slash (/). Additionally, one can choose randomize trials within phase ticking boxes R1 R2 columns. important note whatever user sets interact “Create trial blocks” option Options tab sidebar (see ahead). ’s full breakdown combinations behaviour: Table checked preferences checked: Trials shuffled within blocks possible (based greater common factor). example, 2A/2B gets shuffled 2 blocks containing one one B trial, 2A/1B gets shuffled 1 block containign two trials one B trial. Table unchecked preferences checked: Trials deterministically intermixed within blocks possible. example, 2A/2B gets shuffled 2 blocks, resulting sequence ABAB. Table checked preferences unchecked: Trials shuffled completely random. Table unchecked preferences unchecked: Trials given order appearance. example, 2A/2B results AABB sequence. Go ahead parse design. new things appear GUI.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"parameters","dir":"Articles","previous_headings":"The GUI","what":"Parameters","title":"calm_app","text":"parsing valid design. user can set parameters experiment (including stimulus-related global parameters). case, Rescorla-Wagner model 4 parameters per stimulus. default values fairly sensible, can modify parameter hand favorite spreadsheet software. parametrization model calm can sometimes differ appears literature. following table contains links documentation pages model.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"results","dir":"Articles","previous_headings":"The GUI","what":"Results","title":"calm_app","text":"new button appears parsing experiment. final click button run model populate “Results” “Association Graphs” portions app. Go ahead run experiment. , new button appear, allowing download results spreadsheet. calm app, results shown visually. Clicking bar graph (one containing “Blocking - Response Strength …” ) show plots available. first portion plot’s name denotes group’s name. , plot shows strength associations among stimuli experiment across trials (blocks), faceted phases columns, origin stimuli rows. example, yellow lines denote strength B US. top column corresponds (look label right) middle column corresponds B. Go ahead explore available plots. usually self explanatory, consult documentation package case something unclear (specially using obscure models).","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"association-graphs","dir":"Articles","previous_headings":"The GUI","what":"Association Graphs","title":"calm_app","text":"bottom portion app shows network graphs depicting strength associations model given trial, groups. Yellow denotes excitatory strength (.e., positive values), gray denotes neutral strength (.e., values close zero), purple (shown ) shows inhibitory strength (.e., negative values). Move “Trial” slider explore associations model change across experiment.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"other-bits","dir":"Articles","previous_headings":"The GUI","what":"Other bits","title":"calm_app","text":"sections implement bulk functionalities calm app. following sections describe additional options convenience functions found useful.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"options","dir":"Articles","previous_headings":"The GUI > Other bits","what":"Options","title":"calm_app","text":"set number iterations run experiment (important model behaviour sensitive trial order effects), whether want create trial blocks. also set can choose plot common scale y-axis (active default).","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_app.html","id":"a-final-message","dir":"Articles","previous_headings":"The GUI","what":"A final message","title":"calm_app","text":"Hope enjoy app! find bugs, comments, like something implemented, feel free post message package’s github repository drop line navarrov [] cardiff.ac.uk.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"your-first-simulation","dir":"Articles","previous_headings":"","what":"Your first simulation","title":"calm_basics","text":"perform first simulation need: data.frame specifiying experiment design, list parameters model ’ll using.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"the-design-data-frame","dir":"Articles","previous_headings":"","what":"The design data.frame","title":"calm_basics","text":"example use blocking design. rules design data.frame: row represents group. first column contains group labels. remaining columns organized pairs (trials phase, whether randomize ) trials phase column specified using rigid notation. observations : Trials preceded number. number represents number times trial given phase. “10A(US)” means “(US)” trial given 10 times. presence absence unconditioned stimulus denoted traditional “+” “-” symbols. Instead, use parenthesis denote “complex” stimuli. can thought element complex name (.e., one character). , “(US)” specifies single element represent US. vein, multiple characters parentheses denote individual elements. example, “AB” implies presence two stimuli, B. “/” character used trial separator (imply randomization ). Thus, “1A/1B” specifies single “” trial single “B” trial given phase. Recall randomization trials within phase specified column (, R1, R2, R3). “#” character used denote probe trials. contrast real life, probe trials entail update model’s associations. , probe trials can used track development key associations, repercussion model learns normal training trials. want check whether phase string work simulator, can use phase_parser. function returns list lot information, let’s print fields.","code":"library(calm) my_blocking <- data.frame( Group = c(\"Exp\", \"Control\"), Phase1 = c(\"10A(US)\", \"10C(US)\"), R1 = c(FALSE, FALSE), Phase2 = c(\"10AB(US)\", \"10AB(US)\"), R2 = c(FALSE, FALSE), Test = c(\"1#A/1#B\", \"1#A/1#B\"), R3 = c(FALSE, FALSE) ) # parsing the design and showing the original and what was detected parsed <- parse_design(my_blocking) parsed #> CalmDesign built from data.frame: #> Group Phase1 R1 Phase2 R2 Test R3 #> 1 Exp 10A(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> 2 Control 10C(US) FALSE 10AB(US) FALSE 1#A/1#B FALSE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 Exp Phase1 A(US) 10 FALSE A;US #> 2 Exp Phase2 AB(US) 10 FALSE A;B;US #> 3 Exp Test #A 1 TRUE A #> 4 Exp Test #B 1 TRUE B #> 5 Control Phase1 C(US) 10 FALSE C;US #> 6 Control Phase2 AB(US) 10 FALSE A;B;US #> 7 Control Test #A 1 TRUE A #> 8 Control Test #B 1 TRUE B # not specifying a number of AB trials. Error! phase_parser(\"AB/10AC\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # putting the probe symbol out of order. Error! phase_parser(\"#10A\") #> Error in if (is.na(treps)) 1 else treps: argument is of length zero # considering a configural cue for elements AB trial <- phase_parser(\"10AB(AB)(US)\") # different USs trial <- phase_parser(\"10A(US1)/10B(US2)\")"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"the-parameters-list","dir":"Articles","previous_headings":"","what":"The parameters list","title":"calm_basics","text":"Now need pick model parameters. get models currently supported calm, can call supported_models(). choosing model, can get default parameters design get_parameters.","code":"supported_models() #> [1] \"HDI2020\" \"HD2022\" \"RW1972\" \"MAC1975\" \"PKH1982\" \"SM2007\" \"RAND\" #> [8] \"ANCCR\" my_pars <- get_parameters(my_blocking, model = \"RW1972\") # Increasing the beta parameter for US presentations my_pars$betas_on[\"US\"] <- .6 my_pars #> $alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $betas_on #> A B C US #> 0.4 0.4 0.4 0.6 #> #> $betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $lambdas #> A B C US #> 1 1 1 1"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"simulating","dir":"Articles","previous_headings":"The parameters list","what":"Simulating","title":"calm_basics","text":", can run simulation using run_experiment function. function also takes extra arguments manipulate number iterations run experiment , whether organize trials miniblocks (see help(make_experiment) additional details). , run experiment 5 iterations. advanced R user able dig data straight away. However, package also includes methods get quick look results.","code":"my_experiment <- run_experiment( my_blocking, # note we do not need to pass the parsed design model = \"RW1972\", parameters = my_pars, iterations = 5 ) # returns an CalmExperiment object class(my_experiment) #> [1] \"CalmExperiment\" #> attr(,\"package\") #> [1] \"calm\" # CalmExperiment is an S4 class, so it has slots slotNames(my_experiment) #> [1] \"design\" \"model\" \"groups\" \"parameters\" \"experiences\" #> [6] \"results\" \".model\" \".group\" \".iter\" # the experience given to group Exp on the first iteration my_experiment@experiences[[1]] #> model group phase tp tn is_test block_size trial #> 1 RW1972 Exp Phase1 1 A(US) FALSE 1 1 #> 2 RW1972 Exp Phase1 1 A(US) FALSE 1 2 #> 3 RW1972 Exp Phase1 1 A(US) FALSE 1 3 #> 4 RW1972 Exp Phase1 1 A(US) FALSE 1 4 #> 5 RW1972 Exp Phase1 1 A(US) FALSE 1 5 #> 6 RW1972 Exp Phase1 1 A(US) FALSE 1 6 #> 7 RW1972 Exp Phase1 1 A(US) FALSE 1 7 #> 8 RW1972 Exp Phase1 1 A(US) FALSE 1 8 #> 9 RW1972 Exp Phase1 1 A(US) FALSE 1 9 #> 10 RW1972 Exp Phase1 1 A(US) FALSE 1 10 #> 11 RW1972 Exp Phase2 2 AB(US) FALSE 1 11 #> 12 RW1972 Exp Phase2 2 AB(US) FALSE 1 12 #> 13 RW1972 Exp Phase2 2 AB(US) FALSE 1 13 #> 14 RW1972 Exp Phase2 2 AB(US) FALSE 1 14 #> 15 RW1972 Exp Phase2 2 AB(US) FALSE 1 15 #> 16 RW1972 Exp Phase2 2 AB(US) FALSE 1 16 #> 17 RW1972 Exp Phase2 2 AB(US) FALSE 1 17 #> 18 RW1972 Exp Phase2 2 AB(US) FALSE 1 18 #> 19 RW1972 Exp Phase2 2 AB(US) FALSE 1 19 #> 20 RW1972 Exp Phase2 2 AB(US) FALSE 1 20 #> 21 RW1972 Exp Test 3 #A TRUE 2 21 #> 22 RW1972 Exp Test 4 #B TRUE 2 22 # the number of times we ran the model (groups x iterations) length(experiences(my_experiment)) #> [1] 10 # an experiment has results with different levels of aggregation class(my_experiment@results) #> [1] \"CalmExperimentResult\" #> attr(,\"package\") #> [1] \"calm\" slotNames(my_experiment@results) #> [1] \"aggregated_results\" \"parsed_results\" \"raw_results\" # shorthand method to access aggregated_results results(my_experiment) #> $rs #> group phase trial_type trial s1 s2 block_size value model #> 1: Exp Phase1 A(US) 1 A A 1 0 RW1972 #> 2: Exp Phase1 A(US) 1 A B 1 0 RW1972 #> 3: Exp Phase1 A(US) 1 A C 1 0 RW1972 #> 4: Exp Phase1 A(US) 1 A US 1 0 RW1972 #> 5: Exp Phase1 A(US) 1 B A 1 0 RW1972 #> --- #> 700: Control Test #B 22 C US 2 0 RW1972 #> 701: Control Test #B 22 US A 2 0 RW1972 #> 702: Control Test #B 22 US B 2 0 RW1972 #> 703: Control Test #B 22 US C 2 0 RW1972 #> 704: Control Test #B 22 US US 2 0 RW1972 #> #> $vs #> group phase trial_type trial s1 s2 block_size value model #> 1: Exp Phase1 A(US) 1 A A 1 0.0000000 RW1972 #> 2: Exp Phase1 A(US) 1 A B 1 0.0000000 RW1972 #> 3: Exp Phase1 A(US) 1 A C 1 0.0000000 RW1972 #> 4: Exp Phase1 A(US) 1 A US 1 0.0000000 RW1972 #> 5: Exp Phase1 A(US) 1 B A 1 0.0000000 RW1972 #> --- #> 700: Control Test #B 22 C US 2 0.9939534 RW1972 #> 701: Control Test #B 22 US A 2 0.4999999 RW1972 #> 702: Control Test #B 22 US B 2 0.4999999 RW1972 #> 703: Control Test #B 22 US C 2 0.6626356 RW1972 #> 704: Control Test #B 22 US US 2 0.0000000 RW1972"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"plotting","dir":"Articles","previous_headings":"","what":"Plotting","title":"calm_basics","text":"Let’s use plot method create plots. model supports different types plots according results can produce (e.g., associations, responses, saliences, etc.) case, RW model supports associations responses.","code":"# get all the plots for the experiment plots <- plot(my_experiment) names(plots) #> [1] \"Exp - Response Strength (RW1972)\" #> [2] \"Control - Response Strength (RW1972)\" #> [3] \"Exp - Association Strength (RW1972)\" #> [4] \"Control - Association Strength (RW1972)\" # or get a specific type of plot specific_plot <- plot(my_experiment, type = \"vs\") names(specific_plot) #> [1] \"Exp - Association Strength (RW1972)\" #> [2] \"Control - Association Strength (RW1972)\" # show which plots are supported by the model we are using supported_plots(\"RW1972\") #> [1] \"rs\" \"vs\""},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"stimulus-associations","dir":"Articles","previous_headings":"Plotting","what":"Stimulus associations","title":"calm_basics","text":"columns phases design rows denote source association. colors within panel determine target association.","code":"plot(my_experiment, type = \"vs\") #> $`Exp - Association Strength (RW1972)` #> #> $`Control - Association Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"responding","dir":"Articles","previous_headings":"Plotting","what":"Responding","title":"calm_basics","text":"Fairly similar , time responding function stimuli presented trial.","code":"plot(my_experiment, type = \"rs\") #> $`Exp - Response Strength (RW1972)` #> #> $`Control - Response Strength (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"graphing","dir":"Articles","previous_headings":"","what":"Graphing","title":"calm_basics","text":"can also take look state model’s associations point training, using graph method experiment.","code":"my_graph_opts <- get_graph_opts(\"small\") graph(my_experiment, t = 20, graph_opts = my_graph_opts) #> $RW1972 #> $RW1972$`Exp - Associations (RW1972)` #> #> $RW1972$`Control - Associations (RW1972)`"},{"path":"https://victornavarro.org/calmr/articles/calm_basics.html","id":"final-thoughts","dir":"Articles","previous_headings":"","what":"Final thoughts","title":"calm_basics","text":"calm package designed simulate quickly: write design get glance model predictions. Yet, package also features advanced R users, make sure check vignettes ready.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"fitting-heidi-to-empirical-data","dir":"Articles","previous_headings":"","what":"Fitting HeiDI to empirical data","title":"calm_fits","text":"demo, fit HeiDI empirical data (Patitucci et al., 2016, Experiment 1). involve writing function produces model responses organized empirical data, using function maximum likelihood estimation (MLE). begin short overview data, move model function, finally fit model.","code":""},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"the-data","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"The data","title":"calm_fits","text":"data (pati) contains responses (lever presses lp, nose pokes np) 32 subjects (rats) across 6 blocks training (2 sessions per block). animals trained associate two levers one two unconditioned stimuli (pellets sucrose). Let’s take look . thicker lines group averages; rest individual subjects. ignore specific mapping levers USs , counterbalanced across subjects. However, counterbalancing end relevant (see ahead).","code":"glimpse(pati) #> Rows: 768 #> Columns: 6 #> $ subject 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1… #> $ block 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3… #> $ lever L, L, L, L, L, L, R, R, R, R, R, R, L, L, L, L, L, L, R, R, R… #> $ us \"P\", \"P\", \"P\", \"P\", \"P\", \"P\", \"S\", \"S\", \"S\", \"S\", \"S\", \"S\", \"… #> $ response lp, lp, lp, lp, lp, lp, lp, lp, lp, lp, lp, lp, np, np, np, n… #> $ rpert 0.9000, 1.5500, 3.3500, 4.1500, 4.6500, 4.3250, 0.4000, 0.162… pati |> ggplot(aes(x = block, y = rpert, colour = us)) + geom_line(aes(group = interaction(us, subject)), alpha = .3) + stat_summary(geom = \"line\", fun = \"mean\", linewidth = 1) + labs(x = \"Block\", y = \"Responses per trial\", colour = \"US\") + facet_grid(~response)"},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"writing-the-model-function","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Writing the model function","title":"calm_fits","text":"biggest hurdle fitting model empirical data write function , given vector parameters model arguments, generates responses organized empirical data. Let’s begin summarizing group data first, know aim . now prepare arguments model function (pass run_experimentexperiment. minor issue HeiDI sensitive order effects. Hence, arguments prepare must reflect behavior model “general” experimental procedure, quirks unfortunate run trials. , simply address issue running several iterations model (random trial orders) averaging models evaluating likelihood parameters. design? experiment presented Patittuci et al. (2016) fairly simple, can reduced presentations two levers, followed different appetitive outcome. , assume two outcomes independent . also take liberties number trials specify, reduce computing time. Note specified two counterbalancings groups. must reproduce counterbalancings data trying fit close possible. Otherwise, optimization process might latch onto experimentally-irrelevant variables. example, can seen pati lever pressing whenever lever paired pellets. didn’t counterbalance identities levers USs, optimization might result one levers less salient . can now begin write model function. First, good see results run_experiment returns. Although run_experiment function returns S4 class many things, care one : rs (model responses). , can write model function. Let’s dissect function three parts. put parameters (optimizer parameters) experiment using parameters method. run model select relevant information (rs). summarise model responses return .1 Let’s see function action. order empirical data model responses must match. emphasize point enough: nothing within fit function checks reorders data . sole responsible making sure pieces data order. simple way print model results return (see ). made sure everything looking good, can fit model.","code":"pati_summ <- pati |> group_by(block, us, response) |> summarise(rpert = mean(rpert), .groups = \"drop\") head(pati_summ) #> # A tibble: 6 × 4 #> block us response rpert #> #> 1 1 P lp 0.820 #> 2 1 P np 3.41 #> 3 1 S lp 0.561 #> 4 1 S np 3.28 #> 5 2 P lp 1.57 #> 6 2 P np 3.51 # The design data.frame des_df <- data.frame( group = c(\"CB1\", \"CB2\"), training = c( \"12L>(Pellet)/12R>(Sucrose)\", \"12L>(Sucrose)/12R>(Pellet)\" ), rand_train = TRUE ) # The parameters # the actual parameter values don't matter, # as our function will re-write them inside the optimizer call parameters <- get_parameters(des_df, model = \"HD2022\" ) # The arguments experiment <- make_experiment(des_df, parameters = parameters, model = \"HD2022\", iterations = 4 ) exp_res <- run_experiment(experiment) results(exp_res) #> $as #> group phase trial_type trial s1 block_size value model #> 1: CB1 training L>(Pellet) 1 L 2 0.4 HD2022 #> 2: CB1 training R>(Sucrose) 2 L 2 0.0 HD2022 #> 3: CB1 training R>(Sucrose) 3 L 2 0.0 HD2022 #> 4: CB1 training L>(Pellet) 4 L 2 0.4 HD2022 #> 5: CB1 training R>(Sucrose) 5 L 2 0.0 HD2022 #> --- #> 340: CB2 training R>(Pellet) 10 Pellet 2 0.4 HD2022 #> 341: CB2 training L>(Sucrose) 9 R 2 0.0 HD2022 #> 342: CB2 training R>(Pellet) 10 R 2 0.4 HD2022 #> 343: CB2 training L>(Sucrose) 9 Sucrose 2 0.4 HD2022 #> 344: CB2 training R>(Pellet) 10 Sucrose 2 0.0 HD2022 #> #> $acts #> group phase trial_type trial s1 s2 block_size type value #> 1: CB1 training L>(Pellet) 1 LPellet L 2 combvs 0 #> 2: CB1 training L>(Pellet) 1 LPellet Pellet 2 combvs 0 #> 3: CB1 training L>(Pellet) 1 LPellet R 2 combvs 0 #> 4: CB1 training L>(Pellet) 1 LPellet Sucrose 2 combvs 0 #> 5: CB1 training R>(Sucrose) 2 LPellet L 2 combvs 0 #> --- #> 1268: CB2 training R>(Pellet) 10 L Sucrose 2 chainvs 0 #> 1269: CB2 training R>(Pellet) 10 Sucrose L 2 chainvs 0 #> 1270: CB2 training R>(Pellet) 10 Sucrose Pellet 2 chainvs 0 #> 1271: CB2 training R>(Pellet) 10 Sucrose R 2 chainvs 0 #> 1272: CB2 training R>(Pellet) 10 Sucrose Sucrose 2 chainvs 0 #> model #> 1: HD2022 #> 2: HD2022 #> 3: HD2022 #> 4: HD2022 #> 5: HD2022 #> --- #> 1268: HD2022 #> 1269: HD2022 #> 1270: HD2022 #> 1271: HD2022 #> 1272: HD2022 #> #> $rs #> group phase trial_type trial s1 s2 block_size value model #> 1: CB1 training L>(Pellet) 1 L L 2 0 HD2022 #> 2: CB1 training L>(Pellet) 1 L Pellet 2 0 HD2022 #> 3: CB1 training L>(Pellet) 1 L R 2 0 HD2022 #> 4: CB1 training L>(Pellet) 1 L Sucrose 2 0 HD2022 #> 5: CB1 training L>(Pellet) 1 Pellet L 2 0 HD2022 #> --- #> 1372: CB2 training R>(Pellet) 10 R Sucrose 2 0 HD2022 #> 1373: CB2 training R>(Pellet) 10 Sucrose L 2 0 HD2022 #> 1374: CB2 training R>(Pellet) 10 Sucrose Pellet 2 0 HD2022 #> 1375: CB2 training R>(Pellet) 10 Sucrose R 2 0 HD2022 #> 1376: CB2 training R>(Pellet) 10 Sucrose Sucrose 2 0 HD2022 #> #> $vs #> group phase trial_type trial s1 s2 block_size value #> 1: CB1 training L>(Pellet) 1 L L 2 0.000000 #> 2: CB1 training L>(Pellet) 1 L Pellet 2 0.000000 #> 3: CB1 training L>(Pellet) 1 L R 2 0.000000 #> 4: CB1 training L>(Pellet) 1 L Sucrose 2 0.000000 #> 5: CB1 training L>(Pellet) 1 Pellet L 2 0.000000 #> --- #> 1372: CB2 training R>(Pellet) 10 R Sucrose 2 0.000000 #> 1373: CB2 training R>(Pellet) 10 Sucrose L 2 0.368896 #> 1374: CB2 training R>(Pellet) 10 Sucrose Pellet 2 0.000000 #> 1375: CB2 training R>(Pellet) 10 Sucrose R 2 0.000000 #> 1376: CB2 training R>(Pellet) 10 Sucrose Sucrose 2 0.000000 #> model #> 1: HD2022 #> 2: HD2022 #> 3: HD2022 #> 4: HD2022 #> 5: HD2022 #> --- #> 1372: HD2022 #> 1373: HD2022 #> 1374: HD2022 #> 1375: HD2022 #> 1376: HD2022 my_model_function <- function(parameters, experiment) { # manipulating parameters new_parameters <- parameters(experiment)[[1]] new_parameters$alphas[] <- parameters parameters(experiment) <- new_parameters # note parameters method # running the model and selecting rs exp_res <- run_experiment(experiment) # summarizing the model rs <- results(exp_res)$rs |> filter(s2 %in% c(\"Pellet\", \"Sucrose\")) |> mutate( response = ifelse(s1 %in% c(\"Pellet\", \"Sucrose\"), \"np\", \"lp\"), block = ceiling(trial / 4) ) |> rowwise() |> # note this filter below; # we do not allow lever presses if the lever was not presented on the trial filter(response == \"np\" | (response == \"lp\" & grepl(s1, trial_type))) |> mutate(us = ifelse(grepl(\"Pellet\", trial_type), \"P\", \"S\")) |> group_by(block, us, response) |> summarise(value = mean(value), .groups = \"drop\") rs$value } my_model_function(c(.1, .2, .4, .3), experiment = experiment) #> [1] 0.009200000 0.003028571 0.012075000 0.005769643 0.027451634 0.010299086 #> [7] 0.046803321 0.021698787 0.048681560 0.016592848 0.052716098 0.029575459 #> [13] 0.050783660 0.019358818 0.066233126 0.036222556 0.055000834 0.021867550 #> [19] 0.070767634 0.040360835 0.057311961 0.023442829 0.073063348 0.042882258"},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"fitting-the-model","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data","what":"Fitting the model","title":"calm_fits","text":"fit models using fit_model function. function requires 4 arguments: (empirical) data model function arguments run model function. optimizer options. done great job taking care first three, let’s tackle last. get_optimizer_opts function returns many things: model_pars: name model parameters. , name alphas stimuli. ll ul: lower upper limits parameter search. Consider shrinking speed process. optimizer: numerical optimization technique wish use MLE estimation. family: family distribution assume model. practice, request used determine link function transform model responses, likelihood function used objective function. normal family nothing fancy model responses, estimate extra parameter, scale, scales model responses scale empirical data. comes likelihood functions, family use normal density data model differences. family_pars: family-specific parameter estimated alongside salience parameters. verbose: Whether print parameters objective function values optimize. free modify ; just make sure structure list returned get_optimizer_opts remains . can also pass extra parameters optimizer call using (e.g., par argument optim, parallel ga). , fit model parallel ga, 10 iterations. , can fit model! (patient following along) fit_model function returns lot information track put got . However, typing model console show MLE parameters obtained time negative log likelihood, given data: ’s good , well model run parameters “visually” fit data? can obtain predictions model via predict function. looks pretty good! Save blatant misfits, course. Now know everything need fit calm empirical data. Go forth!","code":"my_optimizer_opts <- get_optimizer_opts( model_pars = names(parameters$alphas), optimizer = \"ga\", ll = c(0, 0, 0, 0), ul = c(1, 1, 1, 1), family = \"normal\" ) my_optimizer_opts #> $model_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" #> #> $optimizer #> [1] \"ga\" #> #> $family #> [1] \"normal\" #> #> $family_pars #> [1] \"normal_scale\" #> #> $all_pars #> [1] \"L\" \"Pellet\" \"R\" \"Sucrose\" \"normal_scale\" #> #> $initial_pars #> [1] NA NA NA NA #> #> $ll #> L Pellet R Sucrose normal_scale #> 0 0 0 0 0 #> #> $ul #> L Pellet R Sucrose normal_scale #> 1 1 1 1 100 #> #> $verbose #> [1] FALSE the_fit <- fit_model(pati_summ$rpert, model_function = my_model_function, experiment = experiment, optimizer_options = my_optimizer_opts, maxiter = 10, parallel = TRUE ) the_fit #> Calm model fit: #> Parameters: #> L Pellet R Sucrose normal_scale #> 0.1576156 0.8031082 0.2654031 0.6415039 25.9897647 #> #> nLogLik: #> 38.61801 pati_summ$prediction <- predict(the_fit, experiment = experiment) pati_summ |> rename(\"data\" = \"rpert\") |> pivot_longer( cols = c(\"prediction\", \"data\"), names_to = \"type\", values_to = \"value\" ) |> ggplot(ggplot2::aes(x = block, y = value, colour = us, linetype = type)) + geom_line() + theme_bw() + facet_grid(us ~ response)"},{"path":"https://victornavarro.org/calmr/articles/calm_fits.html","id":"a-final-note","dir":"Articles","previous_headings":"Fitting HeiDI to empirical data > Fitting the model","what":"A final note","title":"calm_fits","text":"vignette pre-generated, don’t want user fit model time installation. try keep package develops, spot inconsistencies, please drop line.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"the-mathematics-behind-heidi","dir":"Articles","previous_headings":"","what":"The mathematics behind HeiDI","title":"HD2022","text":"HeiDI model four major components: 1) acquisition reciprocal associations stimuli, 2) pooling associations stimulus activations, 3) distribution activations stimulus-specific response units, 4) generation responses.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"acquiring-reciprocal-associations","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"1 - Acquiring reciprocal associations","title":"HD2022","text":"Whenever trial given, HeiDI learns associations among stimuli. association two stimuli, \\(\\) \\(j\\) denoted via \\(v_{,j}\\). association \\(v_{,j}\\) represents directional expectation: expectation \\(j\\) presented \\(\\). Furthermore, value represents nature effect \\(\\) representation \\(j\\). positive, presentation \\(\\) “excites” representation \\(j\\). negative, presentation \\(\\) “inhibits” representation \\(j\\). HeiDI learns “forward” associations stimuli, also reciprocal, “backward” associations. Thus, organisms presented \\(\\rightarrow j\\), organisms learn \\(v_{,j}\\), also \\(v_{j, }\\), expectation receiving \\(\\) presented \\(j\\). Note , sake brevity, learning equations specified forward associations.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"the-stimulus-expectation-rule","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 1 - Acquiring reciprocal associations","what":"1.1 - The stimulus expectation rule","title":"HD2022","text":"HeiDI generates expectations stimuli. expectation stimulus \\(j\\) (\\(e_j\\)) expressed \\[ \\tag{Eq. 1} e_j = \\sum_{k}^{K}x_kv_{k,j} \\] \\(K\\) set containing stimuli experiment, \\(x_k\\) quantity denoting presence absence stimulus \\(k\\) (1 0, respectively)1.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"learning-rule","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 1 - Acquiring reciprocal associations","what":"1.2 - Learning rule","title":"HD2022","text":"HeiDI learns appropriate expectations via error-correction mechanisms. trial \\(t\\), association stimuli \\(\\) \\(j\\) expressed \\[ \\tag{Eq. 2} v_{,j, t} = v_{,j, t-1} + \\Delta v_{,j, t} \\] \\(v_{j,, t-1}\\) forward association \\(\\) \\(j\\) trial \\(t-1\\), \\(\\Delta v_{,j, t}\\) change association result trial \\(t\\). delta term uses pooled error term expressed \\[ \\tag{Eq. 3} \\Delta v_{,j} = x_i\\alpha_i(x_jc\\alpha_j - e_j) \\] \\(\\alpha_i\\) \\(\\alpha_j\\) parameters representing salience stimuli \\(\\) \\(j\\), respectively (\\(0 \\le \\alpha \\le 1\\)), \\(c\\) scaling constant (\\(c = 1\\)). Note term denoting trial, \\(t\\) omitted simplicity.","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"pooling-the-strength-of-associations","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"2 - Pooling the strength of associations","title":"HD2022","text":"HeiDI pools stimulus associations activate stimulus-specific representations. activation representation stimulus \\(j\\), \\(a_j\\), defined : \\[ \\tag{Eq. 4} a_{j,M} = o_{j,M} + h_{j,M} \\] \\(o_{j,M}\\) denotes combined associative strength towards stimulus \\(j\\) presence stimuli \\(M\\), \\(h_{j,M}\\) denotes chained associative strength towards stimulus \\(j\\) presence stimuli \\(M\\).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"combined-associative-strength","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 2 - Pooling the strength of associations","what":"2.1 - Combined associative strength","title":"HD2022","text":"quantity \\(o_{j,M}\\) result combining associative strength forward backward associations stimulus \\(j\\) \\[ \\tag{Eq. 5} o_{j,M} = \\sum_{m \\neq j}^{M}v_{m,j} + \\left(\\frac{\\sum_{m \\neq j}^{M}v_{m,j} \\sum_{m \\neq j}^{M}v_{j,m}}{c}\\right) \\] sums run stimuli \\(M\\) presented trial, different stimulus \\(j\\).2 left-hand term describes forward associations stimuli \\(M\\) \\(j\\) affect representation \\(j\\), whereas right-hand term describes backward associations \\(j\\) stimuli \\(M\\) affect representation (although modulated forward associations ).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"chained-associative-strength","dir":"Articles","previous_headings":"The mathematics behind HeiDI > 2 - Pooling the strength of associations","what":"2.2 - Chained associative strength","title":"HD2022","text":"quantity \\(h_{j,M}\\) captures indirect associative strength stimuli \\(M\\) \\(j\\), via absent stimuli. , \\(h_{j,M}\\) defined \\[ \\tag{Eq. 6a} h_{j,M} = \\sum_{m \\neq j}^{M} \\sum_{n}^{N}\\frac{v_{m,n}o_{j,n}}{c} \\] N stimuli presented trial (.e., K-M). Note re-use \\(o\\), quantity defined Eq. 5. equation allows absent stimuli \\(N\\) influence representation stimulus \\(j\\), long association present stimuli \\(M\\). Honey Dwyer (2022), authors specify similarity-based mechanism modulates effect associative chains according similarity salience nominal retrieved stimuli3. , Eq. 6a expanded : \\[ \\tag{Eq. 6b} h_{j,M} = \\sum_{m \\neq j}^{M} \\sum_{n}^{N}S(\\alpha_{n}, \\alpha'_n)\\frac{v_{m,n}o_{j,n}}{c} \\] \\(S\\) similarity function takes nominal salience stimulus n, \\(\\alpha_n\\) (perceived \\(n\\) presented trial) retrieved salience, \\(\\alpha'_n\\) (perceived \\(n\\) retrieved via stimuli M, see ahead). function defined : \\[ \\tag{Eq. 7} S(\\alpha_n, \\alpha'_n) = \\frac{\\alpha_n}{\\alpha_n + |\\alpha_n-\\alpha'_n|} \\times \\frac{\\alpha'_n}{\\alpha'_n+ |\\alpha_n-\\alpha'_n|} \\] Notably, whenever one nominal salience given stimulus, \\(\\alpha_n\\) arithmetic mean among nominal values (see “heidi_similarity” vignette).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"distributing-strength-into-stimulus-specific-response-units","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"3 - Distributing strength into stimulus-specific response units","title":"HD2022","text":"HeiDI distributes pooled stimulus-specific strength among \\(K\\) stimuli, according relative salience. activation response unit \\(j\\), \\(R_j\\) expressed \\[ \\tag{Eq. 8} R_{j,k} = \\frac{\\theta(j)}{\\sum_{k}^{K}\\theta(k)}a_{k,M} \\] \\(j \\K\\). \\(K\\) can include present absent stimuli, \\(\\theta\\) function depends whether stimulus \\(k\\) absent (.e., \\(k \\N\\)) (.e., \\(k \\M\\)), : \\[ \\tag{Eq. 9} \\theta(k) = \\begin{cases} \\left |\\sum_{m}^{M}\\left( v_{m,k}+\\sum_{n \\neq k}^{N}\\frac{v_{m,n}v_{n,k}}{c}\\right) \\right|,& \\text{} k \\N\\\\ \\alpha_k, & \\text{otherwise} \\end{cases} \\] Note quantity absent stimuli absolute, prevent negative \\(\\theta\\) values due inhibitory associations4. Also, note summation term used left-hand side expression absent stimulus. implies present stimuli \\(M\\) contribute salience stimulus \\(k\\). Finally, note right-hand side expression present stimuli contribute via direct association \\(k\\), \\(v_{m,k}\\) also associative chains absent stimuli (c.f., Eq. 6a).","code":""},{"path":"https://victornavarro.org/calmr/articles/HD2022.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind HeiDI","what":"4 - Generating responses","title":"HD2022","text":"Finally, HeiDI responds. response-generating mechanisms HeiDI currently underspecified. current version, HeiDI’s responses product activation stimulus-specific response units connection units specific motor units. , activation motor unit \\(q\\), \\(r_q\\), given \\[ \\tag{Eq. 10} r_q = R_jw_{j,q} \\] \\(w_{j,q}\\) weight representing association stimulus-specific unit \\(j\\) motor unit \\(q\\).","code":""},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"simulating-similarity-effects","dir":"Articles","previous_headings":"","what":"Simulating similarity effects","title":"heidi_similarity","text":"Honey Dwyer (2022), authors propose similarity retrieved nominal saliencies stimulus representations modulates quantities combination rule. Retrieved saliencies exclusively absent stimuli, result existing associations stimuli (see Eq. 8 model’s vignette). contrast, nominal saliencies denote intensity stimulus representations stimuli presented trial (\\(\\alpha\\)). intuitive example effect saliency similarity responding refers effect weakly retrieved representations behavior. low similarity weakly retrieved representation nominal representation result reduced effect former behavior. example, typical Pavlovian inhibition paradigm \\[(US)/AX\\], inhibitor (e.g., X) strong effect behavior presented weak effect behavior weakly retrieved stimulus strong association (e.g., ). Yet, inspiration proposing general rule fairly specific. attempt explain introduction delay CS US stimuli higher-order conditioning experiments sometimes enhance responding stimulus never paired US (e.g., AX/X(US) X(US)/AX).","code":""},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"reproducing-the-simulation-presented-in-the-paper","dir":"Articles","previous_headings":"Simulating similarity effects","what":"Reproducing the simulation presented in the paper","title":"heidi_similarity","text":"paper, authors plot similarity retrieved saliencies nominal saliencies stimulus X sensory preconditioning experiment short delay X US used (group Reduced) (group ). effect introducing delay simulated X saliency .36; otherwise, saliency .40. saliencies US fixed .30 .50, respectively, conditions.","code":"df <- data.frame( Group = c(\"Same\", \"Reduced\"), P1 = c(\"10A(X_a)\", \"10A(X_a)\"), R1 = c(FALSE, FALSE), P2 = c(\"10(X_a)(US)\", \"10(X_b)(US)\"), R2 = c(FALSE, FALSE) ) params <- get_parameters(df, model = \"HD2022\") params$alphas[] <- c(.30, .40, .50, .36) model <- run_experiment(df, model = \"HD2022\", parameters = params )"},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"plotting-the-similarity-between-saliencies","dir":"Articles","previous_headings":"Simulating similarity effects > Reproducing the simulation presented in the paper","what":"Plotting the similarity between saliencies","title":"heidi_similarity","text":"plot currently supported package, can easily generated passing \\(\\rightarrow X\\) association one alphas internal function used calculate similarity calmr:::.alphaSim.","code":"associations <- results(model)$associations[ s1 == \"A\" & s2 == \"X\" & phase == \"P1\" ] associations[ , nominal_alpha := ifelse(group == \"Reduced\", mean(.36, .40), .40) ][ , similarity := calmr:::.alphaSim(value, nominal_alpha) ] associations |> ggplot(aes(x = trial, y = similarity, linetype = group)) + geom_line() + theme_bw() + labs(x = \"Trial\", y = \"Similarity\", linetype = \"Group\")"},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"plotting-the-distribution-of-responding","dir":"Articles","previous_headings":"Simulating similarity effects > Reproducing the simulation presented in the paper","what":"Plotting the distribution of responding","title":"heidi_similarity","text":"one little bit trickier figure manuscript effectively contains many experiments varying number XA trials starting first-order conditioning phase. address , run multiple simulations different experimental designs. Run model. now can manually plot distribution responding among stimuli model$responses.","code":"ntrials <- 1:10 df <- data.frame( Group = c(paste0(\"S\", ntrials), paste0(\"R\", ntrials)), P1 = rep(paste0(ntrials, \"A(X_a)\"), 2), R1 = FALSE, P2 = rep(c(\"10(X_a)>(US)\", \"10(X_b)>(US)\"), each = 10), R2 = FALSE, P3 = \"1A#\", R3 = FALSE ) head(df) #> Group P1 R1 P2 R2 P3 R3 #> 1 S1 1A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 2 S2 2A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 3 S3 3A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 4 S4 4A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 5 S5 5A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE #> 6 S6 6A(X_a) FALSE 10(X_a)>(US) FALSE 1A# FALSE model <- run_experiment(df, model = \"HD2022\", parameters = params ) responses <- results(model)$responses[phase == \"P3\" & s2 == \"US\"] responses[, `:=`( trial = trial - 11, group_lab = ifelse(substr(group, 1, 1) == \"R\", \"Reduced\", \"Same\") )] responses |> ggplot(aes(x = trial, y = value, colour = s1, linetype = group_lab)) + geom_line() + theme_bw() + labs(x = \"Trial\", y = \"R-value\", colour = \"stimulus\", linetype = \"Group\") + facet_wrap(~s2)"},{"path":"https://victornavarro.org/calmr/articles/heidi_similarity.html","id":"some-final-notes","dir":"Articles","previous_headings":"Simulating similarity effects > Reproducing the simulation presented in the paper","what":"Some final notes","title":"heidi_similarity","text":"paper, Honey Dwyer completely specify rules choosing reference value similarity calculation whenever one nominal stimulus experienced. example, simulation, use two nominal versions X stimulus (X_a X_b), , whenever model compute similarity retrieved (.e., \\(\\rightarrow X\\)) conditioned saliency values, encounter problem choose among least two conditioned values (X_a X_b). Although authors paper chose saliency nominal X conditioned US (.e., X_b), specify choice made , less intuitive situations. way avoid solving issue, current implementation similarity rule uses average nominal stimuli reference value similarity calculation. specific simulation case, implementation reduces effect similarity distribution responding.","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"the-mathematics-behind-mac1975","dir":"Articles","previous_headings":"","what":"The mathematics behind MAC1975","title":"MAC1975","text":"grand departure global error term models RW1972 (Rescorla & Wagner, 1972), MAC1975 model (Mackintosh, 1975) uses local error terms changes stimulus associability (\\(\\alpha\\)) via error comparison mechanism promotes learning uncertain stimuli:","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"generating-expectations","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"1 - Generating expectations","title":"MAC1975","text":"Let \\(v_{k,j}\\) denote associative strength stimulus \\(k\\) stimulus \\(j\\). given trial, expectation stimulus \\(j\\), \\(e_j\\), given : \\[ \\tag{Eq.1} e_j = \\sum_{k}^{K}x_k v_{k,j} \\] \\(x_k\\) denotes presence (1) absence (0) stimulus \\(k\\), set \\(K\\) represents stimuli design.","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"2 - Learning associations","title":"MAC1975","text":"Changes association stimulus \\(\\) \\(j\\), \\(v_{,j}\\), given : \\[ \\tag{Eq.2} \\Delta v_{,j} = x_i \\alpha_i \\beta_j (\\lambda_j - v_{,j}) \\] \\(\\alpha_i\\) associability (attention devoted ) stimulus \\(\\), \\(\\beta_j\\) learning rate parameter determined properties \\(j\\), \\(\\lambda_j\\) maximum association strength supported \\(j\\) (asymptote).","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"learning-to-attend","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"3 - Learning to attend","title":"MAC1975","text":"parameter \\(\\alpha_i\\) changes function learning, proportionally difference absolute errors conveyed \\(\\) predictors1, via: \\[ \\tag{Eq.3} \\Delta \\alpha_{} = x_i\\theta_i \\sum_{j}^{K}\\gamma_j(|\\lambda_j - \\sum_{k \\ne }^{K}v_{k,j}|-|\\lambda_j - v_{,j}|) \\] \\(\\theta_i\\) attentional learning rate parameter stimulus \\(\\) (usually fixed across stimuli). Although Mackintosh (1975) extend model account predictive power within-compound associations, implementation model package . can sometimes result unexpected behavior, , Eq. 3 includes extra parameter \\(\\gamma_j\\) (defaulting 1/K) denotes whether expectation stimulus \\(j\\) contributes attentional learning. , user can set parameters manually reflect contribution different experimental stimuli. example, simple “AB>(US)” design, setting \\(\\gamma_{US}\\) = 1 \\(\\gamma_{} = \\gamma_{B} = 0\\) leads behavior original model.","code":""},{"path":"https://victornavarro.org/calmr/articles/MAC1975.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind MAC1975","what":"4 - Generating responses","title":"MAC1975","text":"specification response-generating mechanisms MAC1975. However, simplest response function can adopted identity function stimulus expectations. , responses reflecting nature \\(j\\), \\(r_j\\), given : \\[ \\tag{Eq.4} r_j = e_j \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"rw1972","dir":"Articles","previous_headings":"","what":"RW1972","title":"Model Parameters","text":"","code":"model_parameters(\"RW1972\") ## $name ## [1] \"alphas\" \"betas_on\" \"betas_off\" \"lambdas\" ## ## $default_value ## [1] 0.4 0.4 0.4 1.0"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"mac1975","dir":"Articles","previous_headings":"","what":"MAC1975","title":"Model Parameters","text":"","code":"model_parameters(\"MAC1975\") ## $name ## [1] \"alphas\" \"min_alphas\" \"max_alphas\" \"betas_on\" \"betas_off\" ## [6] \"lambdas\" \"thetas\" \"gammas\" ## ## $default_value ## [1] 0.4 0.1 1.0 0.4 0.4 1.0 0.2 0.3"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"pkh1982","dir":"Articles","previous_headings":"","what":"PKH1982","title":"Model Parameters","text":"","code":"model_parameters(\"PKH1982\") ## $name ## [1] \"alphas\" \"min_alphas\" \"max_alphas\" \"betas_ex\" \"betas_in\" ## [6] \"lambdas\" \"thetas\" \"gammas\" ## ## $default_value ## [1] 0.4 0.1 1.0 0.4 0.3 1.0 1.0 0.3"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"sm2007","dir":"Articles","previous_headings":"","what":"SM2007","title":"Model Parameters","text":"","code":"model_parameters(\"SM2007\") ## $name ## [1] \"alphas\" \"lambdas\" \"omegas\" \"rhos\" \"gammas\" \"taus\" \"order\" ## ## $default_value ## [1] 0.4 1.0 0.2 1.0 1.0 0.2 1.0"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"hdi2020hd2022","dir":"Articles","previous_headings":"","what":"HDI2020/HD2022","title":"Model Parameters","text":"","code":"model_parameters(\"HDI2020\") ## $name ## [1] \"alphas\" ## ## $default_value ## [1] 0.4 model_parameters(\"HD2022\") ## $name ## [1] \"alphas\" ## ## $default_value ## [1] 0.4"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"td","dir":"Articles","previous_headings":"","what":"TD","title":"Model Parameters","text":"","code":"model_parameters(\"TD\") ## $name ## [1] \"alphas\" \"betas_on\" \"betas_off\" \"lambdas\" \"gamma\" \"sigma\" ## ## $default_value ## [1] 0.05 0.40 0.40 1.00 0.95 0.90"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"anccr","dir":"Articles","previous_headings":"","what":"ANCCR","title":"Model Parameters","text":"","code":"model_parameters(\"ANCCR\") ## $name ## [1] \"reward_magnitude\" \"betas\" \"cost\" ## [4] \"temperature\" \"threshold\" \"k\" ## [7] \"w\" \"minimum_rate\" \"sampling_interval\" ## [10] \"use_exact_mean\" \"t_ratio\" \"t_constant\" ## [13] \"alpha\" \"alpha_reward\" \"use_timed_alpha\" ## [16] \"alpha_exponent\" \"alpha_init\" \"alpha_min\" ## [19] \"add_beta\" \"jitter\" ## ## $default_value ## [1] 1.000 1.000 0.000 1.000 0.600 1.000 0.500 0.001 0.200 0.000 1.200 NA ## [13] 0.020 0.200 0.000 1.000 1.000 0.000 0.000 1.000"},{"path":"https://victornavarro.org/calmr/articles/model_parameters.html","id":"rand","dir":"Articles","previous_headings":"","what":"RAND","title":"Model Parameters","text":"","code":"model_parameters(\"RAND\") ## $name ## [1] \"alphas\" ## ## $default_value ## [1] 0.4"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calm.html","id":"running-experiments-in-parallel","dir":"Articles","previous_headings":"","what":"Running experiments in parallel","title":"parallelism_in_calm","text":"advent time-based models, version 0.51 calm uses future package parallelize operations. Thanks design philosophy future, running things parallel takes single line code.","code":""},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calm.html","id":"why-run-things-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Why run things in parallel?","title":"parallelism_in_calm","text":"many situations find run model many iterations, either design contains enough kinds trials order effects worry, want run model different parameters. Let’s run HeiDI model (Honey et al., 2020) long, random design. Let’s also enable verbosity via calm_verbosity, uses cool progressr package. can see timings , elapsed column. Let’s try parallelizing now.","code":"library(calm) # enables progress bars (try it on your computer) # calm_verbosity(TRUE) pav_inhib <- data.frame( group = \"group\", phase1 = \"50(US)/50AB/50#A\", rand1 = TRUE ) # set options to introduce more randomness pars <- get_parameters(pav_inhib, model = \"HDI2020\") exp <- make_experiment(pav_inhib, parameters = pars, model = \"HDI2020\", iterations = 100, miniblocks = FALSE ) # time it start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 1.92 0.06 3.33"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calm.html","id":"running-an-experiment-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Running an experiment in parallel","title":"parallelism_in_calm","text":"run experiment, parallel, need enable future plan. “plan” one many ways future package can parallelize things (consult documentation). Regardless, running calm single computer, ’ll using plan(multisession) case, parallel evaluation slower. future package trades ease use bulkier overheads. overheads tend constant, parallelization better payoff run iterations.","code":"library(future) plan(multisession) start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 0.79 0.03 4.49 # go back to non-parallel evaluations plan(sequential)"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calmr.html","id":"running-experiments-in-parallel","dir":"Articles","previous_headings":"","what":"Running experiments in parallel","title":"parallelism_in_calmr","text":"advent time-based models, version 0.51 calmr uses future package parallelize operations. Thanks design philosophy future, running things parallel take single line code.","code":""},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calmr.html","id":"why-run-things-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Why run things in parallel?","title":"parallelism_in_calmr","text":"many situations find run model many iterations, either design contains enough kinds trials order effects worry, want run model different parameters. Let’s run HeiDI model (Honey et al., 2020) long, random design. Let’s also enable verbosity via calmr_verbosity(), uses progressr package. Let’s try parallelizing now.","code":"library(calmr) # enables progress bars (try it on your computer) # calmr_verbosity(TRUE) pav_inhib <- data.frame( group = \"group\", phase1 = \"50(US)/50AB/50#A\", rand1 = TRUE ) # set options to introduce more randomness pars <- get_parameters(pav_inhib, model = \"HDI2020\") exp <- make_experiment(pav_inhib, parameters = pars, model = \"HDI2020\", iterations = 100, miniblocks = FALSE ) # time it start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 0.78 0.05 3.34"},{"path":"https://victornavarro.org/calmr/articles/parallelism_in_calmr.html","id":"running-an-experiment-in-parallel","dir":"Articles","previous_headings":"Running experiments in parallel","what":"Running an experiment in parallel","title":"parallelism_in_calmr","text":"run experiment, parallel, need enable future plan. “plan” one many ways future package can parallelize things (really consult documentation). Regardless, running calmr single computer, ’ll using plan(multisession) case, parallel evaluation faster (see user time ). future package trades ease use bulkier overheads, overheads tend constant, parallelization better payoff run iterations.","code":"library(future) plan(multisession) start <- proc.time() pav_res <- run_experiment(exp) end <- proc.time() - start end #> user system elapsed #> 0.76 0.05 4.89 # go back to non-parallel evaluations plan(sequential)"},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"the-mathematics-behind-pkh1982","dir":"Articles","previous_headings":"","what":"The mathematics behind PKH1982","title":"PKH1982","text":"Another departure global error term models RW1972 (Rescorla & Wagner, 1972), PKH1982 model (Pearce et al., 1982) use error term learning excitatory associations (inhibitory associations), ties stimulus associability (\\(\\alpha\\)) absolute global prediction error. note: implementation model closely follows technical note CAL-R group possible. Divergences noted.","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"generating-expectations","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"1 - Generating expectations","title":"PKH1982","text":"Let \\(v_{k,j}\\) denote excitatory strength stimulus \\(k\\) stimulus \\(j\\), \\(v_{k,\\overline j}\\) inhibitory strength stimulus \\(k\\) stimulus \\(j\\) (effectively, “j” representation). given trial, net expectation stimulus \\(j\\), \\(e_j\\), given : \\[ \\tag{Eq.1} e_j = \\sum_{k}^{K}x_k v_{k,j} - \\sum_{k}^{K}x_k v_{k,\\overline j} \\] \\(x_k\\) denotes presence (1) absence (0) stimulus \\(k\\), set \\(K\\) represents stimuli design.","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"2 - Learning associations","title":"PKH1982","text":"Changes excitatory inhibitory associations stimuli given : \\[ \\tag{Eq.2a} \\Delta v_{,j} = \\delta_jx_i \\beta_{ex,j} \\alpha_i \\lambda_j \\] \\[ \\tag{Eq.2b} \\Delta v_{,\\overline j} = x_i \\beta_{,j} \\alpha_i |\\overline{\\lambda_j}| \\] \\(\\beta_{ex,j}\\) \\(\\beta_{,j}\\) represent learning rates excitatory inhibitory associations, respectively, determined stimulus \\(j\\), \\(\\alpha_i\\) associability stimulus \\(\\), respectively, \\(\\lambda_j\\) \\(\\overline {\\lambda_j}\\) excitatory asymptote overexpectation stimulus \\(j\\), respectively. Importantly, \\(\\delta_j\\) Eq.2a parameter equal 1 expectation stimulus \\(j\\), lower excitatory asymptote (.e., \\(e_j < \\lambda_j\\)), 0 . implies model stops strengthening \\(v_{,j}\\) expectation \\(j\\) higher excitatory asymptote. mentioned introductory note, PKH1982 model learn excitatory associations via correction error. However, model learn inhibitory associations via correction error, overexpectation term , \\(\\overline {\\lambda_j}\\) equal \\(min(\\lambda_j - e_j, 0)\\), \\(min\\) minimum function. implies \\(\\overline {\\lambda_j}\\) takes non-zero values expectation \\(j\\) higher intensity trial (\\(\\lambda_j\\)).","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"learning-to-attend","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"3 - Learning to attend","title":"PKH1982","text":"associability parameter \\(\\alpha_i\\) changes completely trial trial function learning (note lack \\(\\Delta\\) ), change equal difference absolute global error, via: \\[ \\tag{Eq.3} \\Delta \\alpha_{} = x_i \\sum_{j}^{K}\\gamma_j(|\\lambda_j - e_j|) \\] \\(\\gamma_j\\) denotes contribution prediction error based jth stimulus. regard, important note Pearce et al. (1982) extend model account predictive power within-compound associations, yet implementation model package . can sometimes result unexpected behaviour, , Eq. 3 includes extra parameter \\(\\gamma_j\\) (defaulting 1/K) denotes whether expectation stimulus \\(j\\) contributes attentional learning. , user can set parameters manually reflect contribution different experimental stimuli. example, simple “AB>(US)” design, setting \\(\\gamma_{US}\\) = 1 \\(\\gamma_{} = \\gamma_{B} = 0\\) leads behavior original model. PKH1982 model improves upon Pearce & Hall (1980) model adding extra parameter controls rate associability changes. qualify changes associability determined Eq.3 via \\(\\Delta\\alpha_{}^{n}\\) (meaning happened trial \\(n\\)), can quantify total associability stimulus \\(\\) trial \\(n\\) via: \\[ \\tag{Eq.4} \\alpha_{}^{n} = \\begin{cases} (1-\\theta_i) \\alpha_{}^{n-1} + \\theta_i\\Delta\\alpha_{j}^n &\\text{, } x_i = 1\\\\ \\alpha_{}^{n} & \\text{, otherwise} \\end{cases} \\] \\(\\theta_i\\) parameter determining rate associability decays (via \\(1-\\theta_i\\)), rate increments attention occur. Note changes associability apply stimuli presented trial (.e., \\(x_i = 1\\)); attention absent stimuli remains unchanged.","code":""},{"path":"https://victornavarro.org/calmr/articles/PKH1982.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind PKH1982","what":"4 - Generating responses","title":"PKH1982","text":"specification response-generating mechanisms PKH1982. However, simplest response function can adopted identity function stimulus expectations. , responses reflecting nature \\(j\\), \\(r_j\\), given : \\[ \\tag{Eq.5} r_j = e_j \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/RAND.html","id":"the-mathematics-behind-rand","dir":"Articles","previous_headings":"","what":"The mathematics behind RAND","title":"RAND","text":"RAND RW-based model associations randomized every trial. Therefore, model responds randomly. model meant comparisons .","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"the-mathematics-behind-rw1972","dir":"Articles","previous_headings":"","what":"The mathematics behind RW1972","title":"RW1972","text":"influential associative learning model, RW1972 (Rescorla & Wagner, 1972), learns global error posits changes stimulus associability.","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"generating-expectations","dir":"Articles","previous_headings":"The mathematics behind RW1972","what":"1 - Generating expectations","title":"RW1972","text":"Let \\(v_{k,j}\\) denote associative strength stimulus \\(k\\) stimulus \\(j\\). given trial, expectation stimulus \\(j\\), \\(e_j\\), given : \\[ \\tag{Eq.1} e_j = \\sum_{k}^{K}x_k v_{k,j} \\] \\(x_k\\) denotes presence (1) absence (0) stimulus \\(k\\), set \\(K\\) represents stimuli design.","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind RW1972","what":"2 - Learning associations","title":"RW1972","text":"Changes association stimulus \\(\\) \\(j\\), \\(v_{,j}\\), given : \\[ \\tag{Eq.2} \\Delta v_{,j} = \\alpha_i \\beta_j (\\lambda_j - e_j) \\] \\(\\alpha_i\\) associability stimulus \\(\\), \\(\\beta_j\\) learning rate parameter determined properties \\(j\\)1, \\(\\lambda_j\\) maximum association strength supported \\(j\\) (asymptote).","code":""},{"path":"https://victornavarro.org/calmr/articles/RW1972.html","id":"generating-responses","dir":"Articles","previous_headings":"The mathematics behind RW1972","what":"3 - Generating responses","title":"RW1972","text":"specification response-generating mechanisms RW1972. However, simplest response function can adopted identity function stimulus expectations. , responses reflecting nature \\(j\\), \\(r_j\\), given : \\[ \\tag{Eq.3} r_j = e_j \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"the-mathematics-behind-socr","dir":"Articles","previous_headings":"","what":"The mathematics behind SOCR","title":"SM2007","text":"first formalization comparator hypothesis (Miller & Matzel, 1988), sometimes competing retrieval model (SOCR; Stout & Miller, 2007) learns local error responds function relative associative strength present retrieved stimuli.","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"learning-associations","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"1 - Learning associations","title":"SM2007","text":"SOCR model uses two different learning equations strengthening weakening associations. Whenever two stimuli contiguous, strengthening occurs. case, strengthening association stimulus \\(\\) \\(j\\) trial \\(t\\), \\(v_{,j}^t\\) given : \\[ \\tag{Eq.1a} \\Delta v_{,j}^t = x^t_i \\alpha_i \\alpha_j (\\lambda_j - v_{,j}^{t-1}) \\] \\(x^t_i\\) denotes presence (1) absence (0) stimulus \\(\\) trial \\(t\\). , SOCR model learns stimuli presented. parameters \\(\\alpha_i\\) \\(\\alpha_j\\) saliencies stimuli j, respectively, \\(\\lambda_j\\) maximum association strength supported \\(j\\) (asymptote). Whenever stimulus \\(\\) presented alone (.e., stimulus \\(j\\) absent), weakening association given : \\[ \\tag{Eq.1b} \\Delta v_{,j}^t = x_i \\alpha_i \\times -\\omega_j v_{,j}^{t-1} \\] \\(\\omega_j\\) determines weakening rate stimulus \\(j\\).1","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"activating-stimuli","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"2 - Activating stimuli","title":"SM2007","text":"SOCR posits competition stimuli presented /associatively retrieved. Dropping trial notation sake simplicity, degree stimulus \\(\\) activates stimulus \\(j\\), \\(act_{,j}\\), given : \\[ \\tag{Eq.2} act_{, j} = x_i v_{,j} + x_j\\rho_j\\alpha_j \\] \\(\\rho_j\\) (bound 0 +\\(\\infty\\)) determines much salience stimulus \\(j\\) contributes unconditioned activation. first-order activation values key quantities involved comparison processes.","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"generating-responses-and-comparison-processes","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"3 - Generating responses and comparison processes","title":"SM2007","text":"Stimulus \\(\\) generates j-oriented responding time retrieval function relative ability activate stimulus \\(j\\). relative ability expressed comparison process, given : \\[ \\tag{Eq.3} r^j_i = act_{,j} - \\Sigma_{k \\neq ,j} ^K \\gamma_k \\times o_{,k,j} \\times r^k_i \\times r^j_k \\] \\(r^j_i\\) relative activation stimulus \\(j\\) stimulus \\(\\), \\(K\\) set experimental stimuli including \\(\\) \\(j\\), \\(\\gamma_k\\) parameter determining degree stimulus \\(k\\), comparison stimulus, contributes comparison process (bound 0 1), \\(o_{,k,j}\\) operator switch determines whether \\(\\) \\(k\\) associations \\(j\\) engage facilitation competition. Finally, \\(r^k_i\\) relative activation stimulus \\(k\\) stimulus \\(\\), representing ability stimulus \\(\\) activate comparison, \\(r^j_k\\) relative activation stimulus \\(j\\) stimulus \\(k\\), representing ability comparison stimulus \\(k\\) activate stimulus \\(j\\).2 notably, last two quantities (\\(r^k_i\\) \\(r^j_k\\)) also determined corresponding instantiations Eq. 3. , involve comparison processes . number potential comparison processes technically infinite (comparison process can nest two extra comparison processes ), user must determine order model using extra global parameter (order). n-th order models (\\(n > 0\\)), model behave like extended comparator hypothesis (Denniston et al., 2001), implementing \\(n\\) comparison processes time relative activations calculated. order = 0, SM2007 behave like originally written consider one comparison process. Indeed, n-th order models accomplished via recursion using 0-th order model stopping condition. condition reached, \\(r^k_i\\) \\(r^j_k\\) terms Eq. 3 become \\(act_{,k}\\) \\(act_{k,j}\\), respectively.","code":""},{"path":"https://victornavarro.org/calmr/articles/SM2007.html","id":"switching-between-facilitation-and-competition","dir":"Articles","previous_headings":"The mathematics behind SOCR","what":"4 - Switching between facilitation and competition","title":"SM2007","text":"operator switch Eq. 3, \\(o_{,k,j}\\), changes subjects learn discriminate directly (via \\(\\)) indirectly activated (via \\(k\\)) representations stimulus \\(j\\). change quantity depends value \\(v_{,j}\\), follows: \\[ \\tag{Eq.4} \\Delta o_{,k,j} = \\begin{cases} \\tau_j\\alpha_iv_{,k}v_{k,j}(1-o_{,k,j}) &\\text{, } v_{,j} = 0\\\\ 1-o_{,k,j} & \\text{, otherwise} \\end{cases} \\] negative values \\(o\\) indicate facilitation positive values \\(o\\) indicate competition. default value operator switches outset training set -1 default. parameter \\(\\tau_j\\) specifies learning rate operator switches related stimulus \\(j\\).","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"the-mathematics-behind-td","dir":"Articles","previous_headings":"","what":"The mathematics behind TD","title":"TD","text":"temporal difference (TD) model (Sutton & Barto, 1990) extension ideas underlying RW model (Rescorla & Wagner, 1972). notably TD model abandons construct “trial”, favoring instead time-based formulations. Also notable introduction eligibility traces, allow model bridge temporal gaps deal credit assigment problem. Implementation note: calmr version 0.6.2, stimulus representation TD based complete serial compounds (.e., time-specific stimulus elements entirely discriminable ), eligibility traces replacing type. General Note: several descriptions TD model , however, ones found opaque comes implementation. Hence, following description model focus implementational details.","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"maintaining-stimulus-representations","dir":"Articles","previous_headings":"","what":"1 - Maintaining stimulus representations","title":"TD","text":"TD maintains stimulus traces eligibility traces. elegibility stimulus \\(\\) time \\(t\\), \\(e_i^t\\), given : \\[ \\tag{Eq. 1} e_i^t = e_i^{t-1} \\sigma \\gamma + x_i^t \\] \\(\\sigma\\) \\(\\gamma\\) decay discount parameters, respectively, \\(x_i^t\\) activation stimulus \\(\\) time \\(t\\) (1 0 present absent stimuli, respectively). Internally, \\(e_i\\) represented vector length \\(d\\), \\(d\\) number stimulus compounds (general sense word compound, terms complete serial compounds, CSC). example, 2s stimulus model time resolution 0.5s \\(d = 4\\), second entry vector represents eligibility compound active stimulus present 1s. Similarly, \\(x_i^t\\) entails specific compound stimulus \\(\\) time \\(t\\), general activation \\(\\) time. example, suppose two, 2s stimuli, \\(\\) \\(B\\) presented overlap 1s, \\(\\)’s onset occurring first. Can guess stimulus compounds active \\(t = 2\\) time resolution 0.5s?1","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"generating-expectations","dir":"Articles","previous_headings":"","what":"2 - Generating expectations","title":"TD","text":"TD model generates stimulus expectations2 based presented stimuli, strength eligibility traces. expectation stimulus \\(j\\) time \\(t\\), \\(V_j^t\\), given : \\[ \\tag{Eq. 2} V_j^t = w_j^{t'} x^t = \\sum_i^K w_{,j}^t x_i^t \\] \\(w_j^t\\) matrix stimulus weights time \\(t\\) pointing towards \\(j\\), \\('\\) denotes transposition, \\(w_{,j}\\) denotes entry square matrix denoting association \\(\\) \\(j\\). eligibility traces , entries matrix weights specific stimulus compounds. Internally, \\(w_j^t\\) constructed trial--trial, step--step basis, depending stimulus compounds active time.","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"learning-associations","dir":"Articles","previous_headings":"","what":"3 - Learning associations","title":"TD","text":"Owing name, TD model updates associations based temporally discounted prediction upcoming stimuli. temporal difference error term given : \\[ \\tag{Eq. 3} \\delta_j^t = \\lambda_j^t + \\gamma V_j^t - V_j^{t-1} \\] \\(\\lambda_j\\) value stimulus \\(j\\) time \\(t\\), also determines assymptote stimulus weights towards \\(j\\). temporal difference error term used update \\(w\\) via: \\[ \\tag{Eq. 4} w_{,j}^t = w_{,j}^t + \\alpha_i \\beta(x_j^t) \\delta_j^t e_i^t \\] \\(\\alpha_i\\) learning rate parameter stimulus \\(\\), \\(\\beta(x_j)\\) function returns one two learning rate parameters (\\(\\beta_{}\\) \\(\\beta_{}\\)) depending whether \\(j\\) presented time \\(t\\).","code":""},{"path":"https://victornavarro.org/calmr/articles/TD.html","id":"generating-responses","dir":"Articles","previous_headings":"","what":"4 - Generating responses","title":"TD","text":"many associative learning models, transformation stimulus expectations responding unspecified/left hands user. TD model return response vector, suffices assume responding identity function expected stimulus values, follows: \\[ \\tag{Eq. 5} r_j^t = V_j^t \\]","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/articles/using_time_models.html","id":"time-models-in-calmr","dir":"Articles","previous_headings":"","what":"Time models in calmr","title":"using_time_models","text":"Version 0.5 calmr introduced first time-based model, ANCCR (Jeong et al., 2022), , wrote several additional tools future time-based models.","code":""},{"path":"https://victornavarro.org/calmr/articles/using_time_models.html","id":"changes-to-trial-based-models","dir":"Articles","previous_headings":"Time models in calmr","what":"Changes to trial-based models","title":"using_time_models","text":"biggest change calmr version 0.5 use “>” character effect trial-based models, rather, lack thereof. , “>” character used specify single split within trial. example, “>(US)” encode typical situation stimulus followed US. used mimic traditional situation expect organism start (conditionally) responding US delivered. , trial-based models two steps within trial: expectation step first half trial retrieved (responded ) absent stimuli, learning step, stimuli trial associated . first pass (start throwing extinction trials, better yet, probe trials “#” character test associations).","code":""},{"path":"https://victornavarro.org/calmr/articles/using_time_models.html","id":"specifying-a-design-for-time-based-models","dir":"Articles","previous_headings":"Time models in calmr","what":"Specifying a design for time-based models","title":"using_time_models","text":"designs time-based models nearly identical trial-based models. However, clever use “>” character enrich . Let’s specify serial feature discrimination experiment: can manually specify timing experiment calling get_timings() function. Manipulating list returned function result manipulation timing experimental events. now let’s get parameters ANCCR model. Let’s make model’s experience look first 20 entries. can see , several rows per trial, specifying different stimulus. Time-based models like ANCCR run time log make ample use temporal difference events. Let’s run model see plots. ’s ! Easy, right?","code":"library(calmr) #> #> Attaching package: 'calmr' #> The following object is masked from 'package:base': #> #> parse fpfn <- data.frame( group = c(\"FP\", \"FN\"), phase1 = c(\"100F>T>(US)/100T\", \"100F>T/100T>(US)\"), r1 = c(TRUE, TRUE) ) parse_design(fpfn) #> CalmrDesign built from data.frame: #> group phase1 r1 #> 1 FP 100F>T>(US)/100T TRUE #> 2 FN 100F>T/100T>(US) TRUE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 FP phase1 F>T>(US) 100 FALSE F;T;US #> 2 FP phase1 T 100 FALSE T #> 3 FN phase1 F>T 100 FALSE F;T #> 4 FN phase1 T>(US) 100 FALSE T;US ts <- get_timings(fpfn, model = \"ANCCR\") ts #> $use_exponential #> [1] TRUE #> #> $trial_ts #> trial post_trial_delay mean_ITI max_ITI #> 1 F>T>(US) 1 30 90 #> 2 T 1 30 90 #> 3 F>T 1 30 90 #> 4 T>(US) 1 30 90 #> #> $transition_ts #> trial transition transition_delay #> 1 F>T>(US) F>T 1 #> 2 F>T>(US) T>(US) 1 #> 3 F>T F>T 1 #> 4 T>(US) T>(US) 1 pars <- get_parameters(fpfn, model = \"ANCCR\") # increase learning rates pars$alpha_reward <- 0.8 pars$alpha <- 0.08 # increase sampling interval to speed up the model pars$sampling_interval <- 5 pars #> $reward_magnitude #> F T US #> 1 1 1 #> #> $betas #> F T US #> 1 1 1 #> #> $cost #> [1] 0 #> #> $temperature #> [1] 1 #> #> $threshold #> [1] 0.6 #> #> $k #> [1] 1 #> #> $w #> [1] 0.5 #> #> $minimum_rate #> [1] 0.001 #> #> $sampling_interval #> [1] 5 #> #> $use_exact_mean #> [1] 0 #> #> $t_ratio #> [1] 1.2 #> #> $t_constant #> [1] NA #> #> $alpha #> [1] 0.08 #> #> $alpha_reward #> [1] 0.8 #> #> $use_timed_alpha #> [1] 0 #> #> $alpha_exponent #> [1] 1 #> #> $alpha_init #> [1] 1 #> #> $alpha_min #> [1] 0 #> #> $add_beta #> [1] 0 #> #> $jitter #> [1] 1 experiment <- make_experiment(fpfn, parameters = pars, timings = ts, model = \"ANCCR\" ) head(experiences(experiment)[[1]], 20) #> model group phase tp tn is_test block_size trial stimulus time reward_mag #> 1 ANCCR FP phase1 1 F>T>(US) FALSE 2 1 F 30.25096 1 #> 2 ANCCR FP phase1 1 F>T>(US) FALSE 2 1 T 31.25096 1 #> 3 ANCCR FP phase1 1 F>T>(US) FALSE 2 1 US 32.25096 1 #> 4 ANCCR FP phase1 2 T FALSE 2 2 T 41.08319 1 #> 5 ANCCR FP phase1 2 T FALSE 2 3 T 54.83228 1 #> 6 ANCCR FP phase1 1 F>T>(US) FALSE 2 4 F 73.10976 1 #> 7 ANCCR FP phase1 1 F>T>(US) FALSE 2 4 T 74.10976 1 #> 8 ANCCR FP phase1 1 F>T>(US) FALSE 2 4 US 75.10976 1 #> 9 ANCCR FP phase1 2 T FALSE 2 5 T 77.56574 1 #> 10 ANCCR FP phase1 1 F>T>(US) FALSE 2 6 F 126.30426 1 #> 11 ANCCR FP phase1 1 F>T>(US) FALSE 2 6 T 127.30426 1 #> 12 ANCCR FP phase1 1 F>T>(US) FALSE 2 6 US 128.30426 1 #> 13 ANCCR FP phase1 1 F>T>(US) FALSE 2 7 F 140.97733 1 #> 14 ANCCR FP phase1 1 F>T>(US) FALSE 2 7 T 141.97733 1 #> 15 ANCCR FP phase1 1 F>T>(US) FALSE 2 7 US 142.97733 1 #> 16 ANCCR FP phase1 2 T FALSE 2 8 T 146.04170 1 #> 17 ANCCR FP phase1 2 T FALSE 2 9 T 154.74708 1 #> 18 ANCCR FP phase1 1 F>T>(US) FALSE 2 10 F 160.91808 1 #> 19 ANCCR FP phase1 1 F>T>(US) FALSE 2 10 T 161.91808 1 #> 20 ANCCR FP phase1 1 F>T>(US) FALSE 2 10 US 162.91808 1 experiment <- run_experiment(experiment) # Action values patch_plots(plot(experiment, type = \"action_values\")) # ANCCR patch_plots(plot(experiment, type = \"anccrs\")) # Dopamine transients patch_plots(plot(experiment, type = \"dopamines\"))"},{"path":[]},{"path":"https://victornavarro.org/calmr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Victor Navarro. Author, maintainer, copyright holder.","code":""},{"path":"https://victornavarro.org/calmr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Navarro V (2024). calmr: Canonical Associative Learning Models Representations. https://github.com/victor-navarro/calmr, https://victornavarro.org/calmr/.","code":"@Manual{, title = {calmr: Canonical Associative Learning Models and their Representations}, author = {Victor Navarro}, year = {2024}, note = {https://github.com/victor-navarro/calmr, https://victornavarro.org/calmr/}, }"},{"path":"https://victornavarro.org/calmr/index.html","id":"calmr","dir":"","previous_headings":"","what":"Canonical Associative Learning Models and their Representations","title":"Canonical Associative Learning Models and their Representations","text":"Canonical Associative Learning Models Representations","code":""},{"path":"https://victornavarro.org/calmr/index.html","id":"installing-the-latest-stable-version","dir":"","previous_headings":"","what":"Installing the latest stable version","title":"Canonical Associative Learning Models and their Representations","text":"may install latest stable version CRAN:","code":"install.packages(\"calmr\")"},{"path":"https://victornavarro.org/calmr/index.html","id":"installing-the-latest-version","dir":"","previous_headings":"","what":"Installing the latest version","title":"Canonical Associative Learning Models and their Representations","text":"feeling daring, can install latest version package. need devtools install package GitHub. managed build vignettes, ’s vignette showing basics package. (Worry , package’s website also ). want simulations using companion app, must install calmr.app package launch app.","code":"install.packages(\"devtools\") devtools::install_github(\"victor-navarro/calmr\") vignette(\"calmr_basics\", package = \"calmr\") devtools::install_github(\"victor-navarro/calmr.app\") calmr.app::launch_app()"},{"path":"https://victornavarro.org/calmr/index.html","id":"try-the-online-shiny-app","dir":"","previous_headings":"","what":"Try the online Shiny app","title":"Canonical Associative Learning Models and their Representations","text":"want check app without committing install, can check (wary: server might run free monthly quota). https://victor-navarro.shinyapps.io/calmr_app/","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://victornavarro.org/calmr/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":null,"dir":"Reference","previous_headings":"","what":"AIC of CalmrFit — AIC,CalmrFit-method","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"Returns Akaike Information Criterion model fit via calmr::fit_model","code":""},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"","code":"# S4 method for CalmrFit AIC(object, ..., k = 2)"},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"object object class CalmrFit-class. ... Unused k Numeric. Penalty term (default = 2)","code":""},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"numeric","code":""},{"path":"https://victornavarro.org/calmr/reference/AIC-CalmrFit-method.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"AIC of CalmrFit — AIC,CalmrFit-method","text":"AIC defined 2*k - 2*-NLL, k penalty term NLL negative log likelihood model.","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the ANCCR model — ANCCR","title":"Train the ANCCR model — ANCCR","text":"Train ANCCR model","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the ANCCR model — ANCCR","text":"","code":"ANCCR(parameters, experience, mapping, debug = FALSE, debug_t = -1, ...)"},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the ANCCR model — ANCCR","text":"parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment debug Logical specifying whether print debug information. debug_t Whether invoke browser end timestep equal debug_t. ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the ANCCR model — ANCCR","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/ANCCR.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Train the ANCCR model — ANCCR","text":"model highly experimental state. Use caution.","code":""},{"path":"https://victornavarro.org/calmr/reference/app.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the calm shiny application — app","title":"Run the calm shiny application — app","text":"Run calm shiny application","code":""},{"path":"https://victornavarro.org/calmr/reference/app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the calm shiny application — app","text":"","code":"app(browser = TRUE, install_pkg = FALSE)"},{"path":"https://victornavarro.org/calmr/reference/app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the calm shiny application — app","text":"browser TRUE, app launched browser. calm.app package github. Defaults FALSE.","code":""},{"path":"https://victornavarro.org/calmr/reference/app.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Run the calm shiny application — app","text":"shiny app distributed separately package.","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":null,"dir":"Reference","previous_headings":"","what":"BIC of CalmrFit — BIC,CalmrFit-method","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"Returns Bayesian Information Criterion model fit via calmr::fit_model","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"","code":"# S4 method for CalmrFit BIC(object, ...)"},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"object object class CalmrFit-class. ... Unused","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"numeric","code":""},{"path":"https://victornavarro.org/calmr/reference/BIC-CalmrFit-method.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"BIC of CalmrFit — BIC,CalmrFit-method","text":"AIC defined k*log(n) - 2*-NLL, k number parameters model n number observations","code":""},{"path":"https://victornavarro.org/calmr/reference/build_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Build and return a model — build_model","title":"Build and return a model — build_model","text":"Build return model","code":""},{"path":"https://victornavarro.org/calmr/reference/build_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build and return a model — build_model","text":"","code":"build_model(model_name = NULL, env = parent.frame())"},{"path":"https://victornavarro.org/calmr/reference/build_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build and return a model — build_model","text":"model_name string specific model. Currently supports one c(\"HDI2020\", \"HD2022\").","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm designs — CalmDesign-class","title":"S4 class for Calm designs — CalmDesign-class","text":"S4 class Calm designs","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm designs — CalmDesign-class","text":"design: list containing design information. mapping: list containing object mapping. raw_design: original data.frame. augmented: Whether object augmented.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment CalmDesign — augment,CalmDesign-method","title":"Augment CalmDesign — augment,CalmDesign-method","text":"Methods mapping, trials, extractor functions.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment CalmDesign — augment,CalmDesign-method","text":"","code":"# S4 method for CalmDesign augment(object, model, ...) .anccrize_design(object) # S4 method for CalmDesign show(object) mapping(object) # S4 method for CalmDesign mapping(object) trials(object) # S4 method for CalmDesign trials(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmDesign-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment CalmDesign — augment,CalmDesign-method","text":"object CalmDesign, returned parse_design model modelname string. One supported_models() ... Additional parameters depending model.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmExperiment methods — show,CalmExperiment-method","title":"CalmExperiment methods — show,CalmExperiment-method","text":"Creates plots (plot) aggregated results CalmExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmExperiment methods — show,CalmExperiment-method","text":"","code":"# S4 method for CalmExperiment show(object) # S4 method for CalmExperiment design(x) # S4 method for CalmExperiment trials(object) parameters(x) <- value # S4 method for CalmExperiment parameters(x) # S4 method for CalmExperiment parameters(x) <- value # S4 method for CalmExperiment experiences(x) # S4 method for CalmExperiment results(object) # S4 method for CalmExperiment raw_results(object) # S4 method for CalmExperiment parsed_results(object) # S4 method for CalmExperiment length(x) parse(object) # S4 method for CalmExperiment parse(object) # S4 method for CalmExperiment aggregate(x, ...) # S4 method for CalmExperiment plot(x, type = NULL, ...) graph(x, ...) # S4 method for CalmExperiment graph(x, ...)"},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmExperiment methods — show,CalmExperiment-method","text":"object CalmExperiment object x CalmExperiment value list parameter lists. ... Additional parameters passed graph_calm_model type character vector specifying types plots create. See ??supported_plots. Defaults NULL.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmExperiment methods — show,CalmExperiment-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment-methods.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"CalmExperiment methods — show,CalmExperiment-method","text":"type = NULL, supported plots returned.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calm experiments. — CalmExperiment-class","title":"S4 class for calm experiments. — CalmExperiment-class","text":"S4 class calm experiments.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmExperiment.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calm experiments. — CalmExperiment-class","text":"design: CalmDesign object. model: string specifying model used. groups: string specifying groups design. parameters: list parameters used, per group. experiences: list experiences model. results: CalmExperimentResult object. .model: Internal. model associated iteration. .group: Internal. group associated iteration. .iter: Internal. iteration number.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmFit-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm Fit — CalmFit-class","title":"S4 class for Calm Fit — CalmFit-class","text":"S4 class Calm Fit","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmFit-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm Fit — CalmFit-class","text":"nloglik: Numeric. Negative log likelihood fit best_pars: Numeric. Best fitting parameters model_pars: Numeric. Parameters used model function link_pars: Numeric. Parameters used link function data: Numeric. Data used fit model_function: Function. Model function link_function: Function. Link function ll_function: Function. Objective function (usually nloglikelihood) optimizer_options: List. Options used optimizer extra_pars: List. Extra parameters passed fit call (...)","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmFit Methods — show,CalmFit-method","title":"CalmFit Methods — show,CalmFit-method","text":"CalmFit Methods CalmFit methods","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmFit Methods — show,CalmFit-method","text":"","code":"# S4 method for CalmFit show(object) # S4 method for CalmFit predict(object, type = \"response\", ...) NLL(object) # S4 method for CalmFit NLL(object) # S4 method for CalmFit AIC(object, k = 2) # S4 method for CalmFit BIC(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmFit Methods — show,CalmFit-method","text":"object CalmFit type string specifying type prediction generate ... Additional arguments k Penalty term","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmFit-methods.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"CalmFit Methods — show,CalmFit-method","text":"AIC defined 2*k - 2*-NLL, k penalty term NLL negative log likelihood model. BIC defined k*log(n) - 2*-NLL, k number parameters model n number observations","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmModel-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm Models — CalmModel-class","title":"S4 class for Calm Models — CalmModel-class","text":"S4 class Calm Models","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmModel-class.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"S4 class for Calm Models — CalmModel-class","text":"Currently unused.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmModel-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm Models — CalmModel-class","text":"model model name string model_fn model function state list model internal state parameters list model model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrComparison-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Comparisons — CalmrComparison-class","title":"S4 class for Calmr Comparisons — CalmrComparison-class","text":"S4 class Calmr Comparisons","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrComparison-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Comparisons — CalmrComparison-class","text":"results: Data.frame. unparsed model results models: Character vector. models compared layers: Character vector. layers compared model_layer_names: Character vector. Combination two ","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr designs — CalmrDesign-class","title":"S4 class for calmr designs — CalmrDesign-class","text":"S4 class calmr designs","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr designs — CalmrDesign-class","text":"design: list containing design information. mapping: list containing object mapping. raw_design: original data.frame.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrDesign methods — CalmrDesign-methods","title":"CalmrDesign methods — CalmrDesign-methods","text":"S4 methods CalmrDesign class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrDesign methods — CalmrDesign-methods","text":"","code":"# S4 method for CalmrDesign show(object) # S4 method for CalmrDesign mapping(object) # S4 method for CalmrDesign trials(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrDesign methods — CalmrDesign-methods","text":"object CalmrDesign object","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrDesign methods — CalmrDesign-methods","text":"show() returns NULL (invisibly). mapping() returns list trial mappings. trials() returns NULL (invisibly).","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr designs — CalmrDesign","title":"S4 class for Calmr designs — CalmrDesign","text":"Inherits tbl class","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrDesign.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr designs — CalmrDesign","text":"design: tbl containing object. mapping: list containing object mapping. raw_design: original data.frame. augmented: Whether object augmented.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"Methods for CalmResult — show,CalmResult-method","title":"Methods for CalmResult — show,CalmResult-method","text":"Methods CalmResult","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Methods for CalmResult — show,CalmResult-method","text":"","code":"# S4 method for CalmResult show(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmResult-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Methods for CalmResult — show,CalmResult-method","text":"object CalmResult object","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm Results — CalmResult-class","title":"S4 class for Calm Results — CalmResult-class","text":"S4 class Calm Results","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmResult.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm Results — CalmResult-class","text":"aggregated_results list fully aggregated results. parsed_results list parsed results, .e., fn(model_output). raw_results list model outputs.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Experiments — CalmrExperiment-class","title":"S4 class for Calmr Experiments — CalmrExperiment-class","text":"S4 class Calmr Experiments","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Experiments — CalmrExperiment-class","text":"results: Data.frame. unparsed model results parsed_results: List. parsed aggregated model results is_parsed: Logical. Whether model results parsed","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrExperiment methods — CalmrExperiment-methods","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"S4 methods CalmrExperiment class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"","code":"# S4 method for CalmrExperiment show(object) # S4 method for CalmrExperiment design(x) # S4 method for CalmrExperiment trials(object) # S4 method for CalmrExperiment parameters(x) # S4 method for CalmrExperiment parameters(x) <- value # S4 method for CalmrExperiment experiences(x) # S4 method for CalmrExperiment experiences(x) <- value # S4 method for CalmrExperiment results(object) # S4 method for CalmrExperiment raw_results(object) # S4 method for CalmrExperiment parsed_results(object) # S4 method for CalmrExperiment length(x) # S4 method for CalmrExperiment parse(object, outputs = NULL) # S4 method for CalmrExperiment aggregate(x, outputs = NULL) # S4 method for CalmrExperiment plot(x, type = NULL, ...) # S4 method for CalmrExperiment graph(x, ...) # S4 method for CalmrExperiment timings(x) # S4 method for CalmrExperiment timings(x) <- value"},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"object, x CalmrExperiment object. value list parameters (list parameter lists). outputs character vector specifying model outputs parse. type character vector specifying type(s) plots create. Defaults NULL. See supported_plots. ... Extra arguments passed calmr_model_graph() calmr_model_plot().","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrExperiment methods — CalmrExperiment-methods","text":"show() returns NULL (invisibly). design() returns CalmrDesign contained object. trials() returns NULL (invisibly). parameters() returns list parameters contained object. parameters()<- returns object updating parameters. experiences() returns list data.frame objects containing model training routines. experiences()<- returns object updating experiences. results() returns data.table objects aggregated results. raw_results() returns list raw model results. parsed_results() returns list data.table objects parsed results. length() returns integer specifying total length experiment (groups iterations). parse() returns object parsing raw results. aggregate() returns object aggregating parsed results. plot() returns list 'ggplot' plot objects. graph() returns list 'ggplot' plot objects. timings() returns list timings contained object. timings()<- returns object updating timings.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr experiments. — CalmrExperiment-class","title":"S4 class for calmr experiments. — CalmrExperiment-class","text":"S4 class calmr experiments.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperiment.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr experiments. — CalmrExperiment-class","text":"design: CalmrDesign object. model: string specifying model used. groups: string specifying groups design. parameters: list parameters used, per group. timings: list timings used design. experiences: list experiences model. results: CalmrExperimentResult object. .model: Internal. model associated iteration. .group: Internal. group associated iteration. .iter: Internal. iteration number.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrExperimentResult.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr experiment results — CalmrExperimentResult-class","title":"S4 class for calmr experiment results — CalmrExperimentResult-class","text":"S4 class calmr experiment results","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrExperimentResult.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr experiment results — CalmrExperimentResult-class","text":"aggregated_results list data.table objects aggregated results. parsed_results list containing data.table objects parsed results. raw_results list raw model outputs.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr Fit — CalmrFit-class","title":"S4 class for calmr Fit — CalmrFit-class","text":"S4 class calmr Fit","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr Fit — CalmrFit-class","text":"nloglik: Numeric. Negative log likelihood fit best_pars: Numeric. Best fitting parameters model_pars: Numeric. Parameters used model function link_pars: Numeric. Parameters used link function data: Numeric. Data used fit model_function: Function. Model function link_function: Function. Link function ll_function: Function. Objective function (usually nloglikelihood) optimizer_options: List. Options used optimizer extra_pars: List. Extra parameters passed fit call (...)","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrFit methods — CalmrFit-methods","title":"CalmrFit methods — CalmrFit-methods","text":"S4 methods CalmrFit class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrFit methods — CalmrFit-methods","text":"","code":"# S4 method for CalmrFit show(object) # S4 method for CalmrFit predict(object, type = \"response\", ...) # S4 method for CalmrFit NLL(object) # S4 method for CalmrFit AIC(object, k = 2) # S4 method for CalmrFit BIC(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrFit methods — CalmrFit-methods","text":"object CalmrFit object. type string specifying type prediction generate. ... Extra named arguments. k Penalty term AIC method.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrFit methods — CalmrFit-methods","text":"show() returns NULL (invisibly). predict() returns numeric vector. NLL() returns negative log likelihood model. AIC() returns Akaike Information Criterion (AIC) model. BIC() returns Bayesian Information Criterion (BIC) model.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit-methods.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"CalmrFit methods — CalmrFit-methods","text":"type = \"response\", predict() function passed model responses link function used fit model. AIC defined 2*k - 2*-NLL, k penalty term NLL negative log likelihood model. BIC defined p*log(n) - 2*-NLL, p number parameters model n number observations","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Fit — CalmrFit","title":"S4 class for Calmr Fit — CalmrFit","text":"S4 class Calmr Fit","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrFit.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Fit — CalmrFit","text":"nloglik: Numeric. Negative log likelihood fit best_pars: Numeric. Best fitting parameters model_pars: Numeric. Parameters used model function link_pars: Numeric. Parameters used link function data: Numeric. Data used fit model_function: Function. Model function link_function: Function. Link function ll_function: Function. Objective function (usually nloglikelihood) optimizer_options: List. Options used optimizer extra_pars: List. Extra parameters passed fit call (...)","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrModel-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr Models — CalmrModel-class","title":"S4 class for Calmr Models — CalmrModel-class","text":"S4 class Calmr Models","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrModel-class.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"S4 class for Calmr Models — CalmrModel-class","text":"Currently unused.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrModel-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr Models — CalmrModel-class","text":"model model name string model_fn model function state list model internal state parameters list model model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrResult methods — CalmrResult-methods","title":"CalmrResult methods — CalmrResult-methods","text":"S4 methods CalmrResults class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrResult methods — CalmrResult-methods","text":"","code":"# S4 method for CalmrResult show(object)"},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrResult methods — CalmrResult-methods","text":"object CalmrResults object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrResult methods — CalmrResult-methods","text":"show() returns NULL (invisibly).","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr results — CalmrResult-class","title":"S4 class for calmr results — CalmrResult-class","text":"S4 class calmr results","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrResult.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr results — CalmrResult-class","text":"aggregated_results list data.table objects aggregated results. parsed_results list containing data.table objects parsed results. raw_results list raw model outputs.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for calmr representational similarity analysis — CalmrRSA-class","title":"S4 class for calmr representational similarity analysis — CalmrRSA-class","text":"S4 class calmr representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for calmr representational similarity analysis — CalmrRSA-class","text":"corr_mat: array containing correlation matrix distances: list pairwise distance matrices args: list arguments used create object. test_data: list permutation data, populated testing object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmrRSA methods — CalmrRSA-methods","title":"CalmrRSA methods — CalmrRSA-methods","text":"S4 methods CalmrRSA class.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmrRSA methods — CalmrRSA-methods","text":"","code":"# S4 method for CalmrRSA show(object) # S4 method for CalmrRSA test(object, n_samples = 1000, p = 0.95) # S4 method for CalmrRSA plot(x)"},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmrRSA methods — CalmrRSA-methods","text":"object, x CalmrRSA object. n_samples number samples permutation test (default = 1e3) p critical threshold level permutation test (default = 0.95)","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmrRSA methods — CalmrRSA-methods","text":"show() returns NULL (invisibly). test() returns CalmrRSA object permutation test data. plot() returns list 'ggplot' plot objects.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr representational similarity analysis — CalmrRSA","title":"S4 class for Calmr representational similarity analysis — CalmrRSA","text":"S4 class Calmr representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSA.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr representational similarity analysis — CalmrRSA","text":"corr_mat: Array. Correlation matrix distances: List. Pairwise distance matrices arguments: List. Arguments used create object. test_data: List. Test data, populated testing object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSATest-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calmr RSA Test — CalmrRSATest-class","title":"S4 class for Calmr RSA Test — CalmrRSATest-class","text":"S4 class Calmr RSA Test","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmrRSATest-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calmr RSA Test — CalmrRSATest-class","text":"RSA: Object class CalmrRSA sig_mat: Array. Correlation significance matrix lower_crit: Array. Lower bound significance upper_crit: Array. Upper bound significance n_samples: Numeric. Number bootstrap samples p: Numeric. Alpha level significance","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-class.html","id":null,"dir":"Reference","previous_headings":"","what":"S4 class for Calm representational similarity analysis — CalmRSA-class","title":"S4 class for Calm representational similarity analysis — CalmRSA-class","text":"S4 class Calm representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"S4 class for Calm representational similarity analysis — CalmRSA-class","text":"corr_mat: Array. Correlation matrix distances: List. Pairwise distance matrices args: List. Arguments used create object. test_data: List. Test data, populated testing object.","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":null,"dir":"Reference","previous_headings":"","what":"CalmRSA Methods — show,CalmRSA-method","title":"CalmRSA Methods — show,CalmRSA-method","text":"CalmRSA Methods Test CalmRSA object via permutation test","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CalmRSA Methods — show,CalmRSA-method","text":"","code":"# S4 method for CalmRSA show(object) test(object, n_samples = 1000, p = 0.95) # S4 method for CalmRSA test(object, n_samples = 1000, p = 0.95) # S4 method for CalmRSA plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"CalmRSA Methods — show,CalmRSA-method","text":"object CalmRSA object n_samples number samples permutation test (default = 1e3) p critical threshold level permutation test (default = 0.95) x CalmRSA object plot y Unused. ... Extra parameters passed plot call","code":""},{"path":"https://victornavarro.org/calmr/reference/CalmRSA-methods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"CalmRSA Methods — show,CalmRSA-method","text":"CalmRSA object test results","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_app.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the calmr GUI — calmr_app","title":"Run the calmr GUI — calmr_app","text":"Starts shiny application","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the calmr GUI — calmr_app","text":"","code":"calmr_app(browser = getOption(\"shiny.launch.browser\", interactive()))"},{"path":"https://victornavarro.org/calmr/reference/calmr_app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the calmr GUI — calmr_app","text":"browser TRUE, app launched browser.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a graph with calmr data — calmr_model_graph","title":"Create a graph with calmr data — calmr_model_graph","text":"patch_graphs() patches graphs 'patchwork'","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a graph with calmr data — calmr_model_graph","text":"","code":"calmr_model_graph( x, loops = TRUE, limits = max(abs(x$value)) * c(-1, 1), colour_key = FALSE, t = max(x$trial), options = get_graph_opts() ) patch_graphs(graphs, selection = names(graphs)) get_graph_opts(graph_size = \"small\")"},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a graph with calmr data — calmr_model_graph","text":"x data.frame-like data use plot. Contains column named value. loops Logical. Whether draw arrows back forth limits Numerical. Limits color scale. Defaults max(abs(x$value))*c(-1,1). colour_key Logical. Whether show color key t trial weights obtained (defaults maximum trial data). options list graph options, returned get_graph_opts(). graphs list (named) graphs, returned graph() calmr_model_graph() selection character numeric vector determining plots patch. graph_size string (either \"small\" \"large\"). return default values small large graphs trial Numerical. trial graph.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a graph with calmr data — calmr_model_graph","text":"'ggplot' object patch_graphs() returns 'patchwork' object list graph options, passed ggnetwork::geom_nodes().","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_graph.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a graph with calmr data — calmr_model_graph","text":"probably getting graphs via graph method CalmrExperiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a plot with calmr data — calmr_model_plot","title":"Create a plot with calmr data — calmr_model_plot","text":"plot_common_scale() rescales list plots common scale. get_plot_opts() returns generic plotting options. patch_plots() patches plots using patchwork package.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a plot with calmr data — calmr_model_plot","text":"","code":"calmr_model_plot(data, type, model, ...) plot_common_scale(plots) get_plot_opts(common_scale = TRUE) patch_plots(plots, selection = names(plots), plot_options = get_plot_opts())"},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a plot with calmr data — calmr_model_plot","text":"data data.table containing aggregated data CalmrExperiment type character specifying type plot. model character specifying model. ... parameters passed plotting functions. plots list (named) plots, returned plot() calmr_model_plot() common_scale Logical specifying whether plots common scale. selection character numeric vector determining plots patch plot_options list plot options returned get_plot_opts()","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a plot with calmr data — calmr_model_plot","text":"'ggplot' object. plot_common_scale() returns list plots. get_plot_opts() returns list. patch_plots() returns patchwork object.","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_model_plot.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a plot with calmr data — calmr_model_plot","text":"probably getting plots via plot() method CalmrExperiment.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":null,"dir":"Reference","previous_headings":"","what":"Set verbosity options for calmr — calmr_verbosity","title":"Set verbosity options for calmr — calmr_verbosity","text":"Whether show verbosity messages progress bars","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set verbosity options for calmr — calmr_verbosity","text":"","code":"calmr_verbosity(verbose)"},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set verbosity options for calmr — calmr_verbosity","text":"verbose logical","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set verbosity options for calmr — calmr_verbosity","text":"list progressr handlers (invisibly).","code":""},{"path":"https://victornavarro.org/calmr/reference/calmr_verbosity.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set verbosity options for calmr — calmr_verbosity","text":"Progress bars handled progressr package. just convenience function. See package 'progressr' details.","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a plot with calm data — calm_model_plot","title":"Create a plot with calm data — calm_model_plot","text":"Create plot calm data","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a plot with calm data — calm_model_plot","text":"","code":"calm_model_plot(dat, type)"},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a plot with calm data — calm_model_plot","text":"dat data.frame-like data use plot type character specifying type plot","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a plot with calm data — calm_model_plot","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_model_plot.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a plot with calm data — calm_model_plot","text":"probably getting plots via plot method CalmExperiments.","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":null,"dir":"Reference","previous_headings":"","what":"Set verbosity options for calm — calm_verbosity","title":"Set verbosity options for calm — calm_verbosity","text":"Whether show verbosity messages progress bars","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set verbosity options for calm — calm_verbosity","text":"","code":"calm_verbosity(verbose)"},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set verbosity options for calm — calm_verbosity","text":"verbose logical","code":""},{"path":"https://victornavarro.org/calmr/reference/calm_verbosity.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set verbosity options for calm — calm_verbosity","text":"Progress bars handled progressr package.","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":null,"dir":"Reference","previous_headings":"","what":"Run models given a set of parameters — compare_models","title":"Run models given a set of parameters — compare_models","text":"Run models given set parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run models given a set of parameters — compare_models","text":"","code":"compare_models(x, models = NULL, ...)"},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run models given a set of parameters — compare_models","text":"x list CalmrExperiment objects design data.frame. models character vector length m, specifying models run. Ignored x list CalmrExperiment objects. ... Arguments passed make_experiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run models given a set of parameters — compare_models","text":"list CalmrExperiment objects","code":""},{"path":"https://victornavarro.org/calmr/reference/compare_models.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run models given a set of parameters — compare_models","text":"","code":"# By making experiment beforehand (recommended) df <- get_design(\"blocking\") models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") exps <- lapply(models, function(m) { make_experiment(df, parameters = get_parameters(df, model = m), model = m ) }) comp <- compare_models(exps) # By passing minimal arguments (not recommended; default parameters) comp <- compare_models(df, models = models)"},{"path":"https://victornavarro.org/calmr/reference/dot-calmr_assert.html","id":null,"dir":"Reference","previous_headings":"","what":"Go-to stops for calmr assertions — .calmr_assert","title":"Go-to stops for calmr assertions — .calmr_assert","text":"Go-stops calmr assertions","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-calmr_assert.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Go-to stops for calmr assertions — .calmr_assert","text":"","code":".calmr_assert(what, given, ...)"},{"path":"https://victornavarro.org/calmr/reference/dot-combV.html","id":null,"dir":"Reference","previous_headings":"","what":"Model support functions — .combV","title":"Model support functions — .combV","text":"assortment functions support models (mostly HeiDI)","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-combV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model support functions — .combV","text":"","code":".combV(V, pre_func, post_func, db_trial = NA)"},{"path":"https://victornavarro.org/calmr/reference/dot-parse.html","id":null,"dir":"Reference","previous_headings":"","what":"Model parsers — .parse","title":"Model parsers — .parse","text":"assorment functions help models","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-parse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model parsers — .parse","text":"","code":".parse(mod, type)"},{"path":"https://victornavarro.org/calmr/reference/dot-parse_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"An assorment of functions to help parse models — .parse_experiment","title":"An assorment of functions to help parse models — .parse_experiment","text":"assorment functions help parse models","code":""},{"path":"https://victornavarro.org/calmr/reference/dot-parse_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assorment of functions to help parse models — .parse_experiment","text":"","code":".parse_experiment(experiment)"},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit model to data — fit_heidi","title":"Fit model to data — fit_heidi","text":"Obtain MLE estimates model, given data","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit model to data — fit_heidi","text":"","code":"fit_model(data, model_function, model_args, optimizer_options, ...)"},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit model to data — fit_heidi","text":"data numeric vector containing data fit model . model_function function runs model returns data.frame r-values, organized data. model_args arguments train model function. Usually returned make_model_args. optimizer_options list options optimizer, returned get_optimizer_opts. ... Extra parameters passed optimizer call","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit model to data — fit_heidi","text":"list nloglik: negative log-likelihood model best_pars: MLE parameters model_pars: model-specific MLE parameters link_pars: link-specific MLE parameters data: data used fit model model_function: model function supplied user link_function: link function used process ll_function: log-likelihood function used search process model_args: model function arguments supplied user optimizer_options: optimizer options supplied user extra_pars: extra parameters passed optimizer call via ...","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_heidi.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Fit model to data — fit_heidi","text":"See calmr_fits vignette examples","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"An assortment of functions to help fit models — get_optimizer_opts","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"assortment functions help fit models","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"","code":"get_optimizer_opts( model_pars, initial_pars = rep(NA, length(model_pars)), ll = rep(NA, length(model_pars)), ul = rep(NA, length(model_pars)), optimizer = NULL, family = NULL )"},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"model_pars character vector specifying name parameters fit. initial_pars numeric vector specifying initial parameter values #' evaluate model (required optim). Defaults 0 parameter. ll, ul numeric vector specifying lower upper limits parameters fit, respectively optimizer string specifying optimizer use. One c(\"optim\", \"ga\") family string specifying family function generate responses (calculate likelihood function ). One c(\"identity\", \"normal\", \"poisson\").","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_helpers.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"An assortment of functions to help fit models — get_optimizer_opts","text":"Whenever family function identity used, family-specific parameters always appended end relevant lists.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit model to data — fit_model","title":"Fit model to data — fit_model","text":"Obtain MLE estimates model, given data.","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit model to data — fit_model","text":"","code":"fit_model(data, model_function, optimizer_options, file = NULL, ...)"},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit model to data — fit_model","text":"data numeric vector containing data fit model . model_function function runs model returns data.frame value, organized data. optimizer_options list options optimizer, returned get_optimizer_opts. file path save model fit. arguments fit call found identical file, model just gets loaded. ... Extra parameters passed optimizer call.","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit model to data — fit_model","text":"CalmrFit object","code":""},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Fit model to data — fit_model","text":"See calmr_fits vignette examples","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/fit_model.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit model to data — fit_model","text":"","code":"# Make some fake data df <- data.frame(g = \"g\", p1 = \"3A>(US)\", r1 = TRUE) pars <- get_parameters(df, model = \"RW1972\") pars$alphas[\"US\"] <- 0.9 exper <- make_experiment(df, parameters = pars, model = \"RW1972\") res <- run_experiment(exper, outputs = \"responses\") responses <- results(res)$responses$value # define model function model_fun <- function(p, ex) { np <- parameters(ex) np[[1]]$alphas[] <- p parameters(ex) <- np results(run_experiment(ex))$responses$value } # Get optimizer options optim_opts <- get_optimizer_opts( model_pars = names(pars$alphas), ll = rep(.05, 2), ul = rep(.95, 2), optimizer = \"optim\", family = \"identity\" ) optim_opts$initial_pars[] <- rep(.6, 2) fit_model(responses, model_fun, optim_opts, ex = exper, method = \"L-BFGS-B\", control = list(maxit = 1) ) #> Calmr model fit #> -------------- #> Parameters: #> A US #> 0.4386228 0.8962406 #> -------------- #> #> nLogLik: 11.029"},{"path":"https://victornavarro.org/calmr/reference/gen_ss_weights.html","id":null,"dir":"Reference","previous_headings":"","what":"Model support functions — gen_ss_weights","title":"Model support functions — gen_ss_weights","text":"assortment functions support models (mostly HeiDI)","code":""},{"path":"https://victornavarro.org/calmr/reference/gen_ss_weights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model support functions — gen_ss_weights","text":"","code":"gen_ss_weights(stims, default_val = 0)"},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":null,"dir":"Reference","previous_headings":"","what":"Get basic designs — get_design","title":"Get basic designs — get_design","text":"Get basic designs","code":""},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get basic designs — get_design","text":"","code":"get_design(design_name = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get basic designs — get_design","text":"design_name string specifying design name (default = NULL)","code":""},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get basic designs — get_design","text":"design_name NULL, data.frame containing design. Otherwise, list containing available designs.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_design.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get basic designs — get_design","text":"","code":"names(get_design()) #> [1] \"blocking\" \"relative_validity\" \"controlled_blocking\" get_design(\"blocking\") #> Group P1 R1 P2 R2 #> 1 Blocking 10N>(US) FALSE 10NL>(US)/10#L FALSE #> 2 Control FALSE 10NL>(US)/10#L FALSE"},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for an experiment — get_exp_opts","title":"Get options for an experiment — get_exp_opts","text":"Get options experiment","code":""},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for an experiment — get_exp_opts","text":"","code":"get_exp_opts(iterations = 1, miniblocks = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for an experiment — get_exp_opts","text":"iterations Numeric denoting number iterations run. Default = 1. miniblocks logical denoting whether create trial miniblocks possible. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for an experiment — get_exp_opts","text":"list default user-given options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get options for an experiment — get_exp_opts","text":"miniblocks option direct sampling function create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_exp_opts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get options for an experiment — get_exp_opts","text":"","code":"get_exp_opts(iterations = 10) #> $iterations #> [1] 10 #> #> $miniblocks #> [1] TRUE #>"},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for calmr graph — get_graph_opts","title":"Get options for calmr graph — get_graph_opts","text":"Get options calmr graph","code":""},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for calmr graph — get_graph_opts","text":"","code":"get_graph_opts(graph_size = \"small\")"},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for calmr graph — get_graph_opts","text":"graph_size string (either \"small\" \"large\"). return default values small large graphs","code":""},{"path":"https://victornavarro.org/calmr/reference/get_graph_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for calmr graph — get_graph_opts","text":"list graph options, passed ggnetwork::geom_nodes().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for calmr model — get_heidi_opts","title":"Get options for calmr model — get_heidi_opts","text":"Get options calmr model","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for calmr model — get_heidi_opts","text":"","code":"get_exp_opts(iterations = 1, miniblocks = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for calmr model — get_heidi_opts","text":"iterations integer denoting number iterations run. Default = 1. miniblocks logical denoting whether create trial miniblocks possible. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for calmr model — get_heidi_opts","text":"list default user-given options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get options for calmr model — get_heidi_opts","text":"miniblocks option direct sampling function (make_model_args) create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result lead miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_heidi_opts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get options for calmr model — get_heidi_opts","text":"","code":"get_exp_opts(iterations = 10) #> $iterations #> [1] 10 #> #> $miniblocks #> [1] TRUE #>"},{"path":"https://victornavarro.org/calmr/reference/get_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a model function — get_model","title":"Return a model function — get_model","text":"Given model string, returns model function can used elsewhere package.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a model function — get_model","text":"","code":"get_model(model_name)"},{"path":"https://victornavarro.org/calmr/reference/get_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a model function — get_model","text":"model_name string specifying model returned. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get options for a model — get_model_opts","title":"Get options for a model — get_model_opts","text":"Get options model","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get options for a model — get_model_opts","text":"","code":"get_exp_opts(iterations = 1, miniblocks = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get options for a model — get_model_opts","text":"iterations integer denoting number iterations run. Default = 1. miniblocks logical denoting whether create trial miniblocks possible. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get options for a model — get_model_opts","text":"list default user-given options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get options for a model — get_model_opts","text":"miniblocks option direct sampling function (make_model_args) create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_model_opts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get options for a model — get_model_opts","text":"","code":"get_exp_opts(iterations = 10) #> $iterations #> [1] 10 #> #> $miniblocks #> [1] TRUE #>"},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":null,"dir":"Reference","previous_headings":"","what":"Obtain model parameters — get_model_params","title":"Obtain model parameters — get_model_params","text":"Obtain model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Obtain model parameters — get_model_params","text":"","code":"get_model_params(design, model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Obtain model parameters — get_model_params","text":"design data.frame containing experimental design. model string specifying model. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_model_params.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Obtain model parameters — get_model_params","text":"data.frame model parameters, depending model.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get optimizer options — get_optimizer_opts","title":"Get optimizer options — get_optimizer_opts","text":"Get optimizer options","code":""},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get optimizer options — get_optimizer_opts","text":"","code":"get_optimizer_opts( model_pars, initial_pars = rep(NA, length(model_pars)), ll = rep(NA, length(model_pars)), ul = rep(NA, length(model_pars)), optimizer = NULL, family = NULL )"},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get optimizer options — get_optimizer_opts","text":"model_pars character vector specifying name parameters fit. initial_pars numeric vector specifying initial parameter values #' evaluate model (required optim). Defaults 0 parameter. ll, ul numeric vector specifying lower upper limits parameters fit, respectively optimizer string specifying optimizer use. One c(\"optim\", \"ga\") family string specifying family function generate responses (calculate likelihood function ). One c(\"identity\", \"normal\", \"poisson\").","code":""},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get optimizer options — get_optimizer_opts","text":"list optimizer options.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_optimizer_opts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get optimizer options — get_optimizer_opts","text":"Whenever family function identity used, family-specific parameters always appended end relevant lists.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":null,"dir":"Reference","previous_headings":"","what":"Get output from CalmrExperiment — get_output","title":"Get output from CalmrExperiment — get_output","text":"Returns tibble containing parsed outputs CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get output from CalmrExperiment — get_output","text":"","code":"get_output(object, type = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get output from CalmrExperiment — get_output","text":"object object class CalmrExperiment-class. type type output","code":""},{"path":"https://victornavarro.org/calmr/reference/get_output.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get output from CalmrExperiment — get_output","text":"data.frame model output","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Get model parameters — get_parameters","title":"Get model parameters — get_parameters","text":"Get model parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get model parameters — get_parameters","text":"","code":"get_parameters(design, model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get model parameters — get_parameters","text":"design data.frame containing experimental design. model string specifying model. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get model parameters — get_parameters","text":"list model parameters depending model","code":""},{"path":"https://victornavarro.org/calmr/reference/get_parameters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get model parameters — get_parameters","text":"","code":"block <- get_design(\"blocking\") get_parameters(block, model = \"SM2007\") #> $alphas #> L N US #> 0.4 0.4 0.4 #> #> $lambdas #> L N US #> 1 1 1 #> #> $omegas #> L N US #> 0.2 0.2 0.2 #> #> $rhos #> L N US #> 1 1 1 #> #> $gammas #> L N US #> 1 1 1 #> #> $taus #> L N US #> 0.2 0.2 0.2 #> #> $order #> [1] 1 #>"},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":null,"dir":"Reference","previous_headings":"","what":"Returns a data.frame with parameters for stimuli contained in design — get_params","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"Returns data.frame parameters stimuli contained design","code":""},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"","code":"get_model_params(design, default_par)"},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"design tibble experimental design, returned parse_design default_par float 0 1.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_params.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Returns a data.frame with parameters for stimuli contained in design — get_params","text":"data.frame columns stimulus alphas, stimulus name salience, respectively.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":null,"dir":"Reference","previous_headings":"","what":"Get timing design parameters — get_timings","title":"Get timing design parameters — get_timings","text":"Get timing design parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get timing design parameters — get_timings","text":"","code":"get_timings(design, model)"},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get timing design parameters — get_timings","text":"design data.frame containing experimental design. model One supported_timed_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get timing design parameters — get_timings","text":"list timing design parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/get_timings.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get timing design parameters — get_timings","text":"","code":"block <- get_design(\"blocking\") get_timings(block, model = \"TD\") #> $use_exponential #> [1] TRUE #> #> $time_resolution #> [1] 0.5 #> #> $trial_ts #> trial post_trial_delay mean_ITI max_ITI #> 1 N>(US) 1 30 90 #> 2 NL>(US) 1 30 90 #> 3 #L 1 30 90 #> #> $period_ts #> trial period stimulus stimulus_duration #> 1 N>(US) N N 1 #> 2 N>(US) (US) US 1 #> 3 NL>(US) NL N 1 #> 4 NL>(US) NL L 1 #> 5 NL>(US) (US) US 1 #> 6 #L L L 1 #> #> $transition_ts #> trial transition transition_delay #> 1 N>(US) N>(US) 1 #> 2 NL>(US) NL>(US) 1 #>"},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Graph model associations — graph,CalmrExperiment-method","title":"Graph model associations — graph,CalmrExperiment-method","text":"Creates network graph model associations","code":""},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Graph model associations — graph,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment graph(x, ...)"},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Graph model associations — graph,CalmrExperiment-method","text":"x object class CalmrModel-class CalmrExperiment-class. ... Additional parameters passed graph_weights function.","code":""},{"path":"https://victornavarro.org/calmr/reference/graph-CalmrExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Graph model associations — graph,CalmrExperiment-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a graph with calmr data — calmr_model_graph","title":"Create a graph with calmr data — calmr_model_graph","text":"Create graph calmr data","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a graph with calmr data — calmr_model_graph","text":"","code":"calmr_model_graph( x, loops = TRUE, limits = max(abs(x$value)) * c(-1, 1), colour_key = FALSE, t = max(x$trial), options = get_graph_opts() )"},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a graph with calmr data — calmr_model_graph","text":"x data.frame-like data use plot. Contains column named value. loops Logical. Whether draw arrows back forth limits Numerical. Limits color scale. Defaults max(abs(x$value))*c(-1,1). colour_key Logical. Whether show color key t trial weights obtained (defaults maximum trial data). options list graph options, returned get_graph_opts(). trial Numerical. trial graph.","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a graph with calmr data — calmr_model_graph","text":"'ggplot' object","code":""},{"path":"https://victornavarro.org/calmr/reference/graph.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Create a graph with calmr data — calmr_model_graph","text":"probably getting graphs via graph() method CalmrExperiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the HD2022 model — HD2022","title":"Train the HD2022 model — HD2022","text":"Train HD2022 model","code":""},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the HD2022 model — HD2022","text":"","code":"HD2022(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the HD2022 model — HD2022","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/HD2022.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the HD2022 model — HD2022","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the HDI2020 model — HDI2020","title":"Train the HDI2020 model — HDI2020","text":"Train HDI2020 model","code":""},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the HDI2020 model — HDI2020","text":"","code":"HDI2020(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the HDI2020 model — HDI2020","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/HDI2020.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the HDI2020 model — HDI2020","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_app.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the calmr GUI — heidi_app","title":"Run the calmr GUI — heidi_app","text":"Starts shiny application","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the calmr GUI — heidi_app","text":"","code":"calmr_app(browser = getOption(\"shiny.launch.browser\", interactive()))"},{"path":"https://victornavarro.org/calmr/reference/heidi_app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the calmr GUI — heidi_app","text":"browser TRUE, app launched browser.","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"An assortment of functions to help calmr — heidi_helpers","title":"An assortment of functions to help calmr — heidi_helpers","text":"get_model_params generates data.frame stimulus salience parameters. gen_ss_weights generates named matrix model weights. model_vs, parse_acts, parse_rs, parse_as parse_experiment parse raw outputs train_pav_model tibbles. filter_calmr_results convenience function filter specific phase trial_type data.","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assortment of functions to help calmr — heidi_helpers","text":"","code":"get_model_params(design, default_par = 0.2) gen_ss_weights(stims, default_val = 0) model_vs(mod) parse_acts(mod) parse_rs(mod) parse_as(mod) parse_experiment(raw_results) filter_calmr_results(parsed_results, filters)"},{"path":"https://victornavarro.org/calmr/reference/heidi_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"An assortment of functions to help calmr — heidi_helpers","text":"design data.frame containing experimental design. default_par float 0 1. stims character vector stimuli default_val Default alpha value mod model list, returned train_pav_model raw_results tibble model information, returned run_experiment parsed_results list parsed results, returned parse_experiment filters named list containing \"phase\" \"trial_type\" character vectors, filtering data","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/heidi_plots.html","id":null,"dir":"Reference","previous_headings":"","what":"Plotting functions for calmr models — plot_vs","title":"Plotting functions for calmr models — plot_vs","text":"plot_vs, plot_acts, plot_rs, plot_as plot weights, activations, r-values alphas model. make_plots convenience function generate plots one go. plot_common_scale rescales y-axis group plots, scale. get_plot_opts returns plotting options. graph creates graph model's weights given trial. get_graph_opts returns graphing options. make_graphs convenience function create group graphs, given model. patch_plots patch_graphs return composite plots graphs.","code":""},{"path":"https://victornavarro.org/calmr/reference/heidi_plots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plotting functions for calmr models — plot_vs","text":"","code":"plot_vs(vals) plot_acts(vals, bars = F) plot_rs(vals, simple = F) plot_as(vals) make_plots(parsed_model) plot_common_scale(plots) get_plot_opts(common_scale = TRUE) graph( weights, limits = max(abs(range(weights$value))) * c(-1, 1), t = max(weights$trial), graph_opts = get_graph_opts() ) get_graph_opts(graph_size = \"small\") make_graphs( parsed_model, limits = max(abs(range(parsed_model$vs$value))) * c(-1, 1), t = max(parsed_model$vs$trial), graph_opts = get_graph_opts() ) patch_graphs(graphs, selection = names(graphs)) patch_plots( plots, selection = NULL, type = NULL, plot_options = get_plot_opts() )"},{"path":"https://victornavarro.org/calmr/reference/heidi_plots.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plotting functions for calmr models — plot_vs","text":"vals data.frame containing parsed values. bars logical stipulating whether summarize use stacked bars, instead points lines. simple logical stipulating whether simplify plot collapsing across sources. parsed_model parsed model, returned parse_experiment. plots named list plots common_scale logical. Whether plot data common y-scale. weights data.frame containing parsed weights, returned parse_experiment limits vector length 2 specifying range weights. Defaults negative positive maximum absolute weights. t integer denoting trial weights graphed. Defaults last trial data. graph_opts list options graphing weights graph_size string specifying desired graph size, c(\"large\", \"small\"). Default \"large\". graphs list graphs, returned make_graphs selection character vector selected plots type string specifying type plots requested. One c(\"vs\", \"rs_simple\", \"rs_complex\", \"acts_learning\", \"acts_bar\", \"\") plot_options list options","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if object is Calmr experiment — is_experiment","title":"Check if object is Calmr experiment — is_experiment","text":"Check object Calmr experiment","code":""},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if object is Calmr experiment — is_experiment","text":"","code":"is_experiment(object)"},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if object is Calmr experiment — is_experiment","text":"object object checked","code":""},{"path":"https://victornavarro.org/calmr/reference/is_experiment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if object is Calmr experiment — is_experiment","text":"logical","code":""},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the MAC1975 model — MAC1975","title":"Train the MAC1975 model — MAC1975","text":"Train MAC1975 model","code":""},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the MAC1975 model — MAC1975","text":"","code":"MAC1975(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the MAC1975 model — MAC1975","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/MAC1975.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the MAC1975 model — MAC1975","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"Make CalmrExperiment — make_experiment","title":"Make CalmrExperiment — make_experiment","text":"Makes CalmrExperiment object containing arguments necessary run experiment.","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make CalmrExperiment — make_experiment","text":"","code":"make_experiment( design, model, parameters = NULL, timings = NULL, iterations = 1, miniblocks = TRUE, .callback_fn = NULL, ... )"},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make CalmrExperiment — make_experiment","text":"design design data.frame. model string specifying model name. One supported_models(). parameters Optional. Parameters model returned get_parameters(). timings Optional. Timings time-based design returned get_timings() iterations integer specifying number iterations per group. Default = 1. miniblocks Whether organize trials miniblocks. Default = TRUE. .callback_fn function keeping track progress. Internal use. ... Extra parameters passed functions.","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make CalmrExperiment — make_experiment","text":"CalmrExperiment object.","code":""},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Make CalmrExperiment — make_experiment","text":"miniblocks option direct sampling function create equally-sized miniblocks random trials within phase. example, phase string \"2A/2B\" create two miniblocks one trial. phase string \"2A/4B\" create two miniblocks one trial, 2 B trials. However, phase string \"2A/1B\" result miniblocks, even miniblocks set TRUE.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/make_experiment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make CalmrExperiment — make_experiment","text":"","code":"des <- data.frame(Group = \"G1\", P1 = \"10A>(US)\", R1 = TRUE) ps <- get_parameters(des, model = \"HD2022\") make_experiment( design = des, parameters = ps, model = \"HD2022\", iterations = 2 ) #> ----------------------------- #> CalmrExperiment with model: #> HD2022 #> ----------------------------- #> Design: #> Group P1 R1 #> 1 G1 10A>(US) TRUE #> ----------------------------- #> Parameters: #> $G1 #> $G1$alphas #> A US #> 0.4 0.4 #>"},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a tibble to fit a calmr model — make_heidi_args","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"Make tibble fit calmr model","code":""},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"","code":"make_model_args(design, pars, opts = get_exp_opts())"},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"design design tibble, returned parse_design pars data.frame containing parameters returned get_model_params opts list options returned get_exp_opts","code":""},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"tibble arguments required run model. row represents group experimental design.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/make_heidi_args.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make a tibble to fit a calmr model — make_heidi_args","text":"","code":"df <- data.frame(Group = c('Group 1', 'Group 2'), P1 = c('10AB(US)', '10A(US)'), R1 = c(TRUE, TRUE)) des <- parse_design(df) ps <- get_model_params(des, 0.2) make_model_args(design = des, pars = ps, opts = get_exp_opts(iterations = 1)) #> # A tibble: 2 x 15 #> # Rowwise: iteration #> iteration group tps is_test phase block_size trial_pre_func trial_post_func #> #> 1 1 Group~ #> 2 1 Group~ #> # ... with 7 more variables: trial_pre_nomi , trial_post_nomi , #> # trial_names , stim_alphas , unique_functional_stimuli , #> # unique_nominal_stimuli , nomi_func_map "},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a tibble to fit a calmr model — make_model_args","title":"Make a tibble to fit a calmr model — make_model_args","text":"Make tibble fit calmr model","code":""},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a tibble to fit a calmr model — make_model_args","text":"","code":"make_model_args(design, pars = NULL, model = NULL, opts = get_exp_opts())"},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a tibble to fit a calmr model — make_model_args","text":"design design data.frame pars data.frame containing parameters returned get_model_params model string specifying model name. One supported_models() opts list options returned get_exp_opts","code":""},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a tibble to fit a calmr model — make_model_args","text":"tibble arguments required run model. row represents group experimental design.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/make_model_args.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make a tibble to fit a calmr model — make_model_args","text":"","code":"des <- data.frame(Group = \"G1\", P1 = \"10A>(US)\", R1 = TRUE) ps <- get_model_params(des, model = \"HD2022\") op <- get_exp_opts(iterations = 1) make_model_args(design = des, pars = ps, model = \"HD2022\", opts = op) #> # A tibble: 1 x 6 #> model iteration group experience mapping alphas #> #> 1 HD2022 1 G1 "},{"path":"https://victornavarro.org/calmr/reference/model_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"An assortment of functions to help models — model_helpers","title":"An assortment of functions to help models — model_helpers","text":"get_model_params generates data.frame stimulus salience parameters. gen_ss_weights generates named matrix model weights. model_vs, parse_acts, parse_rs, parse_as parse_experiment_results parse raw outputs model tibbles. filter_calmr_results convenience function filter specific phase trial_type data.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An assortment of functions to help models — model_helpers","text":"","code":"gen_ss_weights(stims, default_val = 0) parse_model(model) parse_experiment_results(experiment, aggregate = T) aggregate_experiment_results(parsed_experiment) filter_calmr_results(parsed_experiment, filters)"},{"path":"https://victornavarro.org/calmr/reference/model_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"An assortment of functions to help models — model_helpers","text":"stims character vector stimuli default_val Default alpha value filters named list containing \"phase\" \"trial_type\" character vectors, filtering data design data.frame containing experimental design. mod model list raw_results tibble model information, returned run_experiment parsed_results list parsed results, returned parse_experiment_results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Miscellaneous information functions — information_functions","title":"Miscellaneous information functions — information_functions","text":"supported_models Returns models supported package. supported_plots, model_outputs Returns plots, outputs supported argument model. supported_families Returns families supported fit_model. supported_optimizers returns optimizers supported fit_model. supported_plots returns plots supported argument model. get_model Returns function specified argument model. parameter_info Returns parameter information model (model = NULL)","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Miscellaneous information functions — information_functions","text":"","code":"supported_models() supported_optimizers() supported_families() supported_plots(model = NULL) get_model(model) parameter_info(model = NULL) model_outputs(model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Miscellaneous information functions — information_functions","text":"model string specifying model. One supported_models()","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Miscellaneous information functions — information_functions","text":"character vector character vector character vector character vector model NULL. list otherwise. function list \"name\" (character vector parameter names \"default_value\" (numeric vector parameter values) character vector model NULL. list otherwise.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":null,"dir":"Reference","previous_headings":"","what":"Model information functions — model_information","title":"Model information functions — model_information","text":"assortment functions return model information.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model information functions — model_information","text":"","code":"supported_models() supported_timed_models() supported_optimizers() supported_families() supported_plots(model = NULL) get_model(model) model_parameters(model = NULL) model_outputs(model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model information functions — model_information","text":"model string specifying model. One supported_models().","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model information functions — model_information","text":"supported_models() returns character vector. supported_timed_models() returns character vector. supported_optimizers() returns character vector. supported_families() returns character vector. supported_plots() returns character vector list (model NULL). get_model() returns model function. model_parameters() returns list list lists (model NULL). model_outputs() returns character vector list (model NULL).","code":""},{"path":"https://victornavarro.org/calmr/reference/model_information.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model information functions — model_information","text":"","code":"# Outputs and plots supported by the RW1972 model model_outputs(\"RW1972\") #> [1] \"associations\" \"responses\" # Getting the model function implementing the PKH1982 model pkh_func <- get_model(\"PKH1982\") head(pkh_func, 10) #> #> 1 function (ev = NULL, iv = NULL, parameters, experience, mapping, #> 2 ...) #> 3 { #> 4 .assert_no_functional(mapping) #> 5 ntrials <- length(experience$tp) #> 6 fsnames <- mapping$unique_functional_stimuli #> 7 if (is.null(ev)) { #> 8 ev <- gen_ss_weights(fsnames) #> 9 } #> 10 if (is.null(iv)) { # Getting the parameters required by SM2007 model_parameters(\"SM2007\") #> $name #> [1] \"alphas\" \"lambdas\" \"omegas\" \"rhos\" \"gammas\" \"taus\" \"order\" #> #> $default_value #> [1] 0.4 1.0 0.2 1.0 1.0 0.2 1.0 #>"},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":null,"dir":"Reference","previous_headings":"","what":"Miscellaneous information functions — supported_models","title":"Miscellaneous information functions — supported_models","text":"Miscellaneous information functions","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Miscellaneous information functions — supported_models","text":"","code":"supported_models() supported_optimizers() supported_families() supported_plots(model = NULL)"},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Miscellaneous information functions — supported_models","text":"model string specifying model. One supported_models()","code":""},{"path":"https://victornavarro.org/calmr/reference/model_info_funcs.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Miscellaneous information functions — supported_models","text":"supported_models returns models supported package. supported_plots returns plots supported argument model. supported_families returns families supported fit_model. supported_optimizers returns optimizers supported fit_model. suported_plots returns plots supported argument model.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_plots.html","id":null,"dir":"Reference","previous_headings":"","what":"Plotting functions for calmr models — plot_vs","title":"Plotting functions for calmr models — plot_vs","text":"plot_vs, plot_acts, plot_rs, plot_as plot weights, activations, r-values alphas model. make_plots convenience function generate plots one go. plot_common_scale rescales y-axis group plots, scale. get_plot_opts returns plotting options. graph_weights creates graph_weights model's weights given trial. get_graph_opts returns graphing options. make_graphs convenience function create group graphs, given model. patch_plots patch_graphs return composite plots graphs.","code":""},{"path":"https://victornavarro.org/calmr/reference/model_plots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plotting functions for calmr models — plot_vs","text":"","code":"plot_vs(vals) plot_acts(vals) plot_rs(vals, simple = F) plot_as(vals) plot_os(vals)"},{"path":"https://victornavarro.org/calmr/reference/model_plots.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plotting functions for calmr models — plot_vs","text":"vals data.frame containing parsed values. simple logical stipulating whether simplify plot collapsing across sources. bars logical stipulating whether summarize use stacked bars, instead points lines. parsed_results parsed experiment, returned parse_experiment_results. plots named list plots selection character vector selected plots type string specifying type plots requested. One c(\"vs\", \"rs_simple\", \"rs_complex\", \"acts_learning\", \"acts_bar\", \"\") plot_options list options common_scale logical. Whether plot data common y-scale. weights data.frame containing parsed weights, returned parse_experiment_results t integer denoting trial weights graphed. Defaults last trial data. limits vector length 2 specifying range weights. Defaults negative positive maximum absolute weights. graph_opts list options graphing weights graph_size string specifying desired graph size, c(\"large\", \"small\"). Default \"large\". graphs list graphs, returned make_graphs","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":null,"dir":"Reference","previous_headings":"","what":"NLL of CalmrFit — NLL","title":"NLL of CalmrFit — NLL","text":"Returns negative log likelihood model fit via calmr::fit_model","code":""},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NLL of CalmrFit — NLL","text":"","code":"NLL(object, ...)"},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"NLL of CalmrFit — NLL","text":"object object class CalmrFit-class. ... Unused","code":""},{"path":"https://victornavarro.org/calmr/reference/NLL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"NLL of CalmrFit — NLL","text":"numeric","code":""},{"path":"https://victornavarro.org/calmr/reference/options.html","id":null,"dir":"Reference","previous_headings":"","what":"Get optimizer options — get_optimizer_opts","title":"Get optimizer options — get_optimizer_opts","text":"Get optimizer options","code":""},{"path":"https://victornavarro.org/calmr/reference/options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get optimizer options — get_optimizer_opts","text":"","code":"get_optimizer_opts( model_pars, initial_pars = rep(NA, length(model_pars)), ll = rep(NA, length(model_pars)), ul = rep(NA, length(model_pars)), optimizer = NULL, family = NULL )"},{"path":"https://victornavarro.org/calmr/reference/options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get optimizer options — get_optimizer_opts","text":"model_pars character vector specifying name parameters fit. initial_pars numeric vector specifying initial parameter values #' evaluate model (required optim). Defaults 0 parameter. ll, ul numeric vector specifying lower upper limits parameters fit, respectively optimizer string specifying optimizer use. One c(\"optim\", \"ga\") family string specifying family function generate responses (calculate likelihood function ). One c(\"identity\", \"normal\", \"poisson\").","code":""},{"path":"https://victornavarro.org/calmr/reference/options.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get optimizer options — get_optimizer_opts","text":"Whenever family function identity used, family-specific parameters always appended end relevant lists.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve/set parameters from/in CalmrExperiment — parameters","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"Retrieve/set parameters /CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"","code":"parameters(x) parameters(x) <- value"},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"x CalmrExperiment object value list parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/parameters.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Retrieve/set parameters from/in CalmrExperiment — parameters","text":"passing list parameters (returned get_parameters), set method overwrite rows experiment. Passing list lists replace row--row basis.","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse design data.frame — parse_design","title":"Parse design data.frame — parse_design","text":"Parse design data.frame","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse design data.frame — parse_design","text":"","code":"parse_design(df)"},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse design data.frame — parse_design","text":"df data.frame dimensions (groups) (2*phases+1).","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse design data.frame — parse_design","text":"CalmrDesign object.","code":""},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Parse design data.frame — parse_design","text":"entry even-numbered columns df string formatted per phase_parser().","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/parse_design.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse design data.frame — parse_design","text":"","code":"df <- data.frame( Group = c(\"Group 1\", \"Group 2\"), P1 = c(\"10AB(US)\", \"10A(US)\"), R1 = c(TRUE, TRUE) ) parse_design(df) #> CalmrDesign built from data.frame: #> Group P1 R1 #> 1 Group 1 10AB(US) TRUE #> 2 Group 2 10A(US) TRUE #> ---------------- #> Trials detected: #> group phase trial_names trial_repeats is_test stimuli #> 1 Group 1 P1 AB(US) 10 FALSE A;B;US #> 2 Group 2 P1 A(US) 10 FALSE A;US"},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":null,"dir":"Reference","previous_headings":"","what":"Patch Calmr graphs — patch_graphs","title":"Patch Calmr graphs — patch_graphs","text":"Convenience function patch graphs 'patchwork'","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patch Calmr graphs — patch_graphs","text":"","code":"patch_graphs(graphs, selection = names(graphs))"},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Patch Calmr graphs — patch_graphs","text":"graphs list named graphs, returned graph() calmr_model_graph() selection character numeric vector determining plots patch.","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_graphs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Patch Calmr graphs — patch_graphs","text":"'patchwork' object","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":null,"dir":"Reference","previous_headings":"","what":"Patch Calmr plots — patch_plots","title":"Patch Calmr plots — patch_plots","text":"Convenience function patch plots patchwork","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patch Calmr plots — patch_plots","text":"","code":"patch_plots(plots, selection = names(plots), plot_options = get_plot_opts())"},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Patch Calmr plots — patch_plots","text":"plots list named plots, returned calmr::plot selection character numeric vector determining plots patch plot_options list plot options returned get_plot_opts","code":""},{"path":"https://victornavarro.org/calmr/reference/patch_plots.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Patch Calmr plots — patch_plots","text":"patchwork object","code":""},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":null,"dir":"Reference","previous_headings":"","what":"Rat responses from Patittucci et al. 2016 — pati","title":"Rat responses from Patittucci et al. 2016 — pati","text":"dataset containing rat nose pokes lever presses levers associated different appetitive stimuli.","code":""},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rat responses from Patittucci et al. 2016 — pati","text":"","code":"pati"},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Rat responses from Patittucci et al. 2016 — pati","text":"data.frame following variables: subject subject identifier block 2-session block training (1 8) lever lever presented trial: L = left; R = right us stimulus followed lever: P = pellet; S = sucrose response response: lp = lever press; np = nose poke rpert responses per trial","code":""},{"path":"https://victornavarro.org/calmr/reference/pati.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Rat responses from Patittucci et al. 2016 — pati","text":"Patittucci et al. (2016). JEP:ALC","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":null,"dir":"Reference","previous_headings":"","what":"Parses a phase string — phase_parser","title":"Parses a phase string — phase_parser","text":"Parses phase string","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parses a phase string — phase_parser","text":"","code":"phase_parser(phase_string)"},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parses a phase string — phase_parser","text":"phase_string string specifying trials within phase.","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parses a phase string — phase_parser","text":"named list : trial_info: trial-named list lists. general_info: General phase information.","code":""},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Parses a phase string — phase_parser","text":"function meant internal use , expose can test strings.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/phase_parser.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parses a phase string — phase_parser","text":"","code":"# A silly (but valid) string phase_parser(\"10#Rescorla>Wagner\") #> $trial_info #> $trial_info$`10#Rescorla>Wagner` #> $trial_info$`10#Rescorla>Wagner`$name #> [1] \"#Rescorla>Wagner\" #> #> $trial_info$`10#Rescorla>Wagner`$repetitions #> [1] 10 #> #> $trial_info$`10#Rescorla>Wagner`$is_test #> [1] TRUE #> #> $trial_info$`10#Rescorla>Wagner`$periods #> [1] \"Rescorla\" \"Wagner\" #> #> $trial_info$`10#Rescorla>Wagner`$nominals #> $trial_info$`10#Rescorla>Wagner`$nominals$Rescorla #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" #> #> $trial_info$`10#Rescorla>Wagner`$nominals$Wagner #> [1] \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> #> $trial_info$`10#Rescorla>Wagner`$functionals #> $trial_info$`10#Rescorla>Wagner`$functionals$Rescorla #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" #> #> $trial_info$`10#Rescorla>Wagner`$functionals$Wagner #> [1] \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> #> $trial_info$`10#Rescorla>Wagner`$all_nominals #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> $trial_info$`10#Rescorla>Wagner`$all_functionals #> [1] \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"a\" \"g\" \"n\" \"e\" \"r\" #> #> #> #> $general_info #> $general_info$trial_names #> [1] \"#Rescorla>Wagner\" #> #> $general_info$trial_repeats #> [1] 10 #> #> $general_info$is_test #> [1] TRUE #> #> $general_info$nomi2func #> R e s c o r l a W g n #> \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"g\" \"n\" #> #> $general_info$func2nomi #> R e s c o r l a W g n #> \"R\" \"e\" \"s\" \"c\" \"o\" \"r\" \"l\" \"a\" \"W\" \"g\" \"n\" #> #> # An invalid string that needs trial repetitions for one of trials. try(phase_parser(\"10#Rescorla/Wagner\")) #> Error in if (is.na(treps)) 1 else treps : argument is of length zero"},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://victornavarro.org/calmr/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the PKH1982 model — PKH1982","title":"Train the PKH1982 model — PKH1982","text":"Train PKH1982 model","code":""},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the PKH1982 model — PKH1982","text":"","code":"PKH1982(ev = NULL, iv = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the PKH1982 model — PKH1982","text":"ev (optional) named matrix dimensions S,S; S number stimuli. iv (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/PKH1982.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the PKH1982 model — PKH1982","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot CalmrExperiment — plot,CalmrExperiment-method","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"Creates plot depicting results CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment plot(x, type = NULL, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"x object class CalmrExperiment-class. type string specifying type plot create. See ??supported_plots. ... Additional parameters passed plotting function.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot CalmrExperiment — plot,CalmrExperiment-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot RSA — plot,CalmrRSA-method","title":"Plot RSA — plot,CalmrRSA-method","text":"Plot correlogram RSA results","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot RSA — plot,CalmrRSA-method","text":"","code":"# S4 method for CalmrRSA plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot RSA — plot,CalmrRSA-method","text":"x object class CalmrRSA-class. ... Additional parameters passed plotting function.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSA-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot RSA — plot,CalmrRSA-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot RSA test — plot,CalmrRSATest-method","title":"Plot RSA test — plot,CalmrRSATest-method","text":"Plot correlogram RSA test results","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot RSA test — plot,CalmrRSATest-method","text":"","code":"# S4 method for CalmrRSATest plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot RSA test — plot,CalmrRSATest-method","text":"x object class CalmrRSATest-class. ... Additional parameters passed plotting function.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot-CalmrRSATest-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot RSA test — plot,CalmrRSATest-method","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot CalmrExperiment — plot","title":"Plot CalmrExperiment — plot","text":"Creates plots (plot) aggregated results CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot CalmrExperiment — plot","text":"","code":"plot(x, y, ...)"},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot CalmrExperiment — plot","text":"x object class CalmrExperiment. type character vector specifying types plots create. See ??supported_plots. Defaults NULL.","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot CalmrExperiment — plot","text":"ggplot object","code":""},{"path":"https://victornavarro.org/calmr/reference/plot.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Plot CalmrExperiment — plot","text":"type = NULL, supported plots returned.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":null,"dir":"Reference","previous_headings":"","what":"General plotting functions — plotting_functions","title":"General plotting functions — plotting_functions","text":"plot_targetted_tbins() plots targetted time data trial. plot_tbins() plots non-targetted time data trial. plot_targetted_trials() plots targetted trial data. plot_trials() plots non-targetted trial data. plot_targetted_typed_trials() plots targetted trial data type. plot_targetted_complex_trials() plots targetted data third variable.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"General plotting functions — plotting_functions","text":"","code":"plot_targetted_tbins(data, t = max(data$trial)) plot_tbins(data, t = max(data$trial)) plot_targetted_trials(data) plot_trials(data) plot_targetted_typed_trials(data) plot_targetted_complex_trials(data, col)"},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"General plotting functions — plotting_functions","text":"data data.frame-like data plot. t numeric vector specifying trial(s) plot. Defaults last trial data. col string specifying column third variable.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"General plotting functions — plotting_functions","text":"plot_targetted_tbins() returns 'ggplot' object. plot_tbins() returns 'ggplot' object. plot_targetted_trials() returns 'ggplot' object. plot_trials() returns 'ggplot' object. plot_targetted_typed_trials() returns 'ggplot' object. plot_targetted_complex_trials() returns 'ggplot' object.","code":""},{"path":"https://victornavarro.org/calmr/reference/plotting_functions.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"General plotting functions — plotting_functions","text":"data must organised returned results() parsed_results().","code":""},{"path":"https://victornavarro.org/calmr/reference/predict-CalmrFit-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Predict from CalmrFit — predict,CalmrFit-method","title":"Predict from CalmrFit — predict,CalmrFit-method","text":"Obtain prediction CalmrFit","code":""},{"path":"https://victornavarro.org/calmr/reference/predict-CalmrFit-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Predict from CalmrFit — predict,CalmrFit-method","text":"","code":"# S4 method for CalmrFit predict(object, type = \"response\", ...)"},{"path":"https://victornavarro.org/calmr/reference/predict-CalmrFit-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Predict from CalmrFit — predict,CalmrFit-method","text":"object object class CalmrFit-class. type string. response, model responses transformed via link function. ... Additional parameters passed function (object@model_function).","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the HeiDI model (quickly) — quick_heidi","title":"Run the HeiDI model (quickly) — quick_heidi","text":"Runs model minimal parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the HeiDI model (quickly) — quick_heidi","text":"","code":"run_experiment(design, param_df = NULL, options = NULL, parse = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the HeiDI model (quickly) — quick_heidi","text":"design data.frame dimensions G,2*P+1; G number groups P number phases. param_df data.frame dimensions N,2; N number stimuli experimental design. options list options, returned get_exp_opts. parse logical specifying whether results parsed via parse_experiment. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run the HeiDI model (quickly) — quick_heidi","text":"list parsed results tibble raw results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Run a model (quickly) — quick_model","title":"Run a model (quickly) — quick_model","text":"Runs model minimal parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run a model (quickly) — quick_model","text":"","code":"run_experiment( design, model = NULL, param_df = NULL, options = NULL, parse = TRUE )"},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run a model (quickly) — quick_model","text":"design data.frame dimensions G,2*P+1; G number groups P number phases. param_df data.frame dimensions N,2; N number stimuli experimental design. options list options, returned get_exp_opts. parse logical specifying whether results parsed via parse_experiment_results. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/quick_model.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run a model (quickly) — quick_model","text":"list parsed results tibble raw results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the RAND model — RAND","title":"Train the RAND model — RAND","text":"Train RAND model","code":""},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the RAND model — RAND","text":"","code":"RAND(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the RAND model — RAND","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/RAND.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the RAND model — RAND","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/results.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract aggregated results from CalmrExperiment — results","title":"Extract aggregated results from CalmrExperiment — results","text":"Extract aggregated results CalmrExperiment Extract aggregated results CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/results.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract aggregated results from CalmrExperiment — results","text":"","code":"results(object) results(object)"},{"path":"https://victornavarro.org/calmr/reference/results.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract aggregated results from CalmrExperiment — results","text":"object object class CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/results.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract aggregated results from CalmrExperiment — results","text":"tbl containing models (rows) model outputs (columns) tbl containing models (rows) model outputs (columns)","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"Perform representational similarity analysis CalmExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"","code":"# S4 method for CalmExperiment rsa(x, comparisons, test = FALSE, ...)"},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"x tbl m o (models outputs) aggregated results. comparisons model-named list containing model outputs compare. test Whether test RSA via permutation test. Default = FALSE. ... Additional parameters passed stats::dist stats::cor","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"CalmRSA object","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"object returned function can later tested via test method.","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmExperiment-method.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform representational similarity analysis on CalmExperiment — rsa,CalmExperiment-method","text":"","code":"# Comparing the associations in three models exp <- data.frame( Group = c(\"A\", \"B\"), P1 = c(\"2(A)>(US)/1B>(US)\", \"1(A)>(US)/2B>(US)\"), R1 = TRUE ) exp <- parse_design(exp) models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") parameters <- sapply(models, get_parameters, design = exp) options <- get_exp_opts() exp_res <- compare_models(exp, models = models, parameters = parameters, options = options ) comparisons <- list( \"HD2022\" = c(\"vs\"), \"RW1972\" = c(\"vs\"), \"PKH1982\" = c(\"eivs\") ) res <- rsa(exp_res, comparisons = comparisons) test(res, n_samples = 100) #> CalmRSA object #> --------------- #> Correlation matrix: #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs 1.0000000 1.0000000 -0.9223956 #> RW1972.vs 1.0000000 1.0000000 -0.9223956 #> PKH1982.eivs -0.9223956 -0.9223956 1.0000000 #> #> Significance matrix: #> #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs FALSE FALSE FALSE #> RW1972.vs FALSE FALSE FALSE #> PKH1982.eivs FALSE FALSE FALSE #> #> 100 permutation samples, two-tailed test with alpha = 0.05."},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"Perform representational similarity analysis CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment rsa(x, comparisons, test = FALSE, ...)"},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"x tbl m o (models outputs) aggregated results. comparisons model-named list containing model outputs compare. test Whether test RSA via permutation test. Default = FALSE. ... Additional parameters passed stats::dist stats::cor","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"CalmrRSA object","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"object returned function can later tested via test method.","code":""},{"path":"https://victornavarro.org/calmr/reference/rsa-CalmrExperiment-method.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform representational similarity analysis on CalmrExperiment — rsa,CalmrExperiment-method","text":"","code":"# Comparing the associations in three models exp <- data.frame( Group = c(\"A\", \"B\"), P1 = c(\"2(A)>(US)/1B>(US)\", \"1(A)>(US)/2B>(US)\"), R1 = TRUE ) exp <- parse_design(exp) models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") parameters <- sapply(models, get_parameters, design = exp) options <- get_exp_opts() exp_res <- compare_models(exp, models = models, parameters = parameters, options = options ) comparisons <- list( \"HD2022\" = c(\"vs\"), \"RW1972\" = c(\"vs\"), \"PKH1982\" = c(\"eivs\") ) res <- rsa(exp_res, comparisons = comparisons) test(res, n_samples = 100) #> CalmrRSA object #> --------------- #> Correlation matrix: #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs 1.0000000 1.0000000 -0.9223956 #> RW1972.vs 1.0000000 1.0000000 -0.9223956 #> PKH1982.eivs -0.9223956 -0.9223956 1.0000000 #> #> Significance matrix: #> #> HD2022.vs RW1972.vs PKH1982.eivs #> HD2022.vs FALSE FALSE FALSE #> RW1972.vs FALSE FALSE FALSE #> PKH1982.eivs FALSE FALSE FALSE #> #> 100 permutation samples, two-tailed test with alpha = 0.05."},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform representational similarity analysis — rsa","title":"Perform representational similarity analysis — rsa","text":"Perform representational similarity analysis","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform representational similarity analysis — rsa","text":"","code":"rsa(x, comparisons, test = FALSE, ...)"},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform representational similarity analysis — rsa","text":"x list CalmrExperiment objects comparisons model-named list containing model outputs compare. test Whether test RSA via permutation test. Default = FALSE. ... Additional parameters passed stats::dist() stats::cor()","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform representational similarity analysis — rsa","text":"CalmrRSA object","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Perform representational similarity analysis — rsa","text":"object returned function can later tested via test() method.","code":""},{"path":"https://victornavarro.org/calmr/reference/RSA.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform representational similarity analysis — rsa","text":"","code":"# Comparing the associations in three models exp <- data.frame( Group = c(\"A\", \"B\"), P1 = c(\"2(A)>(US)/1B>(US)\", \"1(A)>(US)/2B>(US)\"), R1 = TRUE ) models <- c(\"HD2022\", \"RW1972\", \"PKH1982\") parameters <- sapply(models, get_parameters, design = exp) exp_res <- compare_models(exp, models = models ) comparisons <- list( \"HD2022\" = c(\"associations\"), \"RW1972\" = c(\"associations\"), \"PKH1982\" = c(\"associations\") ) res <- rsa(exp_res, comparisons = comparisons) test(res, n_samples = 20) #> CalmrRSA object #> --------------- #> Correlation matrix: #> HD2022.associations RW1972.associations #> HD2022.associations 1.00000000 0.05460654 #> RW1972.associations 0.05460654 1.00000000 #> PKH1982.associations -0.92239565 0.33530125 #> PKH1982.associations #> HD2022.associations -0.9223956 #> RW1972.associations 0.3353012 #> PKH1982.associations 1.0000000 #> --------------- #> Significance matrix: #> HD2022.associations RW1972.associations #> HD2022.associations FALSE FALSE #> RW1972.associations FALSE FALSE #> PKH1982.associations FALSE FALSE #> PKH1982.associations #> HD2022.associations FALSE #> RW1972.associations FALSE #> PKH1982.associations FALSE #> From 20 permutation samples, two-tailed test with alpha = 0.05."},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":null,"dir":"Reference","previous_headings":"","what":"Run experiment — run_experiment","title":"Run experiment — run_experiment","text":"Runs experiment minimal parameters.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run experiment — run_experiment","text":"","code":"run_experiment(x, outputs = NULL, parse = TRUE, aggregate = TRUE, ...)"},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run experiment — run_experiment","text":"x CalmrExperiment design data.frame outputs character vector specifying outputs parse aggregate. Defaults NULL, case model outputs parsed/aggregated. parse logical specifying whether raw results parsed. Default = TRUE. aggregate logical specifying whether parsed results aggregated. Default = TRUE. ... Arguments passed functions","code":""},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run experiment — run_experiment","text":"CalmrExperiment results.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_experiment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run experiment — run_experiment","text":"","code":"# Using a data.frame only (throws warning) df <- get_design(\"relative_validity\") run_experiment(df, model = \"RW1972\") #> Warning: Using default model parameters. #> ----------------------------- #> CalmrExperiment with model: #> RW1972 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 True 10AB(US)/10AC TRUE 1#A TRUE #> 2 Pseudo 5AB(US)/5AB/5AC(US)/5AC TRUE 1#A TRUE #> ----------------------------- #> Parameters: #> $True #> $True$alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $True$betas_on #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $True$betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $True$lambdas #> A B C US #> 1 1 1 1 #> #> #> $Pseudo #> $Pseudo$alphas #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $Pseudo$betas_on #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $Pseudo$betas_off #> A B C US #> 0.4 0.4 0.4 0.4 #> #> $Pseudo$lambdas #> A B C US #> 1 1 1 1 #> # Using custom parameters df <- get_design(\"relative_validity\") pars <- get_parameters(df, model = \"HD2022\") pars$alphas[\"US\"] <- 0.6 run_experiment(df, parameters = pars, model = \"HD2022\") #> ----------------------------- #> CalmrExperiment with model: #> HD2022 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 True 10AB(US)/10AC TRUE 1#A TRUE #> 2 Pseudo 5AB(US)/5AB/5AC(US)/5AC TRUE 1#A TRUE #> ----------------------------- #> Parameters: #> $True #> $True$alphas #> A B C US #> 0.4 0.4 0.4 0.6 #> #> #> $Pseudo #> $Pseudo$alphas #> A B C US #> 0.4 0.4 0.4 0.6 #> # Using make_experiment, for more iterations df <- get_design(\"blocking\") pars <- get_parameters(df, model = \"SM2007\") exper <- make_experiment(df, parameters = pars, model = \"SM2007\", iterations = 4 ) run_experiment(exper) #> ----------------------------- #> CalmrExperiment with model: #> SM2007 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 Blocking 10N>(US) FALSE 10NL>(US)/10#L FALSE #> 2 Control FALSE 10NL>(US)/10#L FALSE #> ----------------------------- #> Parameters: #> $Blocking #> $Blocking$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Blocking$lambdas #> L N US #> 1 1 1 #> #> $Blocking$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$rhos #> L N US #> 1 1 1 #> #> $Blocking$gammas #> L N US #> 1 1 1 #> #> $Blocking$taus #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$order #> [1] 1 #> #> #> $Control #> $Control$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Control$lambdas #> L N US #> 1 1 1 #> #> $Control$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Control$rhos #> L N US #> 1 1 1 #> #> $Control$gammas #> L N US #> 1 1 1 #> #> $Control$taus #> L N US #> 0.2 0.2 0.2 #> #> $Control$order #> [1] 1 #> # Only parsing the associations in the model, without aggregation run_experiment(exper, outputs = \"associations\", aggregate = FALSE) #> ----------------------------- #> CalmrExperiment with model: #> SM2007 #> ----------------------------- #> Design: #> Group P1 R1 P2 R2 #> 1 Blocking 10N>(US) FALSE 10NL>(US)/10#L FALSE #> 2 Control FALSE 10NL>(US)/10#L FALSE #> ----------------------------- #> Parameters: #> $Blocking #> $Blocking$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Blocking$lambdas #> L N US #> 1 1 1 #> #> $Blocking$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$rhos #> L N US #> 1 1 1 #> #> $Blocking$gammas #> L N US #> 1 1 1 #> #> $Blocking$taus #> L N US #> 0.2 0.2 0.2 #> #> $Blocking$order #> [1] 1 #> #> #> $Control #> $Control$alphas #> L N US #> 0.4 0.4 0.4 #> #> $Control$lambdas #> L N US #> 1 1 1 #> #> $Control$omegas #> L N US #> 0.2 0.2 0.2 #> #> $Control$rhos #> L N US #> 1 1 1 #> #> $Control$gammas #> L N US #> 1 1 1 #> #> $Control$taus #> L N US #> 0.2 0.2 0.2 #> #> $Control$order #> [1] 1 #>"},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the HeiDI model — run_heidi","title":"Run the HeiDI model — run_heidi","text":"Runs model specific arguments.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the HeiDI model — run_heidi","text":"","code":"run_model(args, parse = TRUE)"},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the HeiDI model — run_heidi","text":"args tibble returned make_model_args. parse logical specifying whether results parsed. Default = TRUE.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run the HeiDI model — run_heidi","text":"list parsed results tibble raw results","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Run a model — run_model","title":"Run a model — run_model","text":"Runs model specific arguments.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run a model — run_model","text":"","code":"run_model(args, parse = T, ...)"},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run a model — run_model","text":"args tibble returned make_model_args. parse logical specifying whether results parsed.","code":""},{"path":"https://victornavarro.org/calmr/reference/run_model.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run a model — run_model","text":"CalmrExperiment object.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the RW1972 model — RW1972","title":"Train the RW1972 model — RW1972","text":"Train RW1972 model","code":""},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the RW1972 model — RW1972","text":"","code":"RW1972(v = NULL, parameters, experience, mapping, ...)"},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the RW1972 model — RW1972","text":"v (optional) named matrix dimensions S,S; S number stimuli. parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/RW1972.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the RW1972 model — RW1972","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":null,"dir":"Reference","previous_headings":"","what":"Get/set the colour/fill palette for plots — set_calmr_palette","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"Get/set colour/fill palette plots","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"","code":"set_calmr_palette(palette = NULL)"},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"palette string specifying available palettes. NULL, returns available palettes.","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"old palette (invisibly) palette NULL. Otherwise, character vector available palettes.","code":""},{"path":"https://victornavarro.org/calmr/reference/set_calmr_palette.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get/set the colour/fill palette for plots — set_calmr_palette","text":"Changes affect palette used graphs.","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Set reward parameters for ANCCR model — set_reward_parameters","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"Set reward parameters ANCCR model","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"","code":"set_reward_parameters(parameters, rewards = c(\"US\"))"},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"parameters list parameters, returned get_parameters() rewards character vector specifying reward stimuli. Default = c(\"US\")","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"list parameters","code":""},{"path":"https://victornavarro.org/calmr/reference/set_reward_parameters.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set reward parameters for ANCCR model — set_reward_parameters","text":"default behaviour get_parameters ANCCR model set every reward-related parameter non-zero default value. function set parameters zero non-reward stimuli","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the SM2007 model — SM2007","title":"Train the SM2007 model — SM2007","text":"Train SM2007 model","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the SM2007 model — SM2007","text":"","code":"SM2007( v = NULL, o = NULL, parameters, experience, mapping, debug = FALSE, comparator_func = .witnauer_comparator_proc, ... )"},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the SM2007 model — SM2007","text":"v (optional) named matrix dimensions S,S; S number stimuli. o (optional) named matrix dimensions S,S,S (operator switches). parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment debug logical specifying whether print information comparison process. Defaults FALSE. comparator_func function used comparison process. Either .witnauer_comparator_funcor .comparator_func. ... Additional named arguments","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the SM2007 model — SM2007","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/SM2007.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Train the SM2007 model — SM2007","text":"Correct usage v o parameters requires matrices adhere specific format. v, entry ,j represents association stimulus stimulus j. o, entry ,k,j represents operator switch stimulus comparator k respect stimulus j.","code":""},{"path":"https://victornavarro.org/calmr/reference/summary-CalmrExperiment-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarise CalmrExperiment — summary,CalmrExperiment-method","title":"Summarise CalmrExperiment — summary,CalmrExperiment-method","text":"Shows summary CalmrExperiment","code":""},{"path":"https://victornavarro.org/calmr/reference/summary-CalmrExperiment-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarise CalmrExperiment — summary,CalmrExperiment-method","text":"","code":"# S4 method for CalmrExperiment summary(object, ...)"},{"path":"https://victornavarro.org/calmr/reference/summary-CalmrExperiment-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarise CalmrExperiment — summary,CalmrExperiment-method","text":"object object class CalmrExperiment-class. ... Additional parameters passed summary function.","code":""},{"path":[]},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":null,"dir":"Reference","previous_headings":"","what":"Train the TD model — TD","title":"Train the TD model — TD","text":"Train TD model","code":""},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train the TD model — TD","text":"","code":"TD(parameters, experience, mapping, debug = FALSE, debug_t = -1, ...)"},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train the TD model — TD","text":"parameters list containing model parameters, returned get_parameters(). experience data.frame specifying trials rows, returned make_experiment mapping named list specifying trial stimulus mapping, returned make_experiment","code":""},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Train the TD model — TD","text":"list raw results","code":""},{"path":"https://victornavarro.org/calmr/reference/TD.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Train the TD model — TD","text":"model highly experimental state. Use caution.","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":null,"dir":"Reference","previous_headings":"","what":"Trains a Pavlovian HeiDI — train_pav_heidi","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"Trains Pavlovian HeiDI","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"","code":"train_pav_model( sals, V, tps, trial_pre_func, trial_post_func, trial_pre_nomi, trial_post_nomi, nomi_func_map, trial_names, phase, block_size, is_test )"},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"sals named vector stimulus saliences. V named matrix dimensions S,S; S number stimuli. tps vector trial pointers training, function trials. trial_pre_func list length T, character vectors specifying functional stimuli involved expectation part trial. T number unique trials experiment. trial_post_func , correction part trial. trial_pre_nomi list length T, character vectors specifying nominal stimuli involved expectation part trial. trial_post_nomi , correction part trial. nomi_func_map data.frame mappings nominal functional stimuli trial_names character vector length T names trials phase character vector length T names phases block_size integer vector length T specifying block size per trial is_test logical vector specifying whether trial result learning (update V). element TRUE, update occurs.","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"list vs, rs - Arrays dimensions P,S,S; P number trials used train model S number stimuli involved experiment. Respectively, vs rs contain stimulus weights stimulus-specific responses. combs, chains - Lists length P combined chained activation values. tps, trial_pre_func, trial_post_func, trial_pre_nomi, trial_post_nomi, nomi_func_map, trial_names, phase, block_size, is_test - Carryover arguments processing.","code":""},{"path":"https://victornavarro.org/calmr/reference/train_pav_heidi.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Trains a Pavlovian HeiDI — train_pav_heidi","text":"array V contains associations stimuli involved experiment. Entry ,j specifies associative strength stimulus stimulus j. Entry j,specifies opposite direction.","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":null,"dir":"Reference","previous_headings":"","what":"Parses a string stipulating trials — trial_parser","title":"Parses a string stipulating trials — trial_parser","text":"Parses string stipulating trials","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parses a string stipulating trials — trial_parser","text":"","code":"trial_parser(trial_string)"},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parses a string stipulating trials — trial_parser","text":"trial_string string","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parses a string stipulating trials — trial_parser","text":"list trial_names: character vector specifying names trials contained string trial_repeats: numeric vector specifying number times trial given trial_pre_functional: list character vectors specifying unique functional stimuli expectation part trial trial_post_functional: list character vectors specifying unique functional stimuli correction part trial trial_pre_nominal: list character vectors specifying nominal stimuli expectation part trial trial_post_nominal: list character vectors specifying nominal stimuli expectation part trial nomi_func_map: data.frame specifying mapping functional nominal stimuli unique_nominal stimuli: character vector unique nominal stimuli unique_functional_stimuli: character vector unique functional stimuli is_test: logical vector specifying whether trial result learning","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Parses a string stipulating trials — trial_parser","text":"Supports complex stimuli parentheses (e.g., \"5A>(US)\") Supports multiple nominal versions stimuli (e.g., \"3(A_a)>(US_a)/3(A_b)>(US_b)\") Supports probe trials followed hash (e.g., \"3X#\") trials \">\" character, assumed specified stimuli used expectation step. , \"post\" entries list contain NAs, necessary. trials, \"post\" stimuli none (character(0) vector).","code":""},{"path":"https://victornavarro.org/calmr/reference/trial_parser.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parses a string stipulating trials — trial_parser","text":"","code":"trial_parser(\"30A\") #> $trial_names #> [1] \"A\" #> #> $trial_repeats #> [1] 30 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"A\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> character(0) #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"A\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"A\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> character(0) #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"A\" #> #> #> $nomi2func #> A #> \"A\" #> #> $func2nomi #> A #> \"A\" #> #> $unique_nominal_stimuli #> [1] \"A\" #> #> $unique_functional_stimuli #> [1] \"A\" #> #> $is_test #> [1] FALSE #> trial_parser(\"30XA>U/30(YA)>A\") #> $trial_names #> [1] \"XA>U\" \"(YA)>A\" #> #> $trial_repeats #> [1] 30 30 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"X\" \"A\" #> #> $trial_pre_functional[[2]] #> [1] \"YA\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> [1] \"U\" #> #> $trial_post_functional[[2]] #> [1] \"A\" #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"X\" \"A\" \"U\" #> #> $trial_functional[[2]] #> [1] \"YA\" \"A\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"X\" \"A\" #> #> $trial_pre_nominal[[2]] #> [1] \"YA\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> [1] \"U\" #> #> $trial_post_nominal[[2]] #> [1] \"A\" #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"X\" \"A\" \"U\" #> #> $trial_nominal[[2]] #> [1] \"YA\" \"A\" #> #> #> $nomi2func #> X A YA U #> \"X\" \"A\" \"YA\" \"U\" #> #> $func2nomi #> X A YA U #> \"X\" \"A\" \"YA\" \"U\" #> #> $unique_nominal_stimuli #> [1] \"X\" \"A\" \"U\" \"YA\" #> #> $unique_functional_stimuli #> [1] \"X\" \"A\" \"YA\" \"U\" #> #> $is_test #> [1] FALSE FALSE #> trial_parser(\"1X#/2X>(US)#\") #> $trial_names #> [1] \"X#\" \"X>(US)#\" #> #> $trial_repeats #> [1] 1 2 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"X\" #> #> $trial_pre_functional[[2]] #> [1] \"X\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> character(0) #> #> $trial_post_functional[[2]] #> [1] \"US\" #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"X\" #> #> $trial_functional[[2]] #> [1] \"X\" \"US\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"X\" #> #> $trial_pre_nominal[[2]] #> [1] \"X\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> character(0) #> #> $trial_post_nominal[[2]] #> [1] \"US\" #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"X\" #> #> $trial_nominal[[2]] #> [1] \"X\" \"US\" #> #> #> $nomi2func #> X US #> \"X\" \"US\" #> #> $func2nomi #> X US #> \"X\" \"US\" #> #> $unique_nominal_stimuli #> [1] \"X\" \"US\" #> #> $unique_functional_stimuli #> [1] \"X\" \"US\" #> #> $is_test #> [1] TRUE TRUE #> trial_parser(\"1X>(US_a)/1Y>(US_b)\") #> $trial_names #> [1] \"X>(US_a)\" \"Y>(US_b)\" #> #> $trial_repeats #> [1] 1 1 #> #> $trial_pre_functional #> $trial_pre_functional[[1]] #> [1] \"X\" #> #> $trial_pre_functional[[2]] #> [1] \"Y\" #> #> #> $trial_post_functional #> $trial_post_functional[[1]] #> [1] \"US\" #> #> $trial_post_functional[[2]] #> [1] \"US\" #> #> #> $trial_functional #> $trial_functional[[1]] #> [1] \"X\" \"US\" #> #> $trial_functional[[2]] #> [1] \"Y\" \"US\" #> #> #> $trial_pre_nominal #> $trial_pre_nominal[[1]] #> [1] \"X\" #> #> $trial_pre_nominal[[2]] #> [1] \"Y\" #> #> #> $trial_post_nominal #> $trial_post_nominal[[1]] #> [1] \"US_a\" #> #> $trial_post_nominal[[2]] #> [1] \"US_b\" #> #> #> $trial_nominal #> $trial_nominal[[1]] #> [1] \"X\" \"US_a\" #> #> $trial_nominal[[2]] #> [1] \"Y\" \"US_b\" #> #> #> $nomi2func #> X Y US_a US_b #> \"X\" \"Y\" \"US\" \"US\" #> #> $func2nomi #> X Y US US #> \"X\" \"Y\" \"US_a\" \"US_b\" #> #> $unique_nominal_stimuli #> [1] \"X\" \"Y\" \"US_a\" \"US_b\" #> #> $unique_functional_stimuli #> [1] \"X\" \"Y\" \"US\" #> #> $is_test #> [1] FALSE FALSE #>"},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-063","dir":"Changelog","previous_headings":"","what":"calmr 0.6.3","title":"calmr 0.6.3","text":"Added set_calmr_palette() function control colour/fill scales used plot results (#1). Fixed bug make_experiment() triggered empty phases miniblocks. Changed get_timings() require specific model name.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-062","dir":"Changelog","previous_headings":"","what":"calmr 0.6.2","title":"calmr 0.6.2","text":"Aggregation ANCCR data now ignores time; time entries averaged. Added Temporal Difference model name “TD”. model experimental state. Experiments time-based models now require separate list construct time-based experiences. See get_timings(). Added experiences<-, timings, timings<- methods CalmrExperiment class. Revamped plotting functions parsing functions. Revamped output names models make intelligible. Fixed bug related aggregation pools HDI2020 HD2022. Consolidated man pages.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-061","dir":"Changelog","previous_headings":"","what":"calmr 0.6.1","title":"calmr 0.6.1","text":"CRAN release: 2024-03-14 Added outputs argument run_experiment(), parse(), aggregate(), allowing user parse/aggregate model outputs. Documentation corrections CRAN resubmission.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-060","dir":"Changelog","previous_headings":"","what":"calmr 0.6.0","title":"calmr 0.6.0","text":"Added dependency data.table resulting great speedups large experiments. Replaced dependency cowplot dependency patchwork. Removed dependencies tibble, dplyr, tidyr, packages tidyverse. Removed shiny app package. previous app now distributed separately via calmr.app package available GitHub. Test coverage reached 100%. package now ready CRAN submission.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-051","dir":"Changelog","previous_headings":"","what":"calmr 0.5.1","title":"calmr 0.5.1","text":"Added parallelization progress bars via future, future.apply, progressr. Function calmr_verbosity can set verbosity package.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-050","dir":"Changelog","previous_headings":"","what":"calmr 0.5.0","title":"calmr 0.5.0","text":"Implementation ANCCR (Jeong et al., 2022), first time-based model included calmr. Added parameter distinction trial-wise period-wise parameters. Added internal augmentation arguments depending model. trial-based models use pre/post distinctions anymore. Using “>” special character affect models anymore. “>” special character used specify periods within trial. example, “>B>C” implies followed B followed C. See using_time_models vignette additional information. Named stimuli now support numbers trailing characters (e.g., “(US1)” valid now.)","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-040","dir":"Changelog","previous_headings":"","what":"calmr 0.4.0","title":"calmr 0.4.0","text":"Major refactoring classes models. help development moving forward. Added several methods access CalmrExperiment contents, including c (bind experiments) results, plot, graph, design, parameters. Created CalmrDesign CalmrResult classes. Rewrote parsers less verbose rely less tidyverse suite piping. Substantially reduced complexity make_experiment function (previous make_experiment). Introduced distinction stimulus-specific global parameters. Parameters now lists instead data.frames. Modified UI calmr app include sidebar. Simplified app removing options. Nearly duplicated number tests.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-030","dir":"Changelog","previous_headings":"","what":"calmr 0.3.0","title":"calmr 0.3.0","text":"Added first version SOCR model (SM2007) well two vignettes explaining math behind implementation quick simulations. Documentation progress.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-020","dir":"Changelog","previous_headings":"","what":"calmr 0.2.0","title":"calmr 0.2.0","text":"Added multiple models package app (RW1972, PKH1982, MAC1975). Implementation basic S4 classes model, experiment, fit, RSA comparison objects, well methods. Added genetic algorithms (via GA) parameter estimation. Added basic tools perform representational similarity analysis. Documentation progress.","code":""},{"path":"https://victornavarro.org/calmr/news/index.html","id":"calmr-010","dir":"Changelog","previous_headings":"","what":"calmr 0.1.0","title":"calmr 0.1.0","text":"heidi now calmr. package now aims maintain several associative learning models implement tools use. Major overhaul training function (train_pav_model). relevant calculations now done function functional stimuli instead just US. Support specification expectation/correction steps within trial via “>”. example, trial “>(US)” use generate expectation, learn stimuli correction step. previous plotting function R-values revamped allow simple complex versions. complex version facets r-values predictor basis, uses colour lines target. Bugfix related stimulus saliencies.","code":""}]