#### R code for ITS model- taking into account seasonal variations####
####用R语言实现"包含季节性变化的中断时间序列分析"###2024.12.09###
####联系方式:shaofengsui@163.com ;yangcheng@bscdc.org.cn ###
####R3.3.2 及以上版本####
####需要模拟数据"pm1202.csv"的读者,请发邮件索取###
####推荐2篇参考文献,请大家下载学习###
####Bernal, J.L., Cummins, S. and Gasparrini, A. (2020) Corrigendum to interrupted time series regression for the evaluation of public health interventions: a tutorial. Int J Epidemiol 49(4), 1414.
####This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted reuse, distribution, and reproduction in any medium, provided the original work is properly cited.
####任洋洋,等. 应用中断时间序列方法评估干预措施对陆家嘴水厂出厂水三卤甲烷的影响 [J],环境与职业医学, 2024,41(4):420-424.(PDF下载https://www.jeom.org/article/doi/10.11836/JEOM23297 )
####文章中有超链接,可查看R code###
##################################################################
###考虑季节性变化的R code 编码如下###
### 钢铁厂搬迁对空气PM2.5影响的ITS分析-考虑季节性变化 ###
### 安装包###
library(foreign) ;
library(tsModel) ;
library(zoo) ;
library("lmtest") ;
library("Epi") ;
library("splines") ;
library("grid") ;
library("vcd") ;
library(dplyr)
setwd("D:/R") ###设置工作路径###
data <- read.csv("pm1202.csv") ###读取资料,模拟数据可发邮件向作者索取#####
head(data) ##显示数据表的前6行###
View(data) ##看一下数据表
# 变量的含义
# year 年