[R] lasso and ridge regression

2017-10-31 Thread Gafar Matanmi Oyeyemi
Dear All

The problem is about regularization methods in multiple regression when the
independent variables are collinear. A modified regularization method with
two tuning parameters l1 and l2 and their product l1*l2 (Lambda 1 and
Lambda 2) such that l1 takes care of ridge property and l2 takes care of
LASSO property is proposed

The proposed method is given


The problem is how to adapt "glmnet" to accomplish our task.

The extract of the code used is reproduced as follows;

cv.ridge<- glmnet(x, y, family="gaussian", alpha=0,
lambda=lambda1, standardize=TRUE)
cv.lasso<- glmnet(x, y, family="gaussian", alpha=1,
lambda=lambda2, standardize=TRUE)
##weight
a=1/abs(matrix(coef(cv.ridge, s=lambda1)[, 1][2:(ncol(x)+1)]
))^1
b=1/abs(matrix(coef(cv.lasso, s=lambda2)[, 1][2:(ncol(x)+1)]
))^1
c=a*b
w4 <-a+b+c
w4[w4[,1] == Inf] <- 9
# Fit modified procedure
fit<- glmnet(x, y, family="gaussian",
alpha=alpha,lambda=lambda1+lambda2, penalty.factor=w4)

The question is; Does the code address the modified procedure in as shown
in the equation? If not, suggestions are please welcome.

Thanks


-- 
OYEYEMI, Gafar Matanmi (Ph.D)
Reader
Department of Statistics
University of Ilorin.
Area of Specialization: Multivariate Analysis, Statistical Quality Control
& Total Quality Management.
Tel: +2348052278655, +2348068241885

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Obtaining and extracting cells sample in cross-tabulation

2016-06-17 Thread Gafar Matanmi Oyeyemi
Hello everyone,
I'm writing a function in R but was stalked.
I have a data set that contains mixture of categorical and continuous
variables. I want to use the categorical variables to cross-tabulate the
data and extract the observations in the resulting cells that contain only
continuous variables.

Data.
X1   X2   X3   X4   X5
2.4  5.3  4.80  1
4.2  3.2  4.81  1
3.3  4.4  5.10  0
5.2  1.1  2.51  0
.
.
.
3.7  2.8  3.80  1

Thanks.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] which function

2016-06-04 Thread Gafar Matanmi Oyeyemi
Dear,
I need help on which.min and  which.max. functions. Is there a function to
fetch me the point that in vector that gives median value such like the
commands for minimum and maximum values.
Thanks.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reading CSV file

2013-04-19 Thread Gafar Matanmi Oyeyemi
I am trying to read a csv file using the code;
contol - read.csv(RBS.csv)
This is the error message I got;
Error in file(file, r) : unable to open connection
In addition: Warning message:
In file(file, r) :
cannot open file 'RBS.csv', reason 'No such file or directory'


Where was the mistake?

-- 
OYEYEMI, Gafar Matanmi (Ph.D)
Senior Lecturer
Department of Statistics
University of Ilorin.
Area of Specialization: Multivariate Analysis, Statistical Quality Control
 Total Quality Management.
Tel: +2348052278655, +2348068241885

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.