Package ZIM. R topics documented: August 29, Type Package. Title Statistical Models for Count Time Series with Excess Zeros. Version 1.

Similar documents
New Educators Campaign Weekly Report

Standard Indicator That s the Latitude! Students will use latitude and longitude to locate places in Indiana and other parts of the world.

QF (Build 1010) Widget Publishing, Inc Page: 1 Batch: 98 Test Mode VAC Publisher's Statement 03/15/16, 10:20:02 Circulation by Issue

Multivariate Statistics

, District of Columbia

Multivariate Statistics

Cooperative Program Allocation Budget Receipts Southern Baptist Convention Executive Committee October 2017

Cooperative Program Allocation Budget Receipts Southern Baptist Convention Executive Committee October 2018

Cooperative Program Allocation Budget Receipts Southern Baptist Convention Executive Committee May 2018

Correction to Spatial and temporal distributions of U.S. winds and wind power at 80 m derived from measurements

Office of Special Education Projects State Contacts List - Part B and Part C

Additional VEX Worlds 2019 Spot Allocations

Challenge 1: Learning About the Physical Geography of Canada and the United States

Jakarta International School 6 th Grade Formative Assessment Graphing and Statistics -Black

Summary of Natural Hazard Statistics for 2008 in the United States

Hourly Precipitation Data Documentation (text and csv version) February 2016

A. Geography Students know the location of places, geographic features, and patterns of the environment.

Multivariate Statistics

Osteopathic Medical Colleges

JAN/FEB MAR/APR MAY/JUN

Abortion Facilities Target College Students

Intercity Bus Stop Analysis

Multivariate Analysis

What Lies Beneath: A Sub- National Look at Okun s Law for the United States.

Parametric Test. Multiple Linear Regression Spatial Application I: State Homicide Rates Equations taken from Zar, 1984.

Club Convergence and Clustering of U.S. State-Level CO 2 Emissions

Preview: Making a Mental Map of the Region

Printable Activity book

Online Appendix: Can Easing Concealed Carry Deter Crime?

SUPPLEMENTAL NUTRITION ASSISTANCE PROGRAM QUALITY CONTROL ANNUAL REPORT FISCAL YEAR 2008

North American Geography. Lesson 2: My Country tis of Thee

Chapter. Organizing and Summarizing Data. Copyright 2013, 2010 and 2007 Pearson Education, Inc.

Alpine Funds 2017 Tax Guide

Insurance Department Resources Report Volume 1

BlackRock Core Bond Trust (BHK) BlackRock Enhanced International Dividend Trust (BGY) 2 BlackRock Defined Opportunity Credit Trust (BHL) 3

2005 Mortgage Broker Regulation Matrix

RELATIONSHIPS BETWEEN THE AMERICAN BROWN BEAR POPULATION AND THE BIGFOOT PHENOMENON

Alpine Funds 2016 Tax Guide

Lecture 5: Ecological distance metrics; Principal Coordinates Analysis. Univariate testing vs. community analysis

Meteorology 110. Lab 1. Geography and Map Skills

LABORATORY REPORT. If you have any questions concerning this report, please do not hesitate to call us at (800) or (574)

LABORATORY REPORT. If you have any questions concerning this report, please do not hesitate to call us at (800) or (574)

Grand Total Baccalaureate Post-Baccalaureate Masters Doctorate Professional Post-Professional

Crop Progress. Corn Mature Selected States [These 18 States planted 92% of the 2017 corn acreage]

Non-iterative, regression-based estimation of haplotype associations

High School World History Cycle 2 Week 2 Lifework

OUT-OF-STATE 965 SUBTOTAL OUT-OF-STATE U.S. TERRITORIES FOREIGN COUNTRIES UNKNOWN GRAND TOTAL

Lecture 5: Ecological distance metrics; Principal Coordinates Analysis. Univariate testing vs. community analysis

