diff --git a/.Rbuildignore b/.Rbuildignore
new file mode 100644
index 0000000..04a8cf7
--- /dev/null
+++ b/.Rbuildignore
@@ -0,0 +1,6 @@
+^.*\.Rproj$
+^\.Rproj\.user$
+.gitignore
+.project
+.git
+.settings
diff --git a/.gitignore b/.gitignore
index a0fd3b3..6c38bf7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
# Example code in package build process
*-Ex.R
+.Rproj.user
diff --git a/.project b/.project
new file mode 100644
index 0000000..9b7f2a2
--- /dev/null
+++ b/.project
@@ -0,0 +1,19 @@
+
+
+ GMMStuff
+
+
+
+
+
+ de.walware.statet.r.builders.RSupport
+
+
+
+
+
+ de.walware.statet.base.StatetNature
+ de.walware.statet.r.RNature
+ de.walware.statet.r.RPkgNature
+
+
diff --git a/.settings/de.walware.r.core.prefs b/.settings/de.walware.r.core.prefs
new file mode 100644
index 0000000..935c1fc
--- /dev/null
+++ b/.settings/de.walware.r.core.prefs
@@ -0,0 +1,2 @@
+RProjectBuild/Package.name=GMMStuff
+eclipse.preferences.version=1
diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..672d0d0
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,9 @@
+Package: GMMStuff
+Title: GMM Stuff
+Version: 0.1
+Date: 2014-02-11
+Author: Francois Pelletier
+Maintainer: Francois Pelletier
+Description: This is a package gathering different functions to work with
+ GMM
+License: LGPL-3
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..e69de29
diff --git a/R/covariance.GMM.R b/R/covariance.GMM.R
new file mode 100644
index 0000000..42820d5
--- /dev/null
+++ b/R/covariance.GMM.R
@@ -0,0 +1,18 @@
+# Estimated covariance matrix
+#
+# Author: Francois Pelletier
+#
+# LGPL-3.0
+###############################################################################
+
+#' Estimated covariance matrix
+#' @param conditions.vector Vector of moment conditions
+#' @param n Sample size
+#' @param ... Parameters of the vector of moment conditions
+#' @return A square covariance matrix
+#'
+#' @author François Pelletier
+gmmGAL.mu.vcov <- function(conditions.vector,n,...)
+{
+ t(conditions.vector(...)) %*% conditions.vector(...) / n
+}
\ No newline at end of file
diff --git a/R/fourmoments.gmm.vector.R b/R/fourmoments.gmm.vector.R
new file mode 100644
index 0000000..f6aa822
--- /dev/null
+++ b/R/fourmoments.gmm.vector.R
@@ -0,0 +1,24 @@
+# GMM vector for 4 first central moments conditions
+#
+# Author: Francois Pelletier
+#
+# LGPL-3.0
+###############################################################################
+
+#' GMM vector for 4 first central moments conditions
+#' @param param Estimated parameters
+#' @param sample Data Sample
+#' @param meanf Mean function
+#' @param variancef Variance function
+#' @param skewnessf Skewness function
+#' @param kurtosisf Kurtosis function
+#' @return A four column matrix of differences
+#'
+#' @author François Pelletier
+fourmoments.gmm.vector <- function(param,sample,meanf,variancef,skewnessf,kurtosisf)
+{
+ cbind(X-meanf(param),
+ (X-meanf(param))^2 - variancef(param),
+ (X-meanf(param))^3/variancef(param)^(3/2) - skewnessf(param),
+ (X-meanf(param))^4/variancef(param)^(2) - kurtosisf(param))
+}
diff --git a/R/mean.variance.gmm.vector.R b/R/mean.variance.gmm.vector.R
new file mode 100644
index 0000000..74e2a04
--- /dev/null
+++ b/R/mean.variance.gmm.vector.R
@@ -0,0 +1,20 @@
+# GMM vector for mean and variance moment conditions
+#
+# Author: Francois Pelletier
+#
+# LGPL-3.0
+###############################################################################
+
+
+#' GMM vector for mean and variance moment conditions
+#' @param param Estimated parameters
+#' @param sample Data Sample
+#' @param meanf Mean function
+#' @param variancef Variance function
+#' @return A two column matrix of differences
+#'
+#' @author François Pelletier
+mean.variance.gmm.vector <- function(param,sample,meanf,variancef)
+{
+ cbind(X-meanf(param),(X-meanf(param))^2 - variancef(param))
+}
diff --git a/R/objective.GMM.R b/R/objective.GMM.R
new file mode 100644
index 0000000..f99937a
--- /dev/null
+++ b/R/objective.GMM.R
@@ -0,0 +1,18 @@
+# Objective function for the GMM method
+#
+# Author: Francois Pelletier
+#
+# LGPL-3.0
+###############################################################################
+
+#' Objective function for the GMM method
+#' @param conditions.vector Vector of moment conditions
+#' @param ... Parameters of the vector of moment conditions
+#' @param W Weighting matrix
+#' @return A scalar value
+#'
+#' @author François Pelletier
+obj.gmmGAL.mu <- function(conditions.vector,...,W=diag(length(conditions.vector)))
+{
+ colMeans(conditions.vector(...)) %*% ginv(W) %*% colMeans(conditions.vector(...))
+}
\ No newline at end of file
diff --git a/man/fourmoments.gmm.vector.Rd b/man/fourmoments.gmm.vector.Rd
new file mode 100644
index 0000000..045757b
--- /dev/null
+++ b/man/fourmoments.gmm.vector.Rd
@@ -0,0 +1,29 @@
+\name{fourmoments.gmm.vector}
+\alias{fourmoments.gmm.vector}
+\title{GMM vector for 4 first central moments conditions}
+\usage{
+fourmoments.gmm.vector(param, sample, meanf, variancef, skewnessf, kurtosisf)
+}
+\arguments{
+ \item{param}{Estimated parameters}
+
+ \item{sample}{Data Sample}
+
+ \item{meanf}{Mean function}
+
+ \item{variancef}{Variance function}
+
+ \item{skewnessf}{Skewness function}
+
+ \item{kurtosisf}{Kurtosis function}
+}
+\value{
+A four column matrix of differences
+}
+\description{
+GMM vector for 4 first central moments conditions
+}
+\author{
+François Pelletier
+}
+
diff --git a/man/gmmGAL.mu.vcov.Rd b/man/gmmGAL.mu.vcov.Rd
new file mode 100644
index 0000000..3a4a2aa
--- /dev/null
+++ b/man/gmmGAL.mu.vcov.Rd
@@ -0,0 +1,23 @@
+\name{gmmGAL.mu.vcov}
+\alias{gmmGAL.mu.vcov}
+\title{Estimated covariance matrix}
+\usage{
+gmmGAL.mu.vcov(conditions.vector, n, ...)
+}
+\arguments{
+ \item{conditions.vector}{Vector of moment conditions}
+
+ \item{n}{Sample size}
+
+ \item{...}{Parameters of the vector of moment conditions}
+}
+\value{
+A square covariance matrix
+}
+\description{
+Estimated covariance matrix
+}
+\author{
+François Pelletier
+}
+
diff --git a/man/mean.variance.gmm.vector.Rd b/man/mean.variance.gmm.vector.Rd
new file mode 100644
index 0000000..7d762db
--- /dev/null
+++ b/man/mean.variance.gmm.vector.Rd
@@ -0,0 +1,25 @@
+\name{mean.variance.gmm.vector}
+\alias{mean.variance.gmm.vector}
+\title{GMM vector for mean and variance moment conditions}
+\usage{
+\method{mean}{variance.gmm.vector}(param, sample, meanf, variancef)
+}
+\arguments{
+ \item{param}{Estimated parameters}
+
+ \item{sample}{Data Sample}
+
+ \item{meanf}{Mean function}
+
+ \item{variancef}{Variance function}
+}
+\value{
+A two column matrix of differences
+}
+\description{
+GMM vector for mean and variance moment conditions
+}
+\author{
+François Pelletier
+}
+
diff --git a/man/obj.gmmGAL.mu.Rd b/man/obj.gmmGAL.mu.Rd
new file mode 100644
index 0000000..f20c119
--- /dev/null
+++ b/man/obj.gmmGAL.mu.Rd
@@ -0,0 +1,23 @@
+\name{obj.gmmGAL.mu}
+\alias{obj.gmmGAL.mu}
+\title{Objective function for the GMM method}
+\usage{
+obj.gmmGAL.mu(conditions.vector, ..., W = diag(length(conditions.vector)))
+}
+\arguments{
+ \item{conditions.vector}{Vector of moment conditions}
+
+ \item{...}{Parameters of the vector of moment conditions}
+
+ \item{W}{Weighting matrix}
+}
+\value{
+A scalar value
+}
+\description{
+Objective function for the GMM method
+}
+\author{
+François Pelletier
+}
+