The row above a business in a spreadsheet may belong to a completely different business. Even when the rows belong to the same business, the previous observation might be two periods earlier. Before interpreting “earlier capacity” or “event A before event B”, define what earlier means and verify that the app used the intended history.
Open the saved temporal and panel project from Temporal QCA. Its original panel-time.csv has nine observations for u1, u2 and u3, with three integer periods per unit. The source rows are deliberately out of order. Keep case_id for tracing, unit to identify the history, and period to locate each observation within it.
Construct a one-period lag
- Open a working copy of the project. Choose Data → More → Temporal workflows and select the original panel dataset as Transformation source.
- Choose Define temporal outputs, set unit as the identifier and period as the time column, and use Named integer periods. Check one row per unit and period. Resolve duplicates explicitly rather than treating file order as a tie-breaker.
- Define capacity_previous_period from the capacity column. Choose Lagged value, then the Exact elapsed time lag rule and one period.
- Choose Inspect generated values before saving. For u1, the records are t02 at period 1, t07 at period 2 and t05 at period 3. Their capacities are 10, 20 and 30, so the expected lags are missing, 10 and 20. The lag for t07 should come from t02 regardless of their positions in the file.
The u2 capacities of 20, 30 and 40 yield missing, 20, 30. For u3, 50, 70 and 90 yield missing, 50, 70. A missing first-period lag means there is no earlier observation in the source window. It does not mean capacity was zero.
In a separate thought experiment, suppose u1 had only periods 1 and 3. Under the exact one-period rule, period 3 would have no lag because period 2 is absent. A previous-observed-record rule would select period 1 instead. The complete teaching file does not demonstrate this gap; the example illustrates why the two rules should not be swapped.
Define the event sequence separately
Define a_before_b using Event A before event B, with event_a and event_b as the two recorded event inputs. Match the teaching policy for ties and unobserved events, which treats each as set absence (0). The original data show:
| Unit | First A | First B | A before B under the teaching policy |
|---|---|---|---|
| u1 | 1 | 2 | 1 |
| u2 | 2 | 1 | 0 |
| u3 | 1 | 1 | 0 for the tie |
The 0 for u3 does not say B came first. It records how the revision treats a same-period tie. If the study has no time resolution within a period, you do not know the order.
Preserve histories before selecting final observations
Save a separate temporal dataset and retain the original. If following the saved event-order analysis, build the complete histories before limiting the outcome analysis to period 3. The explicit original row list 3, 5, 8 selects t03, t05 and t08. If you first removed periods 1 and 2, you would destroy the histories that generate the event-order and lag values.
The saved event-order example uses a_before_b as a condition and Y as its outcome. The lag column is a separate transformation exercise; its presence in the dataset does not mean it belongs in the model. Use Preview temporal truth table after selecting the intended study, case policy and thresholds. Keep the final observation rule alongside the transformation definition so someone else can reproduce both.