Build contrasts for SPM12 first level model

spm12_contrast(name, weights, replicate = c("none", "repl", "replsc",
  "sess", "both", "bothsc"))

spm12_contrast_list(cons, type = "T")

Arguments

name

Name of the contrast

weights

Weights of the contrast, must be the same length as the number of regressors

replicate

If there are multiple sessions with identical conditions, one might want to specify contrasts which are identical over sessions. Options are no replication (none), replicate (repl), replicate + scale (replsc), create per session (sess), Both: Replicate + Create per session (both), Both: Replicate + Scale + Create per session (bothsc)

cons

List of contrasts

type

type of contrast, T-statistic or F-statistic

Value

A list of objects, each with a name and value

Examples

res = spm12_contrast(name = "condition1", weights = c(
1, rep(0, 8)))
print(res)
#> $name
#> [1] "'condition1'"
#> 
#> $weights
#> [1] "[1, 0, 0, 0, 0, 0, 0, 0, 0];"
#> 
#> $sessrep
#> [1] "'none'"
#> 
contrasts = list(
list(name = "LeftHand",
       weights = c(1, rep(0, 7)),
replicate = "none",
type = "T" ),
list(name = "RightHand",
weights = c(0, 1, rep(0, 6)),
replicate = "none",
type = "T"), 
list(name = "AllEffects",
weights = rbind(
c(1, rep(0, 7)),
         c(0, 1, rep(0, 6))
       ),
replicate = "none",
type = "F")   
)
res = spm12_contrast_list(contrasts)
print(res)
#> $`{1}.tcon`
#> $`{1}.tcon`$name
#> [1] "'LeftHand'"
#> 
#> $`{1}.tcon`$weights
#> [1] "[1, 0, 0, 0, 0, 0, 0, 0];"
#> 
#> $`{1}.tcon`$sessrep
#> [1] "'none'"
#> 
#> 
#> $`{2}.tcon`
#> $`{2}.tcon`$name
#> [1] "'RightHand'"
#> 
#> $`{2}.tcon`$weights
#> [1] "[0, 1, 0, 0, 0, 0, 0, 0];"
#> 
#> $`{2}.tcon`$sessrep
#> [1] "'none'"
#> 
#> 
#> $`{3}.fcon`
#> $`{3}.fcon`$name
#> [1] "'AllEffects'"
#> 
#> $`{3}.fcon`$weights
#> [1] "[1, 0, 0, 0, 0, 0, 0, 0; 0, 1, 0, 0, 0, 0, 0, 0];"
#> 
#> $`{3}.fcon`$sessrep
#> [1] "'none'"
#> 
#>