Mix the yams and apples, and place into the bottom of a 2-quart casserole dish. Stir the pecans, sugar, and cinnamon together in a bowl; scatter over the yams and apples. Drizzle the margarine over the mixture.
Bake in the preheated oven until the topping begins to brown, basting 1 or 2 times while cooking, about 20 minutes.