Displaying 4 results from an estimated 4 matches for "yhat2".
Did you mean:
yhat
2012 Mar 21
2
glmnet: obtain predictions using predict and also by extracting coefficients
...v.glmnet(data.train,y)
# predictions by using predict function
yhat_enet <- predict(myglmnet,newx=data.test, s="lambda.min")
# attempting to get predictions by using coefficients
beta <- as.vector( t(coef(myglmnet,s="lambda.min")))
testX <- cbind(1,data.test.std)
yhat2 <- testX %*% beta
# does not match
plot(yhat2,yhat_enet)
2010 Jan 16
2
predict.glm
Hi,
See below I reply your message for <https://stat.ethz.ch/pipermail/r-help/2008-April/160966.html>[R] predict.glm & newdata posted on Fri Apr 4 21:02:24 CEST 2008
You say it ##works fine but it does not: if you look at the length of yhat2, you will find 100 and not 200 as expected. In fact predict(reg1, data=x2) gives the same results as predict(reg1).
So I am still looking for a solution of this problem.
best regards
Maurice
===========
Hi,
could it be the "newdata" argument? When I run predict with the newdata
a...
2004 Apr 13
0
In-sample / Out-of-sample using R
...akes d more readable
cat("Subset of insample points --\n"); print(d)
# Estimate a linear regression using all points
m1 = lm(y ~ x, D)
# Estimate a linear regression using only the subset
m2 = lm(y ~ x, D, subset=d)
# Get to predictions --
yhat1 = predict.lm(m1, D); yhat2 = predict.lm(m2, D)
# And standard deviations of errors --
full.s = sd(y - yhat1)
insample.s = sd(y[d] - yhat2[d])
outsample.s = sd(y[-d] - yhat2[-d])
cat("Sigmas of prediction errors --\n")
cat(" All points used in estimation, in sample : ", full.s, &q...
2008 Apr 04
2
predict.glm & newdata
Hi all -
I'm stumped by the following
mdl <- glm(resp ~ . , data = df, family=binomial, offset = ofst) WORKS
yhat <- predict(mdl) WORKS
yhat <- predict(mdl,newdata = df) FAILS
Error in drop(X[, piv, drop = FALSE] %*% beta[piv]) :
subscript out of bounds
I've tried without offset, quoting binomial. The offset variable ofst IS in df.
Previous postings indicate possible