Redefining n is probably not a good idea... [...snip...] > m <-runif(n, 0, 5) > n <-rnorm(n, 2, 3)
Oops! n is now a vector of length 2000. [...snip...] > y_obs <- y_model +c( rnorm(n*0.97, 0, 0.1), rnorm(n*0.03, 0, 0.5) ) now length(n*0.97) == 2000 > 1, so rnorm(n*0.97, ...) gets you a length 2000 vector (check ?rnorm), and c() of 2 of those is a vector of length 4000. [...etc...] > -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.