Making matrix for ED estimation