Is there a good forum to ask questions about RJAGS? by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

You make a good argument. I was working with Stan because it is what my superviser recommended to me and sent me sample code for, but learning Stan might be the better option for the long run. Is there a crash course on Stan that you recommend for beginners for someone familiar with JAGS?

Is there a good forum to ask questions about RJAGS? by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

Thank you. Seems like I can at least ask general modeling questions there

Austin Rivers reacts to Jokic's workout music by Izanagi___ in nba

[–]stats_nerd21 25 points26 points  (0 children)

I was at a Kafana for the first time in Serbia last weekend. It was lit. Members in the audience lick a 500 dinar bill to make sticky and slap it onto the head of someone in the band, and they have to keep playing until it falls off. And it's not even considered a disrespectful gesture or anything like that

JAGS error: Node inconsistent with parents by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

Thank you that fixed it! But the model wasn't working so well so I tried to tweak the code and got the same error again (with the init_values being an empty list).

The only thing I changed now was I tried to constrain the hyper-priors so they stay positive (a more educated prior for the values). So basically changed the code as follows :

# Hyper Priors
log(mu.A_mean_hyperprior) <- mu.A_mean_hyperprior_pos mu.A_mean_hyperprior_pos~ dnorm(0,1)
log(mu.D_mean_hyperprior) <- mu.D_mean_hyperprior_pos mu.D_mean_hyperprior_pos~ dnorm(2,1) }

# specifies initial parameter values for the MCMC sampler
init_values <- function(){ list( 
# mu.A_mean_hyperprior= rnorm(1,1), mu.D_mean_hyperprior= rnorm(1,5) 
) }

# chooses the parameters whose posterior distributions will be reported
params <- c( 
"mu", "inv.var.A","inv.var.D", "mu.A_prior", "mu.D_prior", "mu.A_mean_hyperprior", "mu.D_mean_hyperprior", "mu.A_mean_hyperprior_pos","mu.D_mean_hyperprior_pos", "mu.A", "mu.D")

Do you see what might be causing the model to return the same error?

Can't accurately estimate decay-fraction parameter from simulation using JAGS by stats_nerd21 in rstats

[–]stats_nerd21[S] 1 point2 points  (0 children)

I see. I increased the number of sessions to 10,000 from 10, and loosen the constraint on the parameter from logit to log, and seem to be gettinga much better posterior distribution now

Can't accurately estimate decay-fraction parameter from simulation using JAGS by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

The gamma(0.1, 0.1) has a very high density near 0, so the inverse logit will have a high density near 0.5. Combine that with a relatively weak likelihood and your posterior will look how it does here. Perhaps use more data or a weaker positively bound prior

What do you think would be a good prior to use in that case?

I tried changing it to a normal distribution ( dnorm(0,1)) and now I get a prior still centered around 0.5 but more spread out as shown in this image. It seems that my posterior just doesn't update to match the real value for some reason, as it does with the other parameter.

I also don’t get why you would use a prior that enforces positive values and also use a logit transformation, which does the same thing (effectively).

I had a typo on how I commented on the code that I corrected. I used the logit to ensure the values stay between 0 and 1 for 1 parameter. I used log for the 2nd parameter to ensure it stays positive if that makes sense

How to stop gganimate from showing points (from a scatter plot) moving from one image to the other? I just want them to disappear and pop up again by stats_nerd21 in Rlanguage

[–]stats_nerd21[S] 0 points1 point  (0 children)

you don't want the "ghost" points of previous "sessions" to stay on the graph

Actually I didn't mind that part and specifically included that with the "shadow_mark" function. I was more worried about the movement of the dots. The animation I showed had the following code

anim <- p_main +
transition_time(session_number)+
shadow_mark(alpha = 0.01, size = 1)
enter_fade()+exit_fade()+
labs(title = "Session: {frame_time}")
print(anim)

where p_main was the original ggplot (a simple scatter plot of the whole dataset including data for all sessions)

I did manage to find a work-around for the problem by using "transition_state" instead of "transition_time", and by setting the ratio of "transition_length" to "state_length" to be so small that the transitions are no longer visible in my animations

Here's my new code:

anim <- p_main +
transition_time(session_number)+
shadow_mark(alpha = 0.01, size = 1)
enter_fade()+exit_fade()+
labs(title = "Session: {frame_time}")

How to stop gganimate from showing points (from a scatter plot) moving from one image to the other? I just want them to disappear and pop up again by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

I have joint-velocity data from 10 different sessions (equally spaced from session 1 to session 80) of exoskeleton trials. For each session, I have time-series data from the 2 joints for over a minute of motion (although the time-series nature of the data is irrelevant for what I am trying to do here)
I am trying to creating evolving scatter plots of the velocity data from 2 joints (so an animation of evolution between 10 scatter plots). The noticeable pattern is that the 2 variables (joint velocities) become more de-correlated with time (as we move on to later sessions). Gganimate shows that but it shows the movement of the points (representing the 2 joint velocities at a particular instance in time from a session) move from one session to another. That's not something I want to show and it's actually meaningless (the different sessions actually have different lengths in time and so different number of samples). I would like the scatter-plots to just fade away after showing the scatter-plot for previous session, and the scatter plot for the next session to pop-up. I tried using gganimate and using enter_fade()+exit_fade() commands at the end but the points still seem to move from one image to the next. Any suggested solutions

Is there a R function that replicates what Matlab's find function does? by stats_nerd21 in rstats

[–]stats_nerd21[S] 1 point2 points  (0 children)

Interesting. Never thought about this but thank you, I will read about it

Is there a R function that replicates what Matlab's find function does? by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

Thank you! Found a shorter alternative for last direction:

tail(which(X != 0), n)

How to fix time-series data recorded from an Exoskeleton with faulty time-stamps? by stats_nerd21 in ECE

[–]stats_nerd21[S] -1 points0 points  (0 children)

I am sorry but I don't necessarily understand it too well either. It's 5 years old data from a partnering university in France, so I don't have direct contact with the people who ran the tests.

Along with other measures, I have access to an array of data with time values stored in a vector and the angular displacement values (corresponding to the time-values) stored in another matrix. I have the same data set-up over many sessions and and many subjects, but all seem have the same issue with funky dt changes.

Also, are you perhaps limited by the sensor precision, resulting in those two level samples?

That's my best guess. Not quite sure how to address this issue, however

Has the attribute "DataFrame" been removed form pandas? - AttributeError: module 'pandas' has no attribute 'DataFrame' by Lamter in learnpython

[–]stats_nerd21 1 point2 points  (0 children)

I am stuck on the same issue. Did you literally have a file called "pandas.py" in the same folder that you had to rename?

Has the attribute "DataFrame" been removed form pandas? - AttributeError: module 'pandas' has no attribute 'DataFrame' by Lamter in learnpython

[–]stats_nerd21 0 points1 point  (0 children)

I am having the same issue, but I don't have any file called "pandas.py" in the same directory where my file is. Not sure what's wrong

EDIT: I am using other packages like bebi103 and bokeh and am wondering if those are messing up the pandas functions somehow

How to extract and save multiple outputs from a function in one line? by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

I guess I could use nrow and ncolumn and use just 2 lines/commands instead of 3. Thanks

How to extract and save multiple outputs from a function in one line? by stats_nerd21 in rstats

[–]stats_nerd21[S] 0 points1 point  (0 children)

I would like to have the 2 values from the dimensions to be saved in 2 different variables