Preheat oven to 350 degrees. Combine the sweet potatoes, apples, margarine, and sugar; mix well. Combine the dry ingredients; then add them to sweet potato mixture, mixing just until moistened. Fold in the raisins and nuts. Pour into 10x6 inch baking dish. Cover with foil. Bake at 350 degrees for 1 hour. Uncover, continue baking for 10 minutes.