Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circular splines problems #38

Closed
jpossandon opened this issue Apr 8, 2018 · 2 comments
Closed

circular splines problems #38

jpossandon opened this issue Apr 8, 2018 · 2 comments

Comments

@jpossandon
Copy link
Collaborator

Hi,
there is some incongruences in uf_designmat concerning circular splines. At the moment it only works with formulas with lower and upper bounds, like 'circspl(angle,5,0,360)', and not with 'circspl(angle,5)'. This seems to be by design given the error message in uf_designmat, line 228, but with ''circspl(angle,5)' it never gets there because it does not run the for loop starting at line 226 ("check the circular splines"). This is because the parsing of 'circspl(angle,5)' with circsplRegexp gives an empty cell.
uf_designmat_spline seem to be able to deal with circular splines with no bound defined, taking them from the data.
This is not a problem if the cyclical spline is defined with bounds (btw, that is not how is described in the manuscript draft and it is also not described yet in the tutorials).
And I have two questions:
Could you explain a bit how the bound for circular spline work and how they should be defined?
Also, how should be the values to use for a circular spline predictor (eg,. angles, radians, unwrapped or wrapped, etc)
thks!

@behinger
Copy link
Member

behinger commented Apr 8, 2018

Hi! Yes, you have to specify the bounds. Else the function uses the maximum / minimum it finds in the data.
I will add an excemption if bounds are not specified. I think its a lot safer if you specify the bounds manually.

We will fix it in the manual + tutorials.

The bounds are simply the values which connect the circular spline. I.e. if your predictor runs from 0 °to 360° it should be [0,360].
If its from -pi to pi, [-pi,pi].

The reason for bounds is, that you might not have a "360" in your predictor, but a max of lets say 320°. Then 320° and 0° would predict the same value, even though that is not very logical.

I think I added automatic wrapping of predictorvalues - definitely something I need to check. Either implement that (its easy) or throw an exception if out-of-bound values are found.

@behinger
Copy link
Member

behinger commented May 2, 2018

There is already a warning in uf_designmat_spline that min/max is used if non-specified (with a direct call)
todo:

  • Fix description of uf_designmat
  • add assert that the bounds are given and give good error
  • check if wrapping works (should be in the spline function directly)

@behinger behinger closed this as completed Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants