WANtaroHP (Statistics)

toJA

Outline of this page

Contents


Single Regression Analysis

Outline of this program

Source code by f90

FilenameDescription
program for single regression analysis


Multiple Regression Analysis

Outline of this program

Format of input data file

 001 | Sample data
 002 | 4,46
 003 | 44523,6364,90547,19.7,640.9
 004 | 10395,7135,12634,20.0,128.2
 005 |  8669,7266,20101,16.3,113.8
..........
001
Comment
002
Number of explanatory variables (=4), number of input data sets (=46)
003
(In this case, y-value and four x-values)
004
(Lower rows from row 3 are y and x-values of data)

Bach command for execution

gfortran -o f90_MRA.exe f90_MRA.f90
f90_MRA inp_MRA.txt out_MRA.txt

Format of execution command

f90_MRA fnameR fnameW
f90_MRAExecution file of f90
fnameR Input file name
fnameW Out put faile name

Source code by f90

FilenameDescription
Program for multiple regression analysis
Sample input data
Sample output data
R script for drawing of input data
R script for drawing of output data
Sample image of input data
Sample image of output data


Principal Component Analysis

Outline of this program

Format of input data file

 001 | iris
 002 | 4,150
 003 | 5.1,3.5,1.4,0.2,setosa,1
 004 | 4.9,3.0,1.4,0.2,setosa,2
 005 | 4.7,3.2,1.3,0.2,setosa,3
..........
001
Comment
002
Number of variables (=4), number of input data sets (=150).
003
(In this case, four values, No.5 and 6 columns are not available.)
004
(Lower rows from row 3 are values of data)

Bach command for execution

gfortran -o f90_PCA.exe f90_PCA.f90

f90_PCA 1 1 inp_iris.csv out_iris.csv

rscript R_DRAWinp.R
ren Rplots.pdf fig_R_PCA_inp.pdf

rscript R_DRAWout.R
ren Rplots.pdf fig_R_PCA_out.pdf

Format of execution command

f90_PCA knor kvok fnameR fnameW
f90_PCAExecution file of f90
knor Index for normalization (0: yes, 1: No)
kvok Index for Var. or Cor. (0: use variance-covariance matrix, 1: use correlation matrix)
fnameR Input file name
fnameW Out put faile name

Source code by f90

FilenameDescription
Program for principal component analysis
Sample input data
Sample output data
R script for drawing of input data
R script for drawing of output data
Sample image of input data
Sample image of output data


Percent point and Probability of exceedance in Standard Normal Distribution

Outline of this program

Source code by f90

FilenameDescription
program for calculation of percent point and exceedance probability
Sample input data
Sample output data


Probability Ellipse

Outline of this program

Bach command for execution

gfortran -o f90_SREG.exe f90_SREG.f90
gfortran -o f90_ELLIP.exe f90_ELLIP.f90

f90_SREG inp_reg1.txt 0.95 > out_reg1.txt
gawk "15<=NR{print $2,$3}" out_reg1.txt > inp_elp1.txt
f90_ELLIP inp_elp1.txt 5 5 5 3 > _elp11.txt
f90_ELLIP inp_elp1.txt 5 5 5 5 > _elp12.txt

The format of command line arguments are shown below.

f90_SREG fnameR pp > fnameW
f90_SREGCompiled F90 frogram for finding the characteristics of the probability ellipse
fnameR Input file name
pp Value of non-exceedance probability for the probability ellipse
fnameW Output file name
f90_ELLIP fnameR LX LY dx,dy > fnameW
f90_ELLIPCompiled F90 frogram for creating the input data for GMT
fnameR Input file name
LX Length of x-axis of the graph in the unit of 'cm'
LY Length of y-axis of the graph in the unit of 'cm'
dx Range of x-axis (maximum x-value minus minimum x-value on the x-axis of the graph)
dy Range of y-axis (maximum y-value minus minimum y-value on the y-axis of the graph)
fnameW Output file name

Source code by f90

FilenameDescription
Program for single regression and probability ellipse
Program for creating data for GMT drawing
Input data sample
Document of theory and output sample


Cluster Analysis (K-means++ method)

Outline of this program

Format of input data file

Format of input data is the same as it for principal component analysis.

 001 | iris
 002 | 4,150
 003 | 5.1,3.5,1.4,0.2,setosa,1
 004 | 4.9,3.0,1.4,0.2,setosa,2
 005 | 4.7,3.2,1.3,0.2,setosa,3
..........
001
Comment
002
Number of variables (=4), number of input data sets (=150).
003
(In this case, four values, No.5 and 6 columns are not available.)
004
(Lower rows from row 3 are values of data)

Bach command for execution

gfortran -o f90_KMEANSPP.exe f90_KMEANSPP.f90

f90_KMEANSPP 0 3 30 inp_iris.csv out_iris0.txt
f90_KMEANSPP 2 3 30 inp_iris.csv out_iris2.txt

