Description Usage Arguments Value Author(s) References Examples
This function returns predictions from a fitted "Ohit"
object.
1 | predict_Ohit(object, newX)
|
object |
Fitted "Ohit" model object. |
newX |
Matrix of new values for |
pred_HDIC |
The predicted value based on the model determined by OGA+HDIC. |
pred_Trim |
The predicted value based on the model determined by OGA+HDIC+Trim. |
Hai-Tang Chiou, Ching-Kang Ing and Tze Leung Lai.
Ing, C.-K. and Lai, T. L. (2011). A stepwise regression method and consistent model selection for high-dimensional sparse linear models. Statistica Sinica, 21, 1473–1513.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Example setup (Example 3 in Section 5 of Ing and Lai (2011))
n = 410
p = 4000
q = 10
beta_1q = c(3, 3.75, 4.5, 5.25, 6, 6.75, 7.5, 8.25, 9, 9.75)
b = sqrt(3/(4 * q))
x_relevant = matrix(rnorm(n * q), n, q)
d = matrix(rnorm(n * (p - q), 0, 0.5), n, p - q)
x_relevant_sum = apply(x_relevant, 1, sum)
x_irrelevant = apply(d, 2, function(a) a + b * x_relevant_sum)
X = cbind(x_relevant, x_irrelevant)
epsilon = rnorm(n)
y = as.vector((x_relevant %*% beta_1q) + epsilon)
# with intercept
fit1 = Ohit(X[1:400, ], y[1:400])
predict_Ohit(fit1, rbind(X[401:401, ]))
predict_Ohit(fit1, X[401:410, ])
# without intercept
fit2 = Ohit(X[1:400, ], y[1:400], intercept = FALSE)
predict_Ohit(fit2, rbind(X[401:401, ]))
predict_Ohit(fit2, X[401:410, ])
|
$pred_HDIC
[1] 16.18587
$pred_Trim
[1] 16.16235
$pred_HDIC
[1] 16.1858664 -3.2580596 -21.3708495 -17.3621501 -9.2934443 -1.6120540
[7] 18.5471672 -11.6529395 -33.3141578 0.6153522
$pred_Trim
[1] 16.1623475 -3.2242840 -21.4416871 -17.4033878 -9.2498644 -1.6231749
[7] 18.5459885 -11.5762733 -33.2060854 0.5952212
$pred_HDIC
[1] 16.18521
$pred_Trim
[1] 16.16174
$pred_HDIC
[1] 16.1852111 -3.2588039 -21.3717391 -17.3630388 -9.2941446 -1.6126408
[7] 18.5461139 -11.6535413 -33.3148442 0.6146596
$pred_Trim
[1] 16.1617442 -3.2249725 -21.4424906 -17.4041887 -9.2504693 -1.6236990
[7] 18.5450519 -11.5768345 -33.2066904 0.5945924
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.