mspec_new: Create, edit, and combine model specifications

Description Usage Arguments Details Value Examples

View source: R/spec.R

Description

mspec_empty(), mspec_add(), mspec_rmv(), and mspec_sub() are functions that can be used to create model fitting specifications. mspec_describe() is a function that helps clarify model specifications and facilitates interactive work.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
mspec_new(name = "Model 1", ...)

mspec_empty(name = "Model 0")

mspec_add(mspec, ..., name = NULL)

mspec_rmv(mspec, name, ...)

mspec_sub(mspec, name, ...)

mspec_describe(mspec, verbose = FALSE)

Arguments

name

(character value). The label that will be used to describe this model specification

...

A set of variable names (separated by commas) that will be used to adjust estimates in fitted models when this specification is applied. The values may be supplied with or without quotation marks around the variable names (e.g., 'x' or x).

parent

This parameters if only used for mspec_add, mspec_rmv, and mspec_sub. The parent mspec_apri object passes it's control variables to the descendant, accounting for modifications specified in ...

Details

Use mspec_empty() to create a generic unadjusted specification. Use mspec_add(), mspec_rmv(), and mspec_sub() to create descendant model specifications, and use mspec_describe() to summarize the structure of the model specifications in a concise manner that accounts for their dependencies (see examples).

Value

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
# Make an unadjusted model
m0  <- mspec_empty("Model 0")

# mspec_describe(mspec) is the same as print(mspec)
mspec_describe(m0)
print(m0)

# Model 1 includes adjustment for sex and class
m1  <- mspec_add(m0, name = "Model 1", sex, pclass)

m1

# Model 2a = model 1 + no. of siblings/spouses
m2a <- mspec_add(m1, name = 'Model 2a', sibsp)

m2a

# Model 2b = model 1 + no. of parents/children
m2b <- mspec_add(m1, name = 'Model 2b', parch)

m2b

# Model 3 = model 1, swapping out class for ticket fare

m3 <- mspec_sub(m1, name = 'Model 3', pclass = fare)

m3

bcjaeger/rpriori documentation built on Nov. 4, 2019, 6:52 a.m.