Deben Oldert 9 years ago
parent
commit
db813f11aa
2 changed files with 10 additions and 1 deletions
  1. 2 0
      code/patient.R
  2. 8 1
      code/state.R

+ 2 - 0
code/patient.R

@@ -14,5 +14,7 @@ patient <- new.env()
 
 
   patient$SITBASE <- NULL
   patient$SITBASE <- NULL
 
 
+  patient$WALKERROR <- NULL
+
 
 
   patient$height <- function() abs(patient$SITBASE) + patient$WALKBASE
   patient$height <- function() abs(patient$SITBASE) + patient$WALKBASE

+ 8 - 1
code/state.R

@@ -93,8 +93,15 @@ yPredicted <- as.vector(predict(yPrediction, data.frame(index=patient$WALKING)))
 
 
 patient$WALKBASE <- mean(c(yPredicted[1], tail(yPredicted, n=1)))
 patient$WALKBASE <- mean(c(yPredicted[1], tail(yPredicted, n=1)))
 
 
+patient$WALKERROR <- yPredicted - patient$WALKBASE
+
 for(i in patient$WALKING[1]:(length(patient$WALKING) + patient$WALKING[1] - 1)){
 for(i in patient$WALKING[1]:(length(patient$WALKING) + patient$WALKING[1] - 1)){
-  DATA[i,]$Head.y <- DATA[i,]$Head.y - (yPredicted[i-patient$WALKING[1]+1] - patient$WALKBASE)
+  #DATA[i,]$Head.y <- DATA[i,]$Head.y - (yPredicted[i-patient$WALKING[1]+1] - patient$WALKBASE)
+  #DATA[,grep(".y", colnames(DATA))]
+
+  for(j in colnames(DATA[i,grep(".y", colnames(DATA))])){
+    DATA[i,j] <- DATA[i,j] - patient$WALKERROR[i - patient$WALKING[1] + 1]
+  }
 }
 }
 remove(yPrediction)
 remove(yPrediction)
 remove(yPredicted)
 remove(yPredicted)