conOptNo2: Constrained Optimization for NO2 Series for a Location

Description Usage Arguments Details Value Examples

View source: R/conOptNo2.R

Description

Constrained optimization for NO2 series, used to adjust the estimated NO2 concentration.

Usage

1
conOptNo2(no2x_season_trends, asite_dt, predId = "preno2")

Arguments

no2x_season_trends

Data frame of temporal basis function, can be obtained by access to the server using getTSeries

asite_dt

A time series of point estimates at a target location

predId

The predicated value's column name

Details

Constrained optimization for NO2 series, used to adjust the estimated NO2 concentration.

Value

Data frame with the adjusted values, geo id and time id.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## The following example illustrates how to use the point estimates to make constrained optimization
##   to get the adjusted estimates of NO2

data(merged_no2x)

no2x_season_trends=getTSeries(flag="sc_sample")
no2x_season_trends$s_date=as.Date(no2x_season_trends$s_date)
merged_no2x$gid=as.integer(merged_no2x$gid)

# Check the time seires for the geo id, 30314
agid=30314
tt=merged_no2x[merged_no2x$gid==agid,]
asiteDt=tt
asiteDt$s_date=as.Date(asiteDt$s_date)
asiteDt$biweekid=(asiteDt$s_date-as.Date("1992-01-01"))/14+1

tseriesNO2Obj=conOptNo2(no2x_season_trends,asiteDt,predId="no2_m")
tseries_no2=tseriesNO2Obj$series
tseries_no2$biweekid=(as.Date(tseries_no2$start_date)-as.Date("1992-01-01"))/14+1

tseries_no2=tseries_no2[which(is.finite(tseries_no2$sim)),]
plot(tseries_no2$start_date,tseries_no2$sim, type="l",xlab="Date",ylab="NO2 (ppb)", col="blue")
points(asiteDt$s_date,asiteDt$no2_m,col="blue")

lspatial/sptemUS documentation built on May 29, 2019, 3:42 a.m.