[R] OLS error
Roger.Bivand at nhh.no
Fri Nov 12 09:46:15 CET 2004
On Thu, 11 Nov 2004, DrakeGis wrote:
> Thanks for the help.
> -I'm really sorry, but I'm affraid I can't publish any data in order to
> allow a reproduction of the results (enterprise policies :( ).
The author of the Design package has already replied to this point. If the
function only fails with your data, the data are the problem, not the
> -I'm using ols() from Design (Is there another ?)
The posting guide does say read the appropriate documentation. R is
distributed with lots of documentation, including "An Introduction to R",
see -> Statistical models in R -> Linear models. Reading the help page for
the ols() function from the Design package will show that it adds
functionality to the base lm() function, which your example is not using,
so you can certainly use lm() until you need more.
> -Does version of R influence on the behavior of the packages ? I didn't
> know, I'm using Version 2.0.0 (2004-10-04), ISBN 3-900051-07-0
Yes, but this isn't the case here. If you had read the posting guide, you
would understand that some questions are easier to answer when the version
is known, and the version is found by typing version at the R prompt,
surprisingly, and shows basic information about the OS too.
> > So in addition to telling us which version of R you are using, you could
> > say which package you are using, and provide a reproducible example.
> > If you look at help(La.chol2inv), you will see that the function takes
> > arguments: La.chol2inv(x, size = ncol(x)), where the x provided within the
> > ols() function with your data has only one row. Could you perhaps make a
> > data frame out of your variables, and use the data= argument? Are there
> > many missing values in your variables? Have you tried complete.cases() on
> > your input data?
> -I have no missing values. I previously try to use a data.frame but the
> was other error message, and because of that I split the data.frame,
> finally after you suggestions, I create a new data.frame and still didn't
> work until I attached a the new data.frame and it works.
Please copy the contents of the console to your messages. Any of this
could be caused by simple mistakes, attach() is not needed often (I never
use it), and especially not for lm() and friends, which have the data=
argument to be sure that the object in the formula is the one in the data=
object, not any other with the same name that might be lying around. Try
running in a fresh session too without loading your old workspace - one or
other of your RHS variables is not what you think it is.
There is very little doubt that you have problems with your data.
However, you have not bothered to show the error messages to the list. Try
to go through the same steps using lm() and making the data from runif()
and rnorm() - simulated data using set.seed() - and then run the examples
for lm(), etc, and if you can demonstrate that the functions still return
errors, the cause should be easier to establish.
> Stay ahead of the information curve.
> Receive GIS news and jobs on your desktop daily.
> Subscribe today to the GIS CafeNews newsletter.
> [ http://www10.giscafe.com/nl/newsletter_subscribe.php ]
> It's informative and essential.
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the R-help