# se.coef: Extract Standard Errors of Model Coefficients In arm: Data Analysis Using Regression and Multilevel/Hierarchical Models

## Description

These functions extract standard errors of model coefficients from objects returned by modeling functions.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10``` ```se.coef (object, ...) se.fixef (object) se.ranef (object) ## S4 method for signature 'lm' se.coef(object) ## S4 method for signature 'glm' se.coef(object) ## S4 method for signature 'merMod' se.coef(object) ```

## Arguments

 `object` object of `lm`, `glm` and `merMod` fit `...` other arguments

## Details

`se.coef` extracts standard errors from objects returned by modeling functions. `se.fixef` extracts standard errors of the fixed effects from objects returned by lmer and glmer functions. `se.ranef` extracts standard errors of the random effects from objects returned by lmer and glmer functions.

## Value

`se.coef` gives lists of standard errors for `coef`, `se.fixef` gives a vector of standard errors for `fixef` and `se.ranef` gives a list of standard errors for `ranef`.

## Author(s)

Andrew Gelman [email protected]; Yu-Sung Su [email protected]

## References

Andrew Gelman and Jennifer Hill. (2006). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press.

`display`, `coef`, `sigma.hat`,

## 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 29 30 31 32 33 34 35 36 37 38 39 40``` ```# Here's a simple example of a model of the form, y = a + bx + error, # with 10 observations in each of 10 groups, and with both the # intercept and the slope varying by group. First we set up the model and data. group <- rep(1:10, rep(10,10)) mu.a <- 0 sigma.a <- 2 mu.b <- 3 sigma.b <- 4 rho <- 0 Sigma.ab <- array (c(sigma.a^2, rho*sigma.a*sigma.b, rho*sigma.a*sigma.b, sigma.b^2), c(2,2)) sigma.y <- 1 ab <- mvrnorm (10, c(mu.a,mu.b), Sigma.ab) a <- ab[,1] b <- ab[,2] # x <- rnorm (100) y1 <- rnorm (100, a[group] + b[group]*x, sigma.y) y2 <- rbinom(100, 1, prob=invlogit(a[group] + b*x)) # lm fit M1 <- lm (y1 ~ x) se.coef (M1) # glm fit M2 <- glm (y2 ~ x) se.coef (M2) # lmer fit M3 <- lmer (y1 ~ x + (1 + x |group)) se.coef (M3) se.fixef (M3) se.ranef (M3) # glmer fit M4 <- glmer (y2 ~ 1 + (0 + x |group), family=binomial(link="logit")) se.coef (M4) se.fixef (M4) se.ranef (M4) ```

### Example output

```Loading required package: MASS

arm (Version 1.9-3, built: 2016-11-21)

Working directory is /work/tmp

(Intercept)           x
0.4326871   0.4295015
(Intercept)           x
0.04383947  0.04351670
\$fixef
[1] 0.716845 1.297800

\$group
(Intercept)         x
1    0.3395004 0.3732441
2    0.3481237 0.4550820
3    0.3471428 0.3200021
4    0.3408856 0.2885092
5    0.5086888 0.5977139
6    0.3379478 0.5152213
7    0.3410570 0.2730100
8    0.3433851 0.3827784
9    0.3999975 0.3998041
10   0.3569666 0.2935424

(Intercept)           x
0.716845    1.297800
\$group
(Intercept)         x
1    0.3395004 0.3732441
2    0.3481237 0.4550820
3    0.3471428 0.3200021
4    0.3408856 0.2885092
5    0.5086888 0.5977139
6    0.3379478 0.5152213
7    0.3410570 0.2730100
8    0.3433851 0.3827784
9    0.3999975 0.3998041
10   0.3569666 0.2935424

\$fixef
[1] 0.2343449

\$group
x
1  0.7911654
2  0.7166664
3  0.7034180
4  0.5331596
5  0.9337075
6  0.9336031
7  0.5442072
8  0.6482159
9  0.7501760
10 0.5362299

(Intercept)
0.2343449
\$group
x
1  0.7911654
2  0.7166664
3  0.7034180
4  0.5331596
5  0.9337075
6  0.9336031
7  0.5442072
8  0.6482159
9  0.7501760
10 0.5362299
```

arm documentation built on April 17, 2018, 3:01 a.m.