Make ahead: The gratin can be made ahead through the first 45-minute baking step. Uncover and let cool completely. Cover the baking dish tightly with aluminum foil and refrigerate for up to 5 days. To reheat, remove from the oven about one hour before and heat the oven to 375ºF. Bake, still covered, for 20 minutes. Uncover and proceed with increasing the oven temperature and baking for the remaining time.
Substitutions: Russet potatoes can be substituted for the Yukon Golds. One small yellow onion can be substituted for the shallot. Half-and-half can be substituted for the heavy cream. Some or all of the Pecorino Romano cheese can be replaced with equal amounts of grated Parmesan cheese.
Storage: Leftovers can be refrigerated in an airtight container for up to 5 days or frozen for up to 3 months. Thaw overnight in the refrigerator.