del fig_R_CLUSinp.pdf
del fig_R_CLUSpca_0.pdf
del fig_R_CLUSpca_2.pdf
del fig_R_CLUSmds_0.pdf
del fig_R_CLUSmds_2.pdf

rscript R_CLUSinp.R inp_iris.csv
ren Rplots.pdf fig_R_CLUSinp.pdf

rscript R_CLUSpca.R out_iris0.txt
ren Rplots.pdf fig_R_CLUSpca_0.pdf
rscript R_CLUSpca.R out_iris2.txt
ren Rplots.pdf fig_R_CLUSpca_2.pdf

rscript R_CLUSmds.R out_iris0.txt
ren Rplots.pdf fig_R_CLUSmds_0.pdf
rscript R_CLUSmds.R out_iris2.txt
ren Rplots.pdf fig_R_CLUSmds_2.pdf

Format of execution command

f90_KMEANSPP imethod kk mds fnameR fnameW
f90_KMEANPPExecution file of f90
imethod calculation method of distance (0: mahalanobis, 1: City block, 2: Euclidean, >=3: Minkowski)
kk Number of cluster
mds Minimum size of one cluster
fnameR Input file name
fnameW Out put faile name

Source code by f90

FilenameDescription
Program for cluster analysis
Sample input data
Sample output data (Mahalanobis)
Sample output data (Euclidean)
R script for drawing using input data
R script for drawing using PCA
R script for drawing using MDS
Sample image (input data)
Sample image (Mahalanobis,PCA)
Sample image (Euclidean, PCA)
Sample image (Mahalanobis,MDS)
Sample image (Euclidean, MDS)


Multi-Dimensional Scaling

Outline of this program

Format of input data file

Vector data input (inp_iris.csv)

Format of input data is the same as it for principal component analysis.

 001 | iris
 002 | 4,150
 003 | 5.1,3.5,1.4,0.2,setosa,1
 004 | 4.9,3.0,1.4,0.2,setosa,2
 005 | 4.7,3.2,1.3,0.2,setosa,3
..........
001
Comment
002
Number of variables (=4), number of input data sets (=150).
003
(In this case, four values, No.5 and 6 columns are not available.)
004
(Lower rows from row 3 are values of data)
Distance matrix input (inp_map.csv)
 001 | Distance
 002 | 9
 003 | KL       , 0
 004 | Tokyo    , 5332.837,  0
 005 | Jakarta  , 1184.231,  5774.036,  0
 006 | Bangkok  , 1179.106,  4605.718,  2308.805,  0
 007 | Vientiane, 1644.533,  4151.984,  2710.010,  513.445,   0
 008 | Ha_Noi   , 2033.150,  3679.648,  3010.784,  979.078,   480.029,  0
 009 | Seoul    , 4612.781,  1162.077,  5275.036, 3715.257,  3223.101,  2743.357,   0
 010 | Beijing  , 4339.820,  2113.622,  5197.282, 3284.870,  2771.456,  2321.983,   964.494,  0
 011 | Maynila  , 2480.550,  2997.510,  2776.534, 2203.659,  2000.776,  1757.266,  2614.778,  2846.152, 0
001
Comment
002
Number of items (=9)
003-011
Distance between capital cities

Bach command for execution

Example for vector data input (inp_iris.csv)
gfortran -o f90_MDS.exe f90_MDS.f90

f90_MDS 1 inp_iris.csv out_MDS_iris.csv

del fig_R_MDS_inp.pdf
del fig_R_MDS_out.pdf
rscript R_DRAWinp.R
ren Rplots.pdf fig_R_MDS_inp.pdf
rscript R_DRAWout_1.R
ren Rplots.pdf fig_R_MDS_out.pdf
Example for distance matrix input (inp_map.csv)
gfortran -o f90_MDS.exe f90_MDS.f90

f90_MDS 0 inp_map.csv out_MDS_map.csv

del fig_R_MDS_map.pdf
rscript R_DRAWout_0.R
ren Rplots.pdf fig_R_MDS_map.pdf

Format of execution command

f90_MDS knor fnameR fnameW
f90_MDSExecution file of f90
knor treatment of data (0: distance matrix input, 1: normalization of vector data, 2: no-normalization of vector data
fnameR Input file name
fnameW Out put faile name

Source code by f90

FilenameDescription
Program for MDS
Sample input data (vector data of 'iris')
Sample output data for 'iris'
Sample inpur data (distance matrix)
Sample output data for 'map'
R script for drawing using input vector data
R script for drawing of map
R script for drawing of vector data
Sample image (input vector data)
Sample image (output for vector data)
Sample image (2-dim. map). Refer to below drawing.
2-dim.map by GMT (centering Kuala Lumpur)

toJA
inserted by FC2 system