## Coefficient table does not have NA rows in rank-deficient fit; how to insert them?

Question

```
library(lmPerm)
x <- lmp(formula = a ~ b * c + d + e, data = df, perm = "Prob")
summary(x) # truncated output, I can see `NA` rows here!
#Coefficients: (1 not defined because of singularities)
# Estimate Iter Pr(Prob)
#b 5.874 51 1.000
#c -30.060 281 0.263
#b:c NA NA NA
#d1 -31.333 60 0.633
#d2 33.297 165 0.382
#d3 -19.096 51 1.000
#e 1.976 NA NA
```

I want to pull out the `Pr(Prob)`

results for everything, but

```
y <- summary(x)$coef[, "Pr(Prob)"]
#(Intercept) b c d1 d2
# 0.09459459 1.00000000 0.26334520 0.63333333 0.38181818
# d3 e
# 1.00000000 NA
```

**This is not what I want. I need b:c row, too, in the right position.**

An example of the output I would like from the above would be:

```
# (Intercept) b c b:c d1 d2
# 0.09459459 1.00000000 0.26334520 NA 0.63333333 0.38181818
# d3 e
# 1.00000000 NA
```

I also would like to pull out the `Iter`

column that corresponds to each variable. Thanks.

Show source

## Answers to Coefficient table does not have NA rows in rank-deficient fit; how to insert them? ( 1 )

`lmp`

is based on`lm`

and`summary.lmp`

also behaves like`summary.lm`

, so I will first use`lm`

for illustration, then show that we can do the same for`lmp`

.`lm`

and`summary.lm`

Have a read on

`?summary.lm`

and watch out for the following returned values:When you have rank-deficient models,

`NA`

coefficients are omitted in the coefficient table, and they are called`aliased`

variables. Consider the following small, reproducible example:If you want to pad

`NA`

rows to coefficient table / matrix, we can do`lmp`

and`summary.lmp`

Nothing needs be changed.

If you, want to extract

`Iter`

and`Pr(Prob)`

, just do