This function extracts the total number of 'observations' from a fitted panel model.

1 2 |

`object` |
a |

`...` |
further arguments. |

The number of observations is usually the length of the residuals vector. Thus, `nobs`

gives
the number of observations actually used by the estimation procedure. It is not necessarily the number
of observations of the model frame (number of rows in the model frame), because sometimes the model frame
is further reduced by the estimation procedure. This is e.g. the case for firstâ€“difference models
estimated by `plm(..., model = "fd")`

where the model frame does not yet contain the differences (see
also **Examples**).

A single number, normally an integer.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
# estimate a panelmodel
data("Produc", package = "plm")
z <- plm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp,data=Produc,
model="random", subset = gsp > 5000)
nobs(z) # total observations used in estimation
pdim(z)$nT$N # same information
pdim(z) # more information about the dimensions (no. of individuals and time periods)
# illustrate difference between nobs and pdim for first-difference model
data("Grunfeld", package = "plm")
fdmod <- plm(inv ~ value + capital, data = Grunfeld, model = "fd")
nobs(fdmod) # 190
pdim(fdmod)$nT$N # 200
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.