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

implement time-splines #12

Open
behinger opened this issue Apr 4, 2020 · 2 comments
Open

implement time-splines #12

behinger opened this issue Apr 4, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@behinger
Copy link
Member

behinger commented Apr 4, 2020

  • fourier
  • spline
  • logspaced splines
  • tent (because it seems easy to do :-D)
@behinger
Copy link
Member Author

behinger commented Jun 21, 2021

I implemented spline as a starter. => See Pluto notebooks /docs/nb_timesplines.jl and ./docs/nb_timesplines_dev.jl

What I didnt really think about, is that we commonly want to move the temporal predictors from predictor space (e.g. 10 splines) back into timespace (e.g. 100 samples). I will leave this for a major overhaul of unfold :-)

@behinger behinger added the enhancement New feature or request label Feb 19, 2022
@behinger
Copy link
Member Author

begin
	gd = groupby(res,[:basisname,:channel,:group,:coefname])
	a = combine(gd) do d
		return undoBasis(d,m)
	end
	a
end
function undoBasis(d,m)
	bname = unique(d.basisname) # the current coefficient basename
	@assert(length(bname)==1)
	@assert(length(unique(d.channel))==1)
	bnames = unique(Unfold.get_basis_name(m)) # all model basenames
	
	# find out which formula / basisfunction we have
	k = findfirst(bname .== bnames) 
	bf = designmatrix(m).formulas[k].rhs.basisfunction
		
	
	estimate= bf.kernel.(0) *d.estimate
	@show size(bf.kernel.(0))
	@show size(Unfold.times(bf))
	return DataFrame(:time=>Unfold.times(bf),:estimate=>estimate)

end

This will do the trick. Now we just have to

  • integreate a coeftable(m,applyBasis=true)
  • unittests for multiple channels, bases, coefnames
  • document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant