[R] lines and glm
Jan P. Smit
jps at srres.com
Thu Apr 8 13:37:51 CEST 2004
Dear R-helpers,
I'm a beginner using R 1.8.1 on Windows 2000. I'm trying to replicate some
examples in Franses' & Paap's Quantitative Models in Marketing Research.
> t <- 1:1000
> e1 <- rnorm(1000)
> e2 <- rnorm(1000)
> x <- 0.0001*t+e1
> y2 <- -2+x+e2
> y <- ifelse(y2>0,1,0)
>
> plot(x, y, pch = 16, col = "darkblue",
+ main = expression(paste("Scatter diagram of ", italic(y[t]), "
against ",
+ italic(x[t]))),
+ xlab = expression(italic(x[t])),
+ ylab = expression(italic(y[t])))
> lines(glm(y ~ x, family = binomial))
Error in xy.coords(x, y) : x and y lengths differ
However,
> length(x)
[1] 1000
> length(y)
[1] 1000
as it should be.
I'm sure I must be missing something obvious, but it is not clear to me
(after reading the Introduction, FAQ and the relevant functions help pages)
what.
Sincerely,
Jan Smit
More information about the R-help
mailing list