finished first SPSStoR function