ajout des fonction Crowder

This commit is contained in:
François Pelletier 2014-02-23 21:05:36 -05:00
parent a9dcbb0cb7
commit 1651ea0780
43 changed files with 1139 additions and 0 deletions

26
R/M.Crowder.Mod.R Normal file
View file

@ -0,0 +1,26 @@
# M Matrix (Modified Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' M Matrix (Modified Crowder)
#'
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return M Matrix
#'
#' @author Francois Pelletier
M.Crowder.Mod <- function(param,Y,variancef,skewnessf,kurtosisf,dmean,dsd)
{
-(a.Crowder.Mod(param,Y,variancef,dmean,dsd) %o% dmean(param) +
2*sqrt(variancef(param)) *
b.Crowder.Mod(param,Y,variancef,dmean,dsd) %*% t(dsd(param)))
}

29
R/M.Crowder.R Normal file
View file

@ -0,0 +1,29 @@
# M Matrix (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' M Matrix (Crowder)
#'
#' Identical to the V matrix by definition
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return M Matrix
#'
#' @author Francois Pelletier
M.Crowder <- function(param,Y,variancef,skewnessf,kurtosisf,dmean,dsd)
{
((dmean(param) %o% dmean(param))+
((skewnessf(param)*dmean(param)-2*dsd(param)) %o%
(skewnessf(param)*dmean(param)-2*dsd(param)))/
gammaf.Crowder(param,skewnessf,kurtosisf))/
variancef(param)
}

22
R/M.gauss.R Normal file
View file

@ -0,0 +1,22 @@
# M Matrix (gaussian)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' M Matrix (gaussian)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return M Matrix
#'
#' @author Francois Pelletier
M.gauss <- function(param,Y,meanf,variancef,dmean,dsd)
{
-(a.gauss(param,variancef,dmean,dsd) %o% dmean(param) +
2*sqrt(variancef(param)) * b.gauss(param,variancef,dmean,dsd) %*% t(dsd(param)))
}

30
R/V.Crowder.Mod.R Normal file
View file

@ -0,0 +1,30 @@
# V Matrix (Modified Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' V Matrix (Modified Crowder)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return V Matrix
#'
#' @author Francois Pelletier
V.Crowder.Mod <- function(param,Y,variancef,dmean,dsd)
{
(variancef(param)*(a.Crowder.Mod(param,Y,variancef,dmean,dsd) %o%
a.Crowder.Mod(param,Y,variancef,dmean,dsd) +
sqrt(variancef(param)) * skewness(Y) *
(a.Crowder.Mod(param,Y,variancef,dmean,dsd) %o%
b.Crowder.Mod(param,Y,variancef,dmean,dsd) +
b.Crowder.Mod(param,Y,variancef,dmean,dsd) %o%
a.Crowder.Mod(param,Y,variancef,dmean,dsd)) +
variancef(param) * (kurtosis(Y)-3+2) *
b.Crowder.Mod(param,Y,variancef,dmean,dsd) %*%
t(b.Crowder.Mod(param,Y,variancef,dmean,dsd))))
}

27
R/V.Crowder.R Normal file
View file

@ -0,0 +1,27 @@
# V Matrix (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' V Matrix (Crowder)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return V Matrix
#'
#' @author Francois Pelletier
V.Crowder <- function(param,Y,variancef,skewnessf,kurtosisf,dmean,dsd)
{
((dmean(param) %o% dmean(param))+
((skewnessf(param)*dmean(param)-2*dsd(param)) %o%
(skewnessf(param)*dmean(param)-2*dsd(param)))/
gammaf.Crowder(param,skewnessf,kurtosisf))/
variancef(param)
}

33
R/V.gauss.R Normal file
View file

@ -0,0 +1,33 @@
# V Matrix (gaussian)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' V Matrix (gaussian)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return V Matrix
#'
#' @author Francois Pelletier
V.gauss <- function(param,Y,meanf,variancef,skewnessf,kurtosisf,dmean,dsd)
{
(variancef(param)*(a.gauss(param,variancef,dmean,dsd) %o%
a.gauss(param,variancef,dmean,dsd) +
sqrt(variancef(param)) * skewnessf(param) *
(a.gauss(param,variancef,dmean,dsd) %o%
b.gauss(param,variancef,dmean,dsd) +
b.gauss(param,variancef,dmean,dsd) %o%
a.gauss(param,variancef,dmean,dsd)) +
variancef(param)*(kurtosis(param)+2) *
b.gauss(param,variancef,dmean,dsd) %*%
t(b.gauss(param,variancef,dmean,dsd))))
}

