Prediction of the chemical and thermal shrinkage in a thermoset polymer