added matrix cast in pa_analysis