Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Update Finite Markov #36

Merged
merged 2 commits into from
Aug 28, 2018
Merged

Update Finite Markov #36

merged 2 commits into from
Aug 28, 2018

Conversation

Nosferican
Copy link
Collaborator

No description provided.

@Nosferican Nosferican added this to the Update to 0.7/1.0 syntax milestone Aug 28, 2018
@Nosferican Nosferican self-assigned this Aug 28, 2018
@Nosferican Nosferican requested a review from arnavs August 28, 2018 08:38
@arnavs arnavs mentioned this pull request Aug 28, 2018
53 tasks
Copy link
Member

@arnavs arnavs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the error below, no issues.


# == Compute fraction of time spent unemployed, for each n == #
X_bar = cumsum(X.==1) ./ 1:N
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is erroring on 1.0 and 0.7. I think the issue is that you can't divide elementwise by a range. But this seems to work:

julia> X_bar = cumsum(X.==1) ./ collect(1:N)
10000-element Array{Float64,1}:
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 1.0                
 0.9285714285714286 
 0.8666666666666667 
 0.8125             
 0.7647058823529411 
 ⋮                  
 0.49759615384615385
 0.49754631947921885
 0.4974964950931304 
 0.49744668068489034
 0.4973968762515018 
 0.49734708178996895
 0.4972972972972973 
 0.49724752277049344
 0.49719775820656525
 0.49714800360252176
 0.49709825895537324
 0.4970485242621311 
 0.4969987995198079 
 0.4969490847254176 
 0.4968993798759752 
 0.49684968496849685
 0.4968             

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That collect should stay. Thanks for catching that.

@arnavs arnavs merged commit 90469c7 into master Aug 28, 2018
@@ -1384,7 +1384,7 @@ compare it to the stationary probability.
X = simulate_indices(mc, N; init = x0)

# == Compute fraction of time spent unemployed, for each n == #
X_bar = cumsum(X.==1) ./ 1:N
X_bar = cumsum(X.==1) ./ collect(1:N)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a precedence thing rather than broadcasting with ranges. Try X_bar = cumsum(X.==1) ./ (1:N) to see if adding brackets helps.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm this is the preferred solution. You can make a small edit to change collect to a ().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stick with the brackets

Copy link
Member

@arnavs arnavs Aug 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will change this to (1:N).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@arnavs arnavs deleted the Update-Finite_Markov branch August 29, 2018 20:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants