File:Cvglmnetplot.png
Jump to navigation
Jump to search
Size of this preview: 800 × 320 pixels. Other resolution: 1,000 × 400 pixels.
Original file (1,000 × 400 pixels, file size: 34 KB, MIME type: image/png)
Summary
n <- 100 set.seed(1) x1 <- rnorm(n) e <- rnorm(n)*.01 y <- x1 + e x4 <- x1 fit <- cv.glmnet(x=cbind(x1, x4, matrix(rnorm(n*10), nr=n)), y=y) plot(fit) length(fit$lambda) # [1] 39 fit$nzero # s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 # 0 1 1 1 1 1 1 1 1 1 1 1 1 2 1 # s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 # 1 1 2 2 1 2 2 1 1 1 2 1 1 1 2 # s30 s31 s32 s33 s34 s35 s36 s37 s38 # 2 2 1 1 1 2 1 1 2 sapply(1:39, function(i) sum(coefficients(fit, lambda = fit$lambda[i])[,1] != 0)) [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [31] 2 2 2 2 2 2 2 2 2
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 16:39, 11 October 2022 | 1,000 × 400 (34 KB) | Brb (talk | contribs) | <pre> n <- 100 set.seed(1) x1 <- rnorm(n) e <- rnorm(n)*.01 y <- x1 + e x4 <- x fit <- cv.glmnet(x=cbind(x1, x4, matrix(rnorm(n*10), nr=n)), y=y) plot (fit) </pre> |
You cannot overwrite this file.
File usage
The following page uses this file: