Coefficient value from glmnet I am running glmnet for the first time and I am getting some weird results. 
My dataset has n = 139; p = 70 (correlated variables)
I am trying to estimate the effect of each variable for both, inference and prediction.
I am running:
> cvfit = cv.glmnet(X, Y,family = c('gaussian'),alpha = 0.5,intercept = T,standardize = T,nlambda=100,type = "mse")

> coef(cvfit, s = "lambda.min")

From all the 70 estimates, two caught my attention:
4           0.5731999

14          5.419356829

What bugs me is the fact that:
> cor(X[,4],Y)

[1,] 0.674714

> cor(X[,14],Y)

[1,] -0.01742419

In addition, if I standardize X myself (using scale(X)) and run it again:
> cvfit = cv.glmnet(scale(X), Y,family = c('gaussian'),alpha = 0.5,intercept = T,standardize = F,nlambda=100,type = "mse")

> coef(cvfit, s = "lambda.min")

I now get that 4 has the highest effect and variable "14" is about 5 times smaller. I couldn't find a good description about the normalization process in glmnet. Any clue as to why this is happening (I don't think its a bug, I just would like to understand why and which one is right)?
PS: I ran this many times, so I know it is not an effect of the sampling during the cross-validation.
 A: the package will return transformed coefficients. line 1074 of fortran file in glmnet5.f90 is the transformation of gaussian type, as shown in below.
ca(l,k)=ys*ca(l,k)/xs(ia(l))                                          982

I believe this transformation may inflate the coef of variables with small standard deviation. If the sd(X) differes in training and testing dataset, I think this may cause bigger mse.
A: I tracked down the standardization process of glmnet and documented it on the thinklab Platform there. This includes a comparison of the different ways to use standardization with glmnet.
Long story short, if you let glmnet standardize the coefficients (by relying on the default standardize = TRUE), glmnet performs standardization behind the scenes and reports everything, including the plots, the "de-standardized" way, in the coefficients' natural metrics.
A: From the documentation here: https://web.stanford.edu/~hastie/Papers/Glmnet_Vignette.pdf (top of page 8)
It seems that y is also standardized, you could try and rerun your example with the standardized y and see if it matches the result. 
A: standardize = is a flag symbol, tells the status of X prior model fitting. But the result always returns in the form of original scale.
So if you want the glmnet to help you standardize your variables, you should set standardize = FALSE.
