      subroutine subrmscor1(ncor,xx,yy,cor,rms,xav,yav,areg,creg)
C....................................................July 2020
C include corr, rms, Add: regr y-yav=a*(x-xav)
C                              y=yav+a*(x-xav)
      DIMENSION	xx(372),yy(372)
C
      xav=0.
	yav=0.
	xav2=0.
	xyav=0.
	drms=0.
	do k=1,ncor
	xav=xav+xx(k)
	yav=yav+yy(k)
	xav2=xav2+xx(k)**2
	xyav=xyav+xx(k)*yy(k)
	drms=drms+(yy(k)-xx(k))**2
	enddo
	xav=xav/ncor
	yav=yav/ncor
	xav2=xav2/ncor
	xyav=xyav/ncor
	areg=(xyav-xav*yav)/(xav2-xav**2)
	creg=yav-areg*xav
	rms=sqrt(drms/ncor)
C
      dx=0.
	dy=0.
	sx=0.
	sy=0.
	sxy=0.
	do k=1,ncor
	dx=xx(k)-xav
	dy=yy(k)-yav
	sxy=sxy+dx*dy
	sx=sx+dx**2
      sy=sy+dy**2
	enddo
	sx=sx/(ncor-1.)
      sy=sy/(ncor-1.)
	sxy=sxy/(ncor-1.)
C
C?      cor=sxy/(sqrt(dy2)*sqrt(dx2))
      cor=sxy/sqrt(sx*sy)
	RETURN
	END
