potreg Interface

public interface potreg

Performs potential regression between two sets of values, obtaining parameters and of the following equation.

Where:

  • and are vectors with real numbers.
  • and are the regression coefficients.

Parameter is also calculated to determine the goodness of fit.

Syntax

CALL potreg(x,y,a,b,R2)

Where:

  • x and y = vectors of rank 1 with real numbers. See this example to use an array of rank larger than 1.
  • a, b = regression coefficients calculated by the subroutine.
  • R2 = the determination coefficient to measure the goodness of fit, calculated by the subroutine.

Example

The following program performs a potential regression of two variables:

 PROGRAM potregExample
    USE FU_Statistics, ONLY: potreg
    IMPLICIT NONE
    REAL, DIMENSION(5) :: x = [1., 2., 3., 4., 5.]
    REAL, DIMENSION(5) :: y = [3., 4., 5., 6., 7.]
    REAL :: a, b, R2
    CALL potreg(x, y, a, b, R2)
    WRITE(*,*) a, b, R2
 END PROGRAM potregExample

Contents


Module Procedures

private pure subroutine potreg_sp(x, y, a, b, R2)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in), DIMENSION(:) :: x

Vector of real numbers with the values of the first variable. It can have any size and it must have one dimension.

real(kind=sp), intent(in), DIMENSION(:) :: y

Vector of real numbers with the values of the second variable. It can have any size and it must have one dimension.

real(kind=sp), intent(out) :: a

Regression coefficient.

real(kind=sp), intent(out) :: b

Regression coefficient.

real(kind=sp), intent(out) :: R2

Determination coefficient.

private pure subroutine potreg_dp(x, y, a, b, R2)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in), DIMENSION(:) :: x

Vector of real numbers with the values of the first variable. It can have any size and it must have one dimension.

real(kind=dp), intent(in), DIMENSION(:) :: y

Vector of real numbers with the values of the second variable. It can have any size and it must have one dimension.

real(kind=dp), intent(out) :: a

Regression coefficient.

real(kind=dp), intent(out) :: b

Regression coefficient.

real(kind=dp), intent(out) :: R2

Determination coefficient.

private pure subroutine potreg_qp(x, y, a, b, R2)

Arguments

Type IntentOptional Attributes Name
real(kind=qp), intent(in), DIMENSION(:) :: x

Vector of real numbers with the values of the first variable. It can have any size and it must have one dimension.

real(kind=qp), intent(in), DIMENSION(:) :: y

Vector of real numbers with the values of the second variable. It can have any size and it must have one dimension.

real(kind=qp), intent(out) :: a

Regression coefficient.

real(kind=qp), intent(out) :: b

Regression coefficient.

real(kind=qp), intent(out) :: R2

Determination coefficient.