Commit 80122276 authored by Asquith, William H.'s avatar Asquith, William H.

added CIGMARAT output columns

parent df2e83b2
......@@ -12,7 +12,7 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
reg.n <- ifelse(is.null(reg.n), NA, reg.n)
dt <- deparseDateTime(tmp_df$LEV_DT)
if(is.null(site.gam)) site.gam <- list(residuals=NA, se.fit=NA, sigma=NA)
if(is.null(site.svm)) site.svm <- list(residuals=NA, se.fit=NA, sigma=NA)
if(is.null(site.svm)) site.svm <- list(residuals=NA, se.fit=NA, sigma=NA, cigmainfo=rep(NA,3))
gg <- data.frame(SITE_BADGE =tmp_df$SITE_BADGE,
DEC_LAT_VA =tmp_df$DEC_LAT_VA, DEC_LONG_VA=tmp_df$DEC_LONG_VA,
ALT_VA =tmp_df$ALT_VA*pseudo.feet.to.meters,
......@@ -46,6 +46,7 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
digits=4),
SITE_SVM_RESdivRSE=round(abs(site.svm$residuals)/site.svm$sigma,
digits=5),
SITE_SVM_CIGMARAT=round(site.svm$cigmainfo[3], digits=5),
stringsAsFactors=FALSE)
#if(any(abs(site.gam$residuals-site.svm$residuals) > 10)
rads <- 2*pi*tmp_df$FRAC_YEAR
......@@ -79,6 +80,7 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
if(is.null(shadow.svm) | is.null(shadow.svm$svm)) {
zz$REG_SVM_LEV <- NA
zz$REG_SVM_RESdivRSE <- NA
zz$REG_SVM_CIGMARAT <- NA
} else {
yy.svm <- data.frame(x=xx)
if(shadow.svm$trigUsed) { yy.svm$sine=sin(rads); yy.svm$cosine=cos(rads) }
......@@ -89,6 +91,7 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
sigma <- shadow.svm$sigma # no unit conversion is needed because REG_SVM_RESdivRSE is dimensionless
zz$REG_SVM_LEV <- round(tmp.y*pseudo.feet.to.meters, digits=4)
zz$REG_SVM_RESdivRSE <- round(abs(lev - tmp.y)/sigma, digits=5)
zz$REG_SVM_CIGMARAT <- round(shadow.svm$cigmainfo[3], digits=5)
}
# This provides protection against perfect fits and division by zero
......@@ -257,9 +260,9 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
#REMOVE }
zz$SITE_GAM_SIGMAFIT <- zz$SITE_GAM_LEV <- NA
zz$SITE_SVM_SIGMA <- zz$SITE_SVM_LEV <- NA
zz$SITE_SVM_CIGMARAT <- zz$SITE_SVM_SIGMA <- zz$SITE_SVM_LEV <- NA
zz$REG_GAM_SIGMAFIT <- zz$REG_GAM_LEV <- NA
zz$REG_SVM_SIGMA <- zz$REG_SVM_LEV <- NA
zz$REG_SVM_CIGMARAT <- zz$REG_SVM_SIGMA <- zz$REG_SVM_LEV <- NA
if(is.null(site.gam) | is.null(site.gam$gam)) {
# do nothing : zz$SITE_GAM_LEV <- zz$SITE_GAM_SIGMAFIT <- NA
} else {
......@@ -295,6 +298,7 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
tmp.y <- postSVMprediction_of_Y(predict(svm, tmp.data), site.svm$data)
zz$SITE_SVM_LEV <- round(tmp.y*pseudo.feet.to.meters, digits=3)
zz$SITE_SVM_SIGMA <- round(site.svm$sigma*pseudo.feet.to.meters, digits=4)
zz$SITE_SVM_CIGMARAT <- round(site.svm$cigmainfo[3], digits=5)
}
if(is.null(shadow.svm) | is.null(shadow.svm$svm)) {
# do nothing : zz$REG_SVM_LEV <- zz$REG_SVM_SIGMA <- NA
......@@ -307,6 +311,7 @@ function(site, tmp_df, lev, verbose=FALSE, silent=FALSE, actuallywrite=TRUE,
tmp.y <- postSVMprediction_of_Y(predict(svm, tmp.data), shadow.svm$data)
zz$REG_SVM_LEV <- round(tmp.y*pseudo.feet.to.meters, digits=3)
zz$REG_SVM_SIGMA <- round(shadow.svm$sigma*pseudo.feet.to.meters, digits=4)
zz$REG_SVM_CIGMARAT <- round(shadow.svm$cigmainfo[3], digits=5)
}
zz$DATE <- zz$FRAC_YEAR <- zz$DAYS_IN_MONTH <- zz$RADS <- NULL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment