myFormula: model formula

Description Usage Arguments Value See Also Examples

View source: R/myFormula.R

Description

myFormula outputs the model formula based on discrete variables and continuous variables.

Usage

1
myFormula(data, resp = NULL, dom = NULL, ...)

Arguments

data

the data frame.

resp

the response variable.

dom

the random effect dom could be "county","FIPS","state","zipcode".

...

Other parameters. fe.disc A vector of discrete/categorical fixed effects. fe.cont A vector of continuous fixed effects.

Value

Returns an object of class for model formula which is a symbolic formula based on the variables in the data set.

See Also

as.formula

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
# Using discrete and continuous variables.
data <- eversmoke
y <- "smoke_ever"
dom <- "county"
catX <- c("age","gender","year","race")
contX <- "povt_rate"
## Not run: 
myFormula(data, resp = y, fe.disc = catX, fe.cont = contX)
as.formula(myFormula(data, resp = y, fe.disc = catX, fe.cont = contX))



# Only using discrete variables
resp <- "smoke_ever"
dom <- "county"
fe.disc <- c("age","gender","year")
myFormula(data=eversmoke, resp="smoke_ever", dom="county", fe.disc)
as.formula(myFormula(resp,fe.disc))



# None of the variables are defined, this only output the response variable.
resp <- "smoke_ever"
dom <- "county"
myFormula(data=eversmoke, resp="smoke_ever", dom="county")

## End(Not run)

niroshar/hglmbc2 documentation built on Oct. 27, 2020, 2:22 a.m.