Dear all,
Suppose the following code:
--8--
mm - function(datf) {
lm(y ~ x, data = datf)
}
mydatf - data.frame(x = rep(1:2, 10), y = rnorm(20, rep(1:2, 10)))
l - mm(mydatf)
--8--
If I want to update l now without providing the data argument an
It looks to me as though your proposal would allow update to remove
variables, but would give erroneous results when adding them. For example:
mm - function(datf) {
lm(y ~ x, data = datf)
}
mydatf - data.frame(x = rep(1:2, 10), y = rnorm(20, rep(1:2, 10)), z =
rnorm(20))
l - mm(mydatf)
On 02/08/2011 9:41 AM, Duncan Murdoch wrote:
It looks to me as though your proposal would allow update to remove
variables, but would give erroneous results when adding them. For example:
mm- function(datf) {
lm(y ~ x, data = datf)
}
mydatf- data.frame(x = rep(1:2, 10), y = rnorm(20,
mm - function(datf) {
lm(y ~ x, data = datf)
}
mydatf - data.frame(x = rep(1:2, 10), y = rnorm(20, rep(1:2, 10)), z
=
rnorm(20))
l - mm(mydatf)
update(l, . ~ . + z) # This fails, z is not found
Good point. So let me rephrase the initial problem:
1.) An lm object is fitted somewhere
On 02/08/2011 10:48 AM, Thaler,Thorn,LAUSANNE,Applied Mathematics wrote:
mm- function(datf) {
lm(y ~ x, data = datf)
}
mydatf- data.frame(x = rep(1:2, 10), y = rnorm(20, rep(1:2, 10)), z
=
rnorm(20))
l- mm(mydatf)
update(l, . ~ . + z) # This fails, z is not found
Good point.