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

Maybe an issue: should convolve use x[Near(t-ll), :]? #48

Open
b-r-hamilton opened this issue Aug 30, 2023 · 3 comments
Open

Maybe an issue: should convolve use x[Near(t-ll), :]? #48

b-r-hamilton opened this issue Aug 30, 2023 · 3 comments

Comments

@b-r-hamilton
Copy link
Collaborator

I'm trying to figure out why my solutions have significantly larger values at the first time step than other time steps. I'm not sure if this is an issue, or if it would solve my problem, but I'm wondering if it's appropriate to use Near while time indexing in convolve

return sum([E[ii,:] x[Near(t-ll),:] for (ii,ll) in enumerate(lags)])

For times t-ll < t[1], this will just access t[1]. So in my case, where the first year we have data for is 1470yr, the model matrix will assume that, when trying to account for the lag at 1470yr, that every preceding year has the same data as 1470yr (at least this is my understanding of what's happening here). Would it make more sense for this to only access times that exist?

@b-r-hamilton
Copy link
Collaborator Author

suggested fix - add a conditional that only computes the above line if t-ll <= x.dims[1][1]
I tried this out in a commit that's in the attached branch

@b-r-hamilton
Copy link
Collaborator Author

Okay, new update. The conditional should actually be t - ll >= t1 - 2*unit.(t1). The 2 is because, for our lagged M matrix, at t = 1yr, the values are 0, and we want to actually have values for the first row of our E matrix.

@b-r-hamilton
Copy link
Collaborator Author

Okay, I think this is my final opinion on this. Except I'm now wondering if this is moot because we shouldn't be subsampling M.
But, for what it's worth it, I think the right conditional is

    xtime = x.dims[1]
    return sum([E[At(ll),:] ⋅ x[At(t-ll),:] for (ii,ll) in enumerate(lags) if t-ll in xtime])

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

When branches are created from issues, their pull requests are automatically linked.

1 participant