lara harrup (IAH-P)
2008-Feb-22 11:33 UTC
[R] Creating subplots of a ridge trace generated using matplot (ridge regression)
Hi I am using ridge regression as a method to over come the multicollinearity in my dataset and in order to select the lambda (ridge estimator/regularization parameter) I am generating a ridge trace using the following commands (using R version 2.6.1):>library(MASS) >model_0.5km_ridge<- lm.ridge(OUTBREAK ~ .,PREDICTORS_0.5km,lambda = >seq(0,1,0.01)) ylim = c(-1.0, 1.0) >matplot(model_0.5km_ridge$lambda,t(model_0.5km_ridge$coef),type="l",yli >m=ylim,xlab=expression(lambda),ylab=expression(hat(beta))) >abline(h=0,lwd=2)where PREDICTORS_0.5km is a set of approximately 120 variables split into two groups by a binary dependent variable OUTBREAK which is 1 an outbreak was present at a location and 0 an outbreak was absent at a location, the plot (ridge trace) of the ridge regression model generated using lm.ridge produces a set of curves one per variable in PREDICTORS_0.5km with the coefficients for each variable (y axis) plotted against each value of lambda selected (from zero to one in 0.01 degree increments) (x axis). As i have a lot of variables what i would like to do is split the plotting of the curves over several subplots (with the same axis) e.g. 20 curves per plot and identify/label selected curves with the variable name, using perhaps something similar to the identify function for scatterplots or locator() function, but i have been at a loss to find how to do this in the literature any help or guidance on how to achieve this would be greatly appreciated. Regards Lara Harrup