iFormula: iData Model Formulae

Description Usage Arguments Value Author(s) See Also Examples

Description

Reads a formula and derives pertinent information from iData object to create and iDesign object.

Usage

1
2

Arguments

formula

Object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

iData

Object of class iData containing data represented in the provided formula.

subset

A logical or numeric vector indicating which observations to include.

weights

An optional vector of ‘prior weights’ to be used in the fitting process. Should be NULL or a numeric vector.

na.action

If "na.omit" then all images with NA values in corresponding variables are omitted. If a function is specified

control

A list of parameters for controlling the fitting process. See iControl for details.

Value

Returns an iDesign object.

Author(s)

Zachary P. Christensen

See Also

iModel-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ilist <- getANTsRData("population")
mask <- getMask(ilist[[1]])
imat <- imageListToMatrix(ilist, mask)
iGroup1 <- iGroup(imat, "pop1", mask, modality = "T1")


ilist <- lappend(ilist, ilist[[1]])
imat <- imageListToMatrix(ilist, mask)
iGroup2 <- iGroup(imat, "pop2", mask, modality = "T1")

demog <- data.frame(id = c("A", "B", "C", NA),
  age = c(11, 7, 18, 22), sex = c("M", "M", "F", "F"))
  
bool1 <- c(TRUE, TRUE, TRUE, FALSE)
bool2 <- c(TRUE, TRUE, TRUE, TRUE)

# create iData object that holds demographics info
mydata <- iData(list(iGroup1, iGroup2), c(bool1, bool2), demog)

z <- iFormula(iGroup1 ~ age, mydata)


# quick function for mean with custom defaults
myfunc <- function(x) {
  mean(x, trim = .1)
}

z <- iFormula(iGroup1 ~ age, mydata, myfunc)

Tokazama/iClass documentation built on May 9, 2019, 4:51 p.m.