[R] OLS error

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 11 21:03:48 CET 2004

On Thu, 11 Nov 2004, DrakeGis wrote:

> Hi,
>   I have 142 observations off different variables and I'm trying to do a
> OLS. And I get this error. Any Ideas ?

Well, the posting guide does suggest that precision in the question should
help. The function you are using called ols() seems to be from a local or
contributed package (perhaps Design), since the standard function is lm().  
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?

> > f <- ols(lnmigr3~popden78+income+modern+spareha+rain)
> Error in La.chol2inv(x, size) : size cannot exceed nrow(x) = 1
>   D.
> -----------------------------------------
> 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.
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Roger Bivand
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 mailing list