Grand Total Baccalaureate Post-Baccalaureate Masters Doctorate Professional Post-Professional

Multivariate Classification Methods: The Prevalence of Sexually Transmitted Diseases

JAN/FEB MAR/APR MAY/JUN

National Organization of Life and Health Insurance Guaranty Associations

GIS use in Public Health 1

Rank University AMJ AMR ASQ JAP OBHDP OS PPSYCH SMJ SUM 1 University of Pennsylvania (T) Michigan State University

FLOOD/FLASH FLOOD. Lightning. Tornado

Office of Budget & Planning 311 Thomas Boyd Hall Baton Rouge, LA Telephone 225/ Fax 225/

Direct Selling Association 1

Package RcppSMC. March 18, 2018

extreme weather, climate & preparedness in the american mind

Pima Community College Students who Enrolled at Top 200 Ranked Universities

Last time: PCA. Statistical Data Mining and Machine Learning Hilary Term Singular Value Decomposition (SVD) Eigendecomposition and PCA

A GUIDE TO THE CARTOGRAPHIC PRODUCTS OF

MO PUBL 4YR 2090 Missouri State University SUBTOTAL-MO

An Analysis of Regional Income Variation in the United States:

MINERALS THROUGH GEOGRAPHY

KS PUBL 4YR Kansas State University Pittsburg State University SUBTOTAL-KS

A Summary of State DOT GIS Activities

Infant Mortality: Cross Section study of the United State, with Emphasis on Education

CCC-A Survey Summary Report: Number and Type of Responses

October 2016 v1 12/10/2015 Page 1 of 10

Package hurdlr. R topics documented: July 2, Version 0.1

Introducing North America

If you have any questions concerning this report, please feel free to contact me. REPORT OF LABORATORY ANALYSIS

MINERALS THROUGH GEOGRAPHY. General Standard. Grade level K , resources, and environmen t

Office of Budget & Planning 311 Thomas Boyd Hall Baton Rouge, LA Telephone 225/ Fax 225/

Chapter 11 : State SAT scores for 1982 Data Listing

United States Geography Unit 1

Outline. Administrivia and Introduction Course Structure Syllabus Introduction to Data Mining

All-Time Conference Standings

William Battye * EC/R Incorporated, Chapel Hill, NC. William Warren-Hicks, Ph.D. EcoStat, Inc., Mebane, NC

If you have any questions concerning this report, please feel free to contact me. REPORT OF LABORATORY ANALYSIS

BOWL - APRIL 27, QUESTIONS 45 MINUTES

State Section S Items Effective October 1, 2017

This project is supported by a National Crime Victims' Right Week Community Awareness Project subgrant awarded by the National Association of VOCA

St. Luke s College Institutional Snapshot

PHYSICS BOWL - APRIL 22, 1998

112th U.S. Senate ACEC Scorecard

2011 NATIONAL SURVEY ON DRUG USE AND HEALTH

Stem-and-Leaf Displays

National Wildland Significant Fire Potential Outlook

Evidence for increasingly extreme and variable drought conditions in the contiguous United States between 1895 and 2012

Package ARCensReg. September 11, 2016

HP-35s Calculator Program Lambert 1

HP-35s Calculator Program Lambert 2

Physical Therapist Centralized Application Service. COURSE PREREQUISITES SUMMARY Admissions Cycle

Conduent EDI Solutions, Inc. EDI Direct Pass Thru Fees

Package Delaporte. August 13, 2017

Long-term runoff study using SARIMA and ARIMA models in the United States

The Heterogeneous Effects of the Minimum Wage on Employment Across States

Package blme. August 29, 2016

Transcription:

