Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=8), | intent(in) | :: | mean_x | |||
real(kind=8), | intent(in) | :: | mean_y | |||
real(kind=8), | intent(out) | :: | a | |||
real(kind=8), | intent(out) | :: | b | |||
real(kind=8), | intent(out) | :: | c | |||
real(kind=8), | intent(out) | :: | sxy |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i | ||||
real(kind=8), | public | :: | sxx | ||||
real(kind=8), | public | :: | syy |
subroutine calculate_regression(mean_x, mean_y, a, b, c, sxy)
real(8), intent(in) :: mean_x, mean_y
real(8), intent(out) :: a, b, c, sxy
integer :: i
real(8) :: sxx, syy
sxy = sum(x_seq(1:n_seq)*y_seq(1:n_seq))/n_seq - mean_x*mean_y
sxx = sum(x_seq(1:n_seq)*x_seq(1:n_seq))/n_seq - mean_x**2
syy = sum(y_seq(1:n_seq)*y_seq(1:n_seq))/n_seq - mean_y**2
a = sxy/sxx
b = mean_y - a*mean_x
c = sxy/sqrt(sxx*syy)
end subroutine calculate_regression