23
R/a.Crowder.Mod.R Normal file
View file

@ -0,0 +1,23 @@
# First weighting vector of the modified quadratic estimating equation (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' First weighting vector of the modified quadratic estimating equation (Crowder)
#'
#' @param param Vector of parameters of the distribution function
#' @param Y Individual data sample
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return First weighting vector
#'
#' @author Francois Pelletier
a.Crowder.Mod <- function(param,Y,variancef,dmean,dsd)
{
(-(moments::kurtosis(Y)-1)*dmean(param)+
2*moments::skewness(Y)*dsd(param))/
(variancef(param)*gammaf.Crowder.Mod(Y))
}

24
R/a.Crowder.R Normal file
View file

@ -0,0 +1,24 @@
# First weighting vector of the quadratic estimating equation (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' First weighting vector of the quadratic estimating equation (Crowder)
#'
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return First weighting vector
#'
#' @author Francois Pelletier
a.Crowder <- function(param,variancef,skewnessf,kurtosisf,dmean,dsd)
{
(-(kurtosisf(param)+2)*dmean(param)+
2*skewnessf(param)*dsd(param))/
(variancef(param)*gammaf.Crowder(param,skewnessf,kurtosisf))
}

18
R/a.gauss.R Normal file
View file

@ -0,0 +1,18 @@
# First weighting vector of the quadratic estimating equation (gaussian)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' First weighting vector of the quadratic estimating equation (gaussian)
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @return First weighting vector
#'
#' @author Francois Pelletier
a.gauss <- function(param,variancef,dmean)
{
dmean(param)/variancef(param)
}

22
R/b.Crowder.Mod.R Normal file
View file

@ -0,0 +1,22 @@
# Second weighting vector of the modified quadratic estimating equation (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Second weighting vector of the modified quadratic estimating equation (Crowder)
#'
#' @param param Vector of parameters of the distribution function
#' @param Y Individual data sample
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return First weighting vector
#'
#' @author Francois Pelletier
a.Crowder.Mod <- function(param,Y,variancef,dmean,dsd)
{
(moments::skewness(Y)*dmean(param)-2*dsd(param)) /
(variancef(param)^(3/2)*gammaf.Crowder.Mod(Y))
}

24
R/b.Crowder.R Normal file
View file

@ -0,0 +1,24 @@
# Second weighting vector of the quadratic estimating equation (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Second weighting vector of the quadratic estimating equation (Crowder)
#'
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return First weighting vector
#'
#' @author Francois Pelletier
b.Crowder <- function(param,variancef,skewnessf,kurtosisf,dmean,dsd)
{
(skewnessf(param)*dmean(param)-
2*dsd(param))/
(variancef(param)^(3/2)*gamma.Crowder(param,skewnessf,kurtosisf))
}

20
R/b.gauss.R Normal file
View file

@ -0,0 +1,20 @@
# Second weighting vector of the quadratic estimating equation (gaussian)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Second weighting vector of the quadratic estimating equation (gaussian)
#' @param param Vector of parameters of the distribution function
#' @param variancef Variance function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return Second weighting vector
#'
#' @author Francois Pelletier
b.gauss <- function(param,variancef,dsd)
{
dsd(param)/variancef(param)
}

23
R/eqn.Crowder.Mod.R Normal file
View file

@ -0,0 +1,23 @@
# Modified Quadratic estimating equation (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Modified Quadratic estimating equation (Crowder)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return The vector value of the estimating equation
#'
#' @author Francois Pelletier
eqn.Crowder.Mod <- function(param,Y,meanf,variancef,dmean,dsd)
{
a.Crowder.Mod(param,variancef,dmean,dsd) * sum(Y-meanf(param)) +
b.Crowder.Mod(param,variancef,dmean,dsd) * sum((Y-meanf(param))^2-variancef(param))
}

25
R/eqn.Crowder.R Normal file
View file