Package ZIM August 29, 2013 Type Package Title Statistical Models for Count Time Series with Excess Zeros Version 1.0 Date 2013-06-15 Author Ming Yang, Gideon K. D. Zamba, and Joseph E. Cavanaugh Maintainer Ming Yang <myang@sdac.harvard.edu> Depends MASS Fits observation-driven and parameter-driven models for count time series with excess zeros. License GPL-2 NeedsCompilation no Repository CRAN Date/Publication 2013-06-19 00:41:33 R topics documented: ZIM-package........................................ 2 bshift............................................ 3 dzim............................................. 3 dzim.control......................................... 4 dzim.filter.......................................... 5 dzim.fit........................................... 6 dzim.plot.......................................... 6 dzim.sim........................................... 7 dzim.smooth......................................... 7 injury............................................ 8 pvalue............................................ 8 syph............................................. 9 1

2 ZIM-package zim............................................. 11 zim.control......................................... 12 zim.fit............................................ 13 ZINB............................................ 14 ZIP............................................. 15 Index 16 ZIM-package Statistical Models for Count Time Series with Excess Zeros Details Fits observation-driven and parameter-driven models for count time series with excess zeros. Package: ZIM Type: Package Version: 1.0 Date: 2013-06-15 License: GPL-2 The package ZIM contains functions to fit statistical models for count time series with excess zeros (Yang, 2012; Yang et al., 2013). The main function for fitting observation-driven models is zim, and the main function for fitting parameter-driven models is dzim. Note The observation-driven models for zero-inflated count time series can also be fit using the function zeroinfl from the pscl package (Zeileis et al., 2008). Fitting parameter-driven models is based on sequential Monte Carlo (SMC) methods, which are computer intensive and could take several hours to estimate the model parameters. Author(s) Ming Yang, Gideon K. D. Zamba, and Joseph E. Cavanaugh Maintainer: Ming Yang <myang@sdac.harvard.edu> References Yang, M. (2012). Statistical models for count time series with excess zeros. PhD Dissertation, The University of Iowa (http://ir.uiowa.edu/etd/3019/). Yang, M., Zamba, G. K. D., and Cavanaugh, J. E. (2013). Markov regression models for count time series with excess zeros: A partial likelihood approach. Statistical Methodology, 14:26-38.

bshift 3 Zeileis, A., Kleiber, C., and Jackman, S. (2008). Regression models for count data in R. Journal of Statistical Software, 27(8). bshift Backshift Operator Apply the backshift or lag operator to a time series objective. bshift(x, k = 1) x k univariate or multivariate time series. number of lags. lag, zlag Examples x <- arima.sim(model = list(ar = 0.8, sd = 0.5), n = 120) bshift(x, k = 12) dzim Fitting Dynamic Zero-Inflated Models dzim is used to fit dynamic zero-inflated models. dzim(formula, data, subset, na.action, weights = 1, offset = 0, control = dzim.control(...),...)

4 dzim.control formula data subset na.action weights offset control an objective of class "formula". an optional dataframe, list or environment containing the variables in the model. an optional vector specifying a subset of observations to be used in the fitting process. a function which indicates what should happen when the data contain NAs. an optional vector of prior weights to be used in the fitting process. this can be used to specify a priori known component to be included in the linear predictor during fitting. control arguments from dzim.control... additional arguments dzim.fit, dzim.filter, dzim.smooth, dzim.control, dzim.sim, dzim.plot dzim.control Auxiliary for Controlling DZIM Fitting Auxiliary function for dzim fitting. Typically only used internally by dzim.fit, but may be used to construct a control argument for either function. dzim.control(dist = c("poisson", "nb", "zip", "zinb"), trace = FALSE, start = NULL, order = 1, mu0 = rep(0, order), Sigma0 = diag(1, order), N = 1000, R = 1000, niter = 500) dist trace start order mu0 Sigma0 N R niter count model family logical; if TRUE, display iteration history. initial parameter values. autoregressive order. mean vector for initial state. covariance matrix for initial state. number of particiles in particle filtering. number of replications in particle smoothing. number of iterations.

dzim.filter 5 Note The default values of N, R, and niter are chosen based on our experience. In some cases, N = 500, R = 500, and niter = 200 might be sufficient. The dzim.plot function should always be used for convergence diagnostics. dzim, dzim.fit, dzim.filter, dzim.smooth, dzim.sim, dzim.plot dzim.filter Particle Filtering for DZIM Function to implement the particle filtering method proposed by Gordsill et al. (1993). dzim.filter(y, X, w, para, control) y X w para control response variable. design matrix. log(w) is used as an offset variable in the linear predictor. model parameters. control arguments. References Gordon, N. J., Salmond, D. J., and Smith, A. F. M. (1993). Novel approach to nonlinear/non- Gaussian Bayesian state estimation. IEEE Proceedings, 140, 107-113. dzim, dzim.fit, dzim.smooth, dzim.control, dzim.sim, dzim.plot

6 dzim.plot dzim.fit Fitter Function for Dynamic Zero-Inflated Models dzim.fit is the basic computing engine called by dzim used to fit dynamic zero-inflated models. This should usually not be used directly unless by experienced users. dzim.fit(y, X, offset = rep(0, n), control = dzim.control(...),...) y response variable. X design matrix. offset offset variable. control control arguments.... additional arguments. dzim, dzim.control, dzim.filter, dzim.smooth, dzim.sim, dzim.plot dzim.plot Trace Plots from DZIM Function to display trace plots from a dynamic zero-inflated model. dzim.plot(object, k.inv = FALSE, sigma.sq = FALSE,...) object objective from dzim or dzim.fit. k.inv logical; indicating whether an inverse transformation is needed for the dispersion parameter. sigma.sq logical; indicating whether a square transformation is needed for the standard deviation parameter.... additional arguments. dzim, dzim.fit, dzim.filter, dzim.smooth, dzim.control, dzim.sim

dzim.sim 7 dzim.sim Simulate Data from DZIM Simulate data from a dynamic zero-inflated model. dzim.sim(x, w, omega, k, beta, phi, sigma, mu0, Sigma0) X w omega k beta phi sigma mu0 Sigma0 design matrix. log(w) is used as an offset variable in the linear predictor. zero-inflation parameter. dispersion parameter. regression coefficients. autoregressive coefficients. standard deviation. mean vector of initial state. covariance matrix of initial state. dzim, dzim.fit, dzim.filter, dzim.smooth, dzim.control, dzim.plot dzim.smooth Particle Smoothing for DZIM Function to implement the particle smoothing method proposed by Gordsill et al. (2004). dzim.smooth(y, X, w, para, control) y X w para control response variable. design matrix. log(w) is used as an offset variable in the linear predictor. model parameters. control arguments.

8 pvalue References Gordsill, S. J., Doucet, A., and West, M. (2004). Monte Carlo smoothing for nonlinear time series. Journal of the American Statistical Association, 99, 156-168. dzim, dzim.fit, dzim.filter, dzim.control, dzim.sim, dzim.plot injury Example: Injury Series from Occupational Health Monthly number of injuries in hospitals from July 1988 to October 1995. Source Numbers from Figure 1 of Yau et al. (2004). References Yau, K. K. W., Lee, A. H. and Carrivick, P. J. W. (2004). Modeling zero-inflated count series with application to occupational health. Computer Methods and Programs in Biomedicine, 74, 47-52. Examples data(injury) plot(injury, type = "o", pch = 20, xaxt = "n", yaxt = "n", ylab = "Injury Count") axis(side = 1, at = seq(1, 96, 8)) axis(side = 2, at = 0:9) abline(v = 57, lty = 2) mtext("pre-intervention", line = 1, at = 25, cex = 1.5) mtext("post-intervention", line = 1, at = 80, cex = 1.5) pvalue Function to Compute P-value. Function to compute p-value based on a t-statistic. pvalue(t, df = Inf, alternative = c("two.sided", "less", "greater"))

syph 9 t df alternative t-statistic. degree of freedoms. type of alternative. Examples pvalue(1.96, alternative = "greater") syph Example: Syphilis Series Weekly number of syphilis cases in the United States from 2007 to 2010. Format A data frame with 209 observations on the following 69 variables. year Year week Week a1 United States a2 New England a3 Connecticut a4 Maine a5 Massachusetts a6 New Hampshire a7 Rhode Island a8 Vermont a9 Mid. Atlantic a10 New Jersey a11 New York (Upstate) a12 New York City a13 Pennsylvania a14 E.N. Central a15 Illinois a16 Indiana a17 Michigan a18 Ohio

10 syph a19 Wisconsin a20 W.N. Central a21 Iowa a22 Kansas a23 Minnesota a24 Missouri a25 Nebraska a26 North Dakota a27 South Dakota a28 S. Atlantic a29 Delaware a30 District of Columbia a31 Florida a32 Georgia a33 Maryland a34 North Carolina a35 South Carolina a36 Virginia a37 West Virginia a38 E.S. Central a39 Alabama a40 Kentucky a41 Mississippi a42 Tennessee a43 W.S. Central a44 Arkansas a45 Louisana a46 Oklahoma a47 Texas a48 Moutain a49 Arizona a50 Colorado a51 Idaho a52 Montana a53 Nevada a54 New Mexico a55 Utah

zim 11 a56 Wyoming a57 Pacific a58 Alaska a59 California a60 Hawaii a61 Oregon a62 Washington a63 American Samoa a64 C.N.M.I. a65 Guam a66 Peurto Rico a67 U.S. Virgin Islands Note C.N.M.I.: Commonwealth of Northern Mariana Islands. Source CDC Morbidity and Mortality Weekly Report (http://www.cdc.gov/mmwr/). Examples data(syph) plot(ts(syph$a33), main = "Maryland") zim Fitting Zero-Inflated Models zim is used to fit zero-inflated models. zim(formula, data, subset, na.action, weights = 1, offset = 0, control = zim.control(...),...)

12 zim.control Note formula data subset na.action weights offset control an objective of class "formula". an optional dataframe, list or environment containing the variables in the model. an optional vector specifying a subset of observations to be used in the fitting process. a function which indicates what should happen when the data contain NAs. an optional vector of prior weights to be used in the fitting process. this can be used to specify a priori known component to be included in the linear predictor during fitting. control arguments.... additional arguments. zim is very similar to zeroinfl from the pscl package. Both functions can be used to fit observationdriven models for zero-inflated time series. zim.fit, zim.control zim.control Auxiliary for Controlling ZIM Fitting Auxiliary function for zim fitting. Typically only used internally by zim.fit, but may be used to construct a control argument for either function. zim.control(dist = c("zip", "zinb"), method = c("em-nr", "EM-FS"), type = c("solve", "ginv"), robust = FALSE, trace = FALSE, start = NULL, minit = 10, maxit = 10000, epsilon = 1e-8) dist method type robust trace count model family. algorithm for parameter estimation. type of matrix inverse. logical; if TRUE, robust standard errors will be calculated. logical; if TRUE, display iteration history.

zim.fit 13 start minit maxit epsilon initial parameter values. minimum number of iterations. maximum number of iterations. positive convergence tolerance. zim, zim.fit zim.fit Fitter Function for Zero-Inflated Models zim.fit is the basic computing engine called by zim used to fit zero-inflated models. This should usually not be used directly unless by experienced users. zim.fit(y, X, Z, weights = rep(1, nobs), offset = rep(0, nobs), control = zim.control(...),...) y response variable. X design matrix for log-linear part. Z design matrix for logistic part. weights an optional vector of prior weights to be used in the fitting process. offset offset variable control control arguments from zim.control.... additional argumetns. zim, zim.control

14 ZINB ZINB The Zero-Inflated Negative Binomial Distribution Density, distribution function, quantile function and random generation for the zero-inflated negative binomial (ZINB) distribution with parameters k, lambda, and omega. dzinb(x, k, lambda, omega, log = FALSE) pzinb(q, k, lambda, omega, lower.tail = TRUE, log.p = FALSE) qzinb(p, k, lambda, omega, lower.tail = TRUE, log.p = FALSE) rzinb(n, k, lambda, omega) x, q vector of quantiles. p vector of probabilities. n number of random values to return. k dispersion parameter. lambda vector of (non-negative) means. omega zero-inflation parameter. log, log.p logical; if TRUE, probabilities p are given as log(p). lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. Value dzinb gives the density, pzinb gives the distribution function, qzinb gives the quantile function, and rzinb generates random deviates. dzip, pzip, qzip, and rzip for the zero-inflated Poisson (ZIP) distribution. Examples dzinb(x = 0:10, k = 1, lambda = 1, omega = 0.5) pzinb(q = c(1, 5, 9), k = 1, lambda = 1, omega = 0.5) qzinb(p = c(0.25, 0.50, 0.75), k = 1, lambda = 1, omega = 0.5) rzinb(n = 100, k = 1, lambda = 1, omega = 0.5)

ZIP 15 ZIP The Zero-Inflated Poisson Distribution Density, distribution function, quantile function and random generation for the zero-inflated Poisson (ZIP) distribution with parameters lambda and omega. dzip(x, lambda, omega, log = FALSE) pzip(q, lambda, omega, lower.tail = TRUE, log.p = FALSE) qzip(p, lambda, omega, lower.tail = TRUE, log.p = FALSE) rzip(n, lambda, omega) x, q vector of quantiles. p n Value lambda omega log, log.p lower.tail vector of probabilities. number of random values to return. vector of (non-negative) means. zero-inflation parameter. logical; if TRUE, probabilities p are given as log(p). logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. dzip gives the density, pzip gives the distribution function, qzip gives the quantile function, and rzip generates random deviates. dzinb, pzinb, qzinb, and rzinb for the zero-inflated negative binomial (ZINB) distribution. Examples dzip(x = 0:10, lambda = 1, omega = 0.5) pzip(q = c(1, 5, 9), lambda = 1, omega = 0.5) qzip(p = c(0.25, 0.50, 0.75), lambda = 1, omega = 0.5) rzip(n = 100, lambda = 1, omega = 0.5)

Index Topic datasets injury, 8 syph, 9 Topic distribution ZINB, 14 ZIP, 15 Topic misc bshift, 3 pvalue, 8 Topic package ZIM-package, 2 Topic regression dzim, 3 dzim.control, 4 dzim.filter, 5 dzim.fit, 6 dzim.plot, 6 dzim.sim, 7 dzim.smooth, 7 zim, 11 zim.control, 12 zim.fit, 13 bshift, 3 dzim, 2, 3, 4 8 dzim.control, 4, 4, 5 8 dzim.filter, 4, 5, 5, 6 8 dzim.fit, 4 6, 6, 7, 8 dzim.plot, 4 6, 6, 7, 8 dzim.sim, 4 6, 7, 8 dzim.smooth, 4 7, 7 dzinb, 15 dzinb (ZINB), 14 dzip, 14 dzip (ZIP), 15 lag, 3 print.dzim (dzim), 3 print.zim (zim), 11 pvalue, 8 pzinb, 15 pzinb (ZINB), 14 pzip, 14 pzip (ZIP), 15 qzinb, 15 qzinb (ZINB), 14 qzip, 14 qzip (ZIP), 15 rzinb, 15 rzinb (ZINB), 14 rzip, 14 rzip (ZIP), 15 syph, 9 zeroinfl, 2, 12 ZIM (ZIM-package), 2 zim, 2, 11, 12, 13 ZIM-package, 2 zim.control, 12, 12, 13 zim.fit, 12, 13, 13 ZINB, 14 ZIP, 15 zlag, 3 formula, 4, 12 injury, 8 16