public int ColIndex(RandomisationArm arm) { int returnVar = ColHeaders.IndexOf(arm); if (returnVar == -1) { ColHeaders.Add(arm); foreach (var row in Participants) { row.Add(new OrderedList <int>()); } return(ColHeaders.Count - 1); } return(returnVar); }
internal static string GetTrialArmDescription(RandomisationArm arm) { switch (arm) { case RandomisationArm.DanishBcg: return(Strings.Vaccine_DanishBcg); case RandomisationArm.RussianBCG: return(Strings.Vaccine_RussianBcg); case RandomisationArm.Control: return(Strings.ParticipantUpdateVM_ControlArm); case RandomisationArm.GreenSignalBcg: return(Strings.Vaccine_GreenSignalBcg); } throw new InvalidEnumArgumentException(arm.ToString()); }
//returns true if the given participantId requires assignment to a new DataRequiredOption, otherwise returns false. public RowMove AlterParticipant(int participantId, RandomisationArm arm, DataRequiredOption dataRequired) { int col = ColIndex(arm); int row = 0; var returnVar = new RowMove { OldRow = Participants.Select(r => new { rowIndex = row++, cellData = r[col] }) .First(c => c.cellData.Contains(participantId)) .rowIndex, NewRow = RowIndex(dataRequired) }; if (returnVar.OldRow != returnVar.NewRow) { Participants[returnVar.OldRow][col].Remove(participantId); Participants[returnVar.NewRow][col].Add(participantId); } return(returnVar); }
public void TestCumulativeP() { var emptyBlock = new RandomisationArm[0]; double d = 0; var moqRand = new Mock <IRandom>(MockBehavior.Strict); moqRand.Setup(m => m.NextDouble()).Returns(() => d); foreach (var r in GetRatio()) { var counter = new Counter <RandomisationArm>(); double blockSize = r.TotalBlockSize(); double increment = 1 / (blockSize); for (d = increment / 2; d < 1; d += increment) { var nextAlloc = BlockRandomisation.NextAllocation(emptyBlock, r, moqRand.Object); counter[nextAlloc]++; } MyCollectionAssert.AreEquivalent(r.GetAllocations(), counter); } }
internal static int GetCountInArm(this AllocationBlock block, RandomisationArm arm) { return(GetRatio(block.AllocationGroup).Ratios[arm] * block.GroupRepeats); }
public ParticipantDataStage(RandomisationArm arm, DataRequiredOption dataRequired) { Arm = arm; DataRequired = dataRequired; }