From tianxu03 at gmail.com  Thu Aug  3 15:49:57 2017
From: tianxu03 at gmail.com (Victor Tian)
Date: Thu, 3 Aug 2017 09:49:57 -0400
Subject: [Rd] rnorm is not truly random used in the lm function
Message-ID: <CAHJErNB+dUqcPcG9XF3eL34mUrSOZ0pT6hTY3dFFmuZeUuAx5w@mail.gmail.com>

To whom it may concern,

I happened to run the following R code just to check the layout of the
output, but found that the code doesn't work the way I thought it should
work.

''
> lm(rnorm(100) ~ rnorm(100))

Call:
lm(formula = rnorm(100) ~ rnorm(100))

Coefficients:
(Intercept)
   -0.07966

Warning messages:
1: In model.matrix.default(mt, mf, contrasts) :
  the response appeared on the right-hand side and was dropped
2: In model.matrix.default(mt, mf, contrasts) :
  problem with term 1 in model.matrix: no columns are assigned
"

It appears that rnorm(100) produces the same array of numbers on both sides
of the ~ sign.

It can be further verified by having the same error message if we do x <-
rnorm(100) and lm(x ~ x).

I would expect the two rnorm(100) functions in the lm function return two
different arrays of numbers, but am open to hear reasons from the other
side.

Thanks,

-- 
*Xu Tian*

	[[alternative HTML version deleted]]



[Rd] rnorm is not truly random used in the lm function
Victor Tian