Codes for functions in my latest package for analysis