Description Usage Arguments Details Value Author(s) References See Also Examples
Computes the standard errors for the parameters of a fitted GLM-type model for time series of counts.
1 2 |
object |
an object of class |
B |
positive integer value giving the number of bootstrap samples to use for estimation of the standard errors. If missing the standard errors are based on a normal approximation. |
parallel |
logical value. If |
level |
numeric value determining the desired coverage rate of confidence intervals. |
... |
additional arguments to be passed to the fitting function |
By default the standard errors and confidence intervals are based on a normal approximation of the (quasi) maximum likelihood estimator. The standard errors are the square roots of the diagonal elements of the inverse of the information matrix. Because there is no analytical approximation of the standard error for the overdispersion coefficient sigmasq
, its standard error and its confidence interval are set to NA
.
If the number of bootstrap samples B
is given, the standard errors and condidence intervals are computed by a parametric bootstrap. The standard errors are the empirical standard deviation of the parameter estimations of B
random samples drawn from the fitted model given in argument object
. The confidence intervals are the a
- and (1-a)
-quantile of this bootstrap sample with a=(1-level)/2
.
A list with the following components:
est |
a vector of the maximum likelihood estimated coefficients. |
se |
a vector of the standard errors of each estimated coefficient. |
ci |
a matrix with the columns |
level |
numerical value giving the coverage rate of the confidence intervals. |
type |
a character value |
If the standard errors are computed by a parametric bootstrap procedure, the following component is additionally returned:
B |
positive integer value giving the number of bootstrap samples used for estimation of the standard errors. |
Tobias Liboschik and Philipp Probst
Liboschik, T., Fokianos, K. and Fried, R. (2017) tscount: An R package for analysis of count time series following generalized linear models. Journal of Statistical Software 82(5), 1–51, http://dx.doi.org/10.18637/jss.v082.i05.
tsglm
for fitting a GLM for time series of counts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ###Road casualties in Great Britain (see help("Seatbelts"))
timeseries <- Seatbelts[, "VanKilled"]
regressors <- cbind(PetrolPrice=Seatbelts[, c("PetrolPrice")],
linearTrend=seq(along=timeseries)/12)
#Logarithmic link function with Poisson distribution:
seatbeltsfit <- tsglm(ts=timeseries, link="log",
model=list(past_obs=c(1, 12)), xreg=regressors, distr="poisson")
se(seatbeltsfit) #by normal approximation
## Not run:
system.time(stderror <- se(seatbeltsfit, B=100)) #by bootstrap
stderror
#This estimation of bootstrap standard errors takes several minutes on a single
#processing unit, of course depending on its speed.
#Parallel computation for shorter run time on a cluster:
library(parallel)
ntasks <- 3
clust <- makeCluster(ntasks)
setDefaultCluster(cl=clust)
system.time(stderror <- se(seatbeltsfit, B=100, parallel=TRUE))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.