Displaying 3 results from an estimated 3 matches for "outsampl".
Did you mean:
outsample
2007 Apr 13
0
How consistent is predict() syntax?
......
$ y.l8 : num NA NA NA NA NA NA NA NA -0.21 -2.28 ...
$ y.l9 : num NA NA NA NA NA NA NA NA NA -0.21 ...
$ y.l10: num NA NA NA NA NA NA NA NA NA NA ...
$ y.l11: num NA NA NA NA NA NA NA NA NA NA ...
$ y.l12: num NA NA NA NA NA NA NA NA NA NA ...
I have:
> insample <- 1:179
> outsample <- 180:191
To help you see what is going on:
> D[outsample,]
y y.l1 y.l2 y.l3 y.l4 y.l5 y.l6 y.l7 y.l8 y.l9 y.l10 y.l11 y.l12
180 NA 8.81 8.53 5.68 5.97 9.75 7.20 7.63 4.73 12.24 10.76 8.13 9.82
181 NA NA 8.81 8.53 5.68 5.97 9.75 7.20 7.63 4.73 12.24 10.76 8.13
182 NA NA NA...
2004 Apr 13
0
In-sample / Out-of-sample using R
...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, "\n")
cat(" 25 points used in estimation, in sample : ", insample.s, "\n")
cat(" 25 points u...
2005 Oct 08
1
Rpart -- using predict() when missing data is present?
I am doing
> library(rpart)
> m <- rpart("y ~ x", D[insample,])
> D[outsample,]
y x
8 0.78391922 0.579025591
9 0.06629211 NA
10 NA 0.001593063
> p <- predict(m, newdata=D[9,])
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :
invalid result from na.action
How do I persuade him to give me N...