## Tower of London - Calculating time variables

##### Tower of London - Calculating time variables
 Author Message Nicola Group: Forum Members Posts: 11, Visits: 1 Hello all,I am trying to modify the Tower of London script so that it automatically computes all the variables I require. I have worked out how to do this for some variables, but am not sure how to approach this for time variables.I want to compute three time variables (averages per item, summed over multiple attempts): average planning time, average subsequent/execution time and average solution time. So far, I have been able to calculate the total solution time for each item, summed over multiple attempts at that item. Therefore, I need to somehow sum the last line of this variable from the data, and divide by 12. Is there a way to sum the last line of a variable?Similarly, for average planning time, I'll want to sum the first line of expressions.firstmovetime. For the subsequent/execution time, I assume I'll be able to easily subtract my planning average from my total average.I hope this all makes sense. Any thoughts/direction would be greatly appreciated.Thank you!Nicola Dave posted 10 Years Ago ANSWER Group: Administrators Posts: 12K, Visits: 90K To do this, you first need to stop thinking about the data in terms of "first" or "last" line. There is no way for Inquisit to "go back" through the data file while its running and look up those data points. The data file is just a static log of what happened. (Extracting those data points is a trivial exercise using a dedicated data analysis application, though). You, however, want a running computation on-the-fly, i.e., to get a given metric's average you need to (a) continuously update a sum of all relevant data points, (b) keep track of the relevant N and then (c) divide sum by N. Nicola Group: Forum Members Posts: 11, Visits: 1 Hi Dave,Thank you very much for your reply. So in terms of the average solution time, I'm thinking I could introduce a variable (totalsolutiontime) which starts as zero (in and ), and under , is specified as / ontrialbegin=[values.totalsolutiontime=values.totalsolutiontime+values.itemsolutiontime]. I would also include a variable (avesolutiontime) which is specified as values.totalsolutiontime/12 under and zero under and . Does this seem appropriate?When it comes to planning time, I'm not sure how to approach this. I don't think I could do it in the same way as totalsolutiontime, under the , because the value of firstmovetime at the stage will be the firstmovetime of the most recent attempt at the item. I want the firstmovetime of the first attempt at the item. Do you have any suggestions of how to approach this?Thank you!Nicola Dave posted 10 Years Ago ANSWER Group: Administrators Posts: 12K, Visits: 90K So in terms of the average solution time, I'm thinking I could introduce a variable (totalsolutiontime) which starts as zero (in and ), and under , is specified as / ontrialbegin=[values.totalsolutiontime=values.totalsolutiontime+values.itemsolutiontime]. I would also include a variable (avesolutiontime) which is specified as values.totalsolutiontime/12 under and zero under and . Does this seem appropriate?This would be one way to do it.When it comes to planning time, I'm not sure how to approach thisLook at *when exactly* firstmovetime is computed for each attempt by tracing the respective variables in the script. At that point, sum stuff up and store to a  new variable etc. Nicola Group: Forum Members Posts: 11, Visits: 1 Look at *when exactly* firstmovetime is computed for each attempt by tracing the respective variables in the script. At that point, sum stuff up and store to a  new variable etc.Hi Dave,Thank you very much for your guidance! I think it's all worked out correctly now.Nicola

#### Merge Selected

Merge into selected topic...

Merge into merge target...

Merge into a specific topic ID...