# Fits the model for each value on the grid of lambda values
# A finer grid can be chosen for more accuracy
# Solution is chosen via BIC
#
#
# The data should be called dat, with a response Y and a Geno object.
#
#
# The family can be gaussian, binomial, or poisson
#
#
# The details of the control options, etc are the same as in Haplo.glm from
# the Haplo.stats package. The fit is a penalized version,
# but the other options remain the same.
#
# Example call of the function with binomial data
lambdas = seq(0.1,5,0.1)
fit.pen.reg <- haplo.pen.glm.1(Y ~ Geno, family = binomial, lambdas = lambdas, allele.lev=attributes(Geno)$unique.alleles,
data=dat, control = haplo.glm.control(keep.rare.haplo=FALSE))
# full list of the unique haplotypes
# (each row corresponds to a unique haplotype consistent with the observed data)
fit.pen.reg$haplo.unique
# estimated frequencies corresponding to the unique haplotypes
fit.pen.reg$haplo.freq
# haplotype set as the baseline for the regression
# (the number corresponds to the row number from the list of unique haplotypes)
fit.pen.reg$haplo.base
# coefficient estimates
# (the numbers correspond to the rows in the list of unique haplotypes)
fit.pen.reg$coef