0

This question has been asked but wasn't answered (Circular-linear regression from circular package in R not working).

I'm using the circular package in R to do circular-linear regression, and am getting the error "Error in while (diff > tol) { : missing value where TRUE/FALSE needed."

Specifically, I'm entering as inputs:

  • y (vector of data for the circular dependent variable; class(y) = "circular" "numeric")
  • x (matrix of data for the linear independent variables; class(x) = "matrix")
  • init (I'm using c(rep(0, numColsOfx; class(init) = "numeric")

Then, I run

lm.circular(y = y, x = x, init = start, type = "c-l", verbose = TRUE)

I've checked my data types against those in the following example (which runs fine): http://www.inside-r.org/packages/cran/circular/docs/lm.circular.

Any tips would be much appreciated!

EDIT: Here are some example data. I don't know if a good fit is possible here, I just want the algorithm to run in the first place.

x =

    13    49    75    17    58    93    92    94    32    82
    47    85    64     7    55    14    64    43    86     4
    20    81    95    20    40    67    11    50    77    67
    18    49    68    70    78    40    40    10    48    87
    87    96    49    88    24    23    21     2    44     9

startY =

    4.7298
    1.3788
    1.1519
    1.7802
    3.5779

y = circular(startY, type = c("angles"), units = c("radians"), template = "none", modulo = c("asis"), zero = 0, rotation = c("counter"))

init = c(rep(0, 10))
Community
  • 1
  • 1
nan
  • 11
  • 2
  • Please provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) if you really want help. Include sample data that re-creates the error you experience. – MrFlick Sep 21 '14 at 01:57
  • The problem with your example is that you don't have enough rows of information to estimate values for all the columns of `x`. you need to have more observations that parameters you are trying to estimate. If you change `x<-matrix(sample(1:100, 100, replace=T), ncol=5); startY<-rnorm(20,3,1); start = c(rep(0, 5))` it will run. – MrFlick Sep 21 '14 at 03:39
  • Also, the whole point of having a reproducible example is to make it easy to copy/paste into R and get the same thing as you. The way you choose to share your data makes that difficult. I encourage you to actually read the answers at [how to create a reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for tips on how to improve your question. Try not to make it more difficult for others to help you than necessary. – MrFlick Sep 21 '14 at 03:41
  • You're right -- it works with the transposed data. Do you happen to know if there's something that will work in the feature dimensions > observations case? – nan Sep 21 '14 at 14:04
  • I suggest you consult a statistician at this point. This is no longer a programming problem. Perhaps you can seek advice from [stats.se] – MrFlick Sep 21 '14 at 14:09

0 Answers0