library("topmodels")
## linear regression model
m <- lm(dist ~ speed, data = cars)
## extract response variable on data used for model fitting
newresponse(m)
dist
1 2
2 10
3 4
4 22
5 16
6 10
7 18
8 26
9 34
10 17
11 28
12 14
13 20
14 24
15 28
16 26
17 34
18 34
19 46
20 26
21 36
22 60
23 80
24 20
25 26
26 54
27 32
28 40
29 32
30 40
31 50
32 42
33 56
34 76
35 84
36 36
37 46
38 68
39 32
40 48
41 52
42 56
43 64
44 66
45 54
46 70
47 92
48 93
49 120
50 85
## extract response variable on "new" data
newresponse(m, newdata = cars[1:3, ])
dist
1 2
2 10
3 4