Deben Oldert před 9 roky
rodič
revize
db813f11aa
2 změnil soubory, kde provedl 10 přidání a 1 odebrání
  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$WALKERROR <- NULL
+
 
   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$WALKERROR <- yPredicted - patient$WALKBASE
+
 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(yPredicted)