Learn R Programming

plm (version 1.5-12)

nobs: Extract Total Number of Observations Used in Estimated Panelmodel

Description

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

Usage

"nobs"(object, ...)

Arguments

object
a panelmodel object for which the number of total observations is to be extracted,
...
further arguments.

Value

A single number, normally an integer.

Details

nobs is just a wrapper for convenience, it calls pdim(x)$nT$N and is similiar to lm()'s nobs.

See Also

pdim

Examples

Run this code

# 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)

Run the code above in your browser using DataLab