@ -0,0 +1,25 @@
# Quadratic estimating equation (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Quadratic estimating equation (Crowder)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return The vector value of the estimating equation
#'
#' @author Francois Pelletier
eqn.Crowder <- function(param,Y,meanf,variancef,skewnessf,kurtosisf,dmean,dsd)
{
a.Crowder(param,variancef,skewnessf,kurtosisf,dmean,dsd) * sum(Y-meanf(param)) +
b.Crowder(param,variancef,skewnessf,kurtosisf,dmean,dsd) * sum((Y-meanf(param))^2-variancef(param))
}

23
R/eqn.gauss.R Normal file
View file

@ -0,0 +1,23 @@
# Quadratic estimating equation (gaussian)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Quadratic estimating equation (gaussian)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @return The vector value of the estimating equation
#'
#' @author Francois Pelletier
eqn.gauss <- function(param,Y,meanf,variancef,dmean,dsd)
{
a.gauss(param,variancef,dmean,dsd) * sum(Y-meanf(param)) +
b.gauss(param,variancef,dmean,dsd) * sum((Y-meanf(param))^2-variancef(param))
}

17
R/gammaf.Crowder.Mod.R Normal file
View file

@ -0,0 +1,17 @@
# Gamma function used in Modified Crowder Estimating Equations
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Gamma function used in Modified Crowder Estimating Equations
#' @param Y Individual data sample
#' @return Gamma function value
#'
#' @author Francois Pelletier
gammaf.Crowder.Mod <- function(Y)
{
moments::kurtosis(Y)-1-moments::skewness(Y)^2
}

19
R/gammaf.Crowder.R Normal file
View file

@ -0,0 +1,19 @@
# Gamma function used in Crowder Estimating Equations
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Gamma function used in Crowder Estimating Equations
#' @param param Vector of parameters of the distribution function
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @return Gamma function value
#'
#' @author Francois Pelletier
gammaf.Crowder <- function(param,skewnessf,kurtosisf)
{
kurtosisf(param)+2-skewnessf(param)^2
}

25
R/obj.Crowder.Mod.R Normal file
View file

@ -0,0 +1,25 @@
# Modified Quadratic form objective function for optimization of the parameter vector (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Modified Quadratic form objective function for optimization of the parameter vector (Crowder)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @param Q Weight matrix
#' @return The value of the quadratic form
#'
#' @author Francois Pelletier
obj.Crowder.Mod <- function(param,Y,meanf,variancef,dmean,dsd,Q=diag(4))
{
eqn.Crowder.Mod(param,Y,meanf,variancef,dmean,dsd) %*% Q %*%
eqn.Crowder.Mod(param,Y,meanf,variancef,dmean,dsd)
}

27
R/obj.Crowder.R Normal file
View file

@ -0,0 +1,27 @@
# Quadratic form objective function for optimization of the parameter vector (Crowder)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Quadratic form objective function for optimization of the parameter vector (Crowder)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param skewnessf Skewness function of the distribution
#' @param kurtosisf Kurtosis function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @param Q Weight matrix
#' @return The value of the quadratic form
#'
#' @author Francois Pelletier
obj.Crowder <- function(param,Y,meanf,variancef,skewnessf,kurtosisf,dmean,dsd,Q=diag(4))
{
eqn.Crowder(param,Y,meanf,variancef,skewnessf,kurtosisf,dmean,dsd) %*% Q %*%
eqn.Crowder(param,Y,meanf,variancef,skewnessf,kurtosisf,dmean,dsd)
}

25
R/obj.gauss.R Normal file
View file

@ -0,0 +1,25 @@
# Quadratic form objective function for optimization of the parameter vector (gaussian)
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Quadratic form objective function for optimization of the parameter vector (gaussian)
#' @param Y Individual data sample
#' @param param Vector of parameters of the distribution function
#' @param meanf Mean function of the distribution
#' @param variancef Variance function of the distribution
#' @param dmean Derivative in respect to the parameter vector of the mean function of the distribution
#' @param dsd Derivative in respect to the parameter vector of the standard deviation function of the distribution
#' @param Q Weight matrix
#' @return The value of the quadratic form
#'
#' @author Francois Pelletier
obj.gauss <- function(param,Y,meanf,variancef,dmean,dsd,Q=diag(4))
{
eqn.gauss(param,Y,meanf,variancef,dmean,dsd) %*% Q %*%
eqn.gauss(param,Y,meanf,variancef,dmean,dsd)
}