print(loess.model1)
plot(a2.mopp.data$ECG.HR,xaxt="n",bty="n",pch=16,cex=.5,type="o",las=1,
ylab="ECH.HR",xlab="Time")
axis(1,las=3,cex.axis=.95)
points(predict(loess.model1, data.frame(r=1:nrow(data))), col="gold")
points(predict(loess.model1, data.frame(r=1:nrow(a2.mopp.data))), col="gold")
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green",
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "",
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green",
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
plot(data$EDR.BR,cex=1.5,
data <- d2.mopp.data
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green",
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
grid(NA, 5, lwd = 2)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
grid(NA, 5, lwd = 2)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
grid()
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
#  rect(par("usr")[1],par("usr")[3],par("usr")[2],par("usr")[4],col = "grey")
points(mav(data$ECG.HR, n=5),col="blue",lty=1,lwd=1)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
#  rect(par("usr")[1],par("usr")[3],par("usr")[2],par("usr")[4],col = "grey")
points(mav(data$ECG.HR, n=5),col="blue",lty=1,lwd=1)
lines(data$ECG.HR,col="red", lwd = 3)
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
lines(1:nrow(data),data$Belt.BR,col="red", lwd = 1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
lines(1:nrow(data),data$CoreTemp,col="red", lwd = 3)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
#  rect(par("usr")[1],par("usr")[3],par("usr")[2],par("usr")[4],col = "grey")
points(mav(data$ECG.HR, n=5),col="blue",lty=1,lwd=1)
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
myfunc(b2.bdu.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
#  rect(par("usr")[1],par("usr")[3],par("usr")[2],par("usr")[4],col = "grey")
points(mav(data$ECG.HR, n=5),col="blue",lty=1,lwd=1)
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=1.2)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=1)
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=1.2)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=1,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=1.5,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1)
points(data$CoreTemp,col="yellow",lty=1,lwd=1)
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
points(data$Belt.BR,col="pink",lty=1,lwd=1,type="o")
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1,type="o")
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
data$CoreTemp
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time", ylab = "", main="Patient's Health Record")
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
plot(data$CoreTemp)
data$CoreTemp
data$Time
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),1:nrow(data)/12)
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),1:nrow(data)/12)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
lines(1:nrow(data),data$EDR.BR, col="red", lwd = 3)
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
myfunc(c2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="pink",lty=1,lwd=1,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","pink","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="red",lty=1,lwd=1,pch=15,cex=1.3,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","red","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="red",lty=1,lwd=1,pch=15,cex=1.3,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","red","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
grid()
}
myfunc(d2.mopp.data)
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="red",lty=1,lwd=1,pch=15,cex=1.3,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","red","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
segments(0,0:20*10,nrow(data),0:20*10,lty=3,lwd=.5,col="grey20")
}
myfunc(d2.mopp.data)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
axis(1,1:nrow(data),round(1:nrow(data)/12))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="red",lty=1,lwd=1,pch=15,cex=1.3,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","red","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
segments(0,0:20*10,nrow(data),0:20*10,lty=3,lwd=.5,col="black")
a2.mopp.data$r <- 1:nrow(a2.mopp.data)
loess.model1 <- loess(ECG.HR~r, data = a2.mopp.data, span = 0.05)
print(loess.model1)
plot(a2.mopp.data$ECG.HR,xaxt="n",bty="n",pch=16,cex=.5,type="o",las=1,
ylab="ECH.HR",xlab="Time")
axis(1,las=3,cex.axis=.95)
points(predict(loess.model1, data.frame(r=1:nrow(a2.mopp.data))), col="gold")
mins <- ceiling(nrow(data)/12)
mins5 <- ceiling(mins/5)*5
mins
mins5
library(gplots)
library(plotrix)
library(colorspace)
library(colorRamps)
library(RColorBrewer)
mav <- function(data,n){
stats::filter(data,rep(1/n,n), sides=2)
}
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
mins <- ceiling(nrow(data)/12)
mins5 <- ceiling(mins/5)*5
axis(1,0:(mins5/5), seq(0,mins5,5))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="red",lty=1,lwd=1,pch=15,cex=1.3,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","red","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
segments(0,0:20*10,nrow(data),0:20*10,lty=3,lwd=.5,col="black")
}
myfunc(d2.mopp.data)
myfunc <- function(data){
#  adjustcolor("blanchedalmond",alpha.f = 0.3)
plot(data$EDR.BR,cex=1.5,
type="l",las=1,col="green", lwd=2.5,
ylim = c(0,max(data$ECG.HR,na.rm=T)), xlab = "Time (minutes)", ylab = "", main="Patient's Health Record",xaxt="n")
mins <- ceiling(nrow(data)/12)
mins5 <- ceiling(mins/5)*5
axis(1,0:(mins5/5)*5*12, seq(0,mins5,5))
points(data$ECG.HR,col="blue",pch=16,cex=.8)
points(mav(data$ECG.HR, n=15),col="navy",lty=1,lwd=3,type="l")
points(data$Temp!=0,col="orange",lty=1,lwd=1)
points(data$Belt.BR,col="red",lty=1,lwd=1,pch=15,cex=1.3,type="o")
##coretemp has a lot of dropout.
data$CoreTemp[data$CoreTemp<1] <- NA
points(data$CoreTemp,col="yellow",lty=1,lwd=1,type="o")
legend("topleft",cex=0.8,inset = 0.01,ncol = 5, fill = c("green","blue","orange","red","yellow"),
legend = c("EDR.BR","ECG.HR","Temp","Belt.BR","CoreTemp"))
segments(0,0:20*10,nrow(data),0:20*10,lty=3,lwd=.5,col="black")
}
myfunc(d2.mopp.data)
plot(as.numeric(d2.mopp.data$Time),d2.mopp.data$Belt.BR,xaxt="n",bty="n",pch=16,cex=.5,las=1,
ylab="Breathing rate",xlab="Time",main="Prediction without EDR.BR predictor")
600/10
d_F <- 600
v0 <- 10
s <- 10
maxtime <- d_F/v0
times <- seq(0,maxtime,1/s)
times
N <- length(times)
braking <- rep(0,N)
speed <- rep(NA,N)
setwd("~/Dropbox/courses/5210-2022/web-5210/psy5210/Projects/Chapter12")
