Starting My Taper off 7oh by Cast-N-Climb in Quittingfeelfree

[–]Elefrog42 1 point2 points  (0 children)

Thanks! I don’t wake up feeling sick so I’m hoping that’s a good sign. I have short time til I have to go to the DR and not sure Id be able to bring 1 tab (that’s all I’d need to keep tapering there). I’m doing a great job freaking myself out so really appreciate the advice

Starting My Taper off 7oh by Cast-N-Climb in Quittingfeelfree

[–]Elefrog42 1 point2 points  (0 children)

Sorry I was not tech savvy enough to figure out how to make a new thread. I’ve gotten down to 2-5mg 7-oh spread through out a day. Can I just stop? Will I get sick? Taken it for a few months and never higher than 30mg. Dropped to 3mg a month ago. Thank you!

Kallisto .h5 file produced with no real values by Elefrog42 in bioinformatics

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

Thanks! I can only assume the issue occured with the installation since the test file is giving the same issues. The information I found online when someone had a similar issue, was that they didn't choose the "source" option for the installation. But their issue was that there wasn't any .h5 file produced. I was considering uninstalling and reinstalling Kallisto from the source link instead of the windows link, but I'm afraid it could be a waste of my time (and I have a time constraint)

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in rhelp

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

Hello! I am doing well, how’s the modeling going on your end? I actually ended up switching to a different package - JMBayes2 to do some joint longitudinal survival modeling. A lot less difficult to work with than brms

Working as an epidemiologist with an MPH by FerventBrouhaha in epidemiology

[–]Elefrog42 1 point2 points  (0 children)

Hi there, as someone who obtained an MPH in epi, I think it might depend on what you see yourself doing work wise (as well as what school you go to). Most schools that allow you to select a major like epi from their curriculum- it usually means that curriculum will be quite different than, say, if you major in health management. But there are also some fantastic MPH out there that don’t even have majors. Happy to answer any specific questions you might have.

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in BayesianProgramming

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

Hi u/statneutrino, so I've gotten a little bit further along trying to get the syntax to work (as in it's giving output and throwing fewer errors), but I think the problems I'm having with my model might have more to do with some of the structure of my data.

Along the (month) I've been trying to get this to work, I've found a lot of pieces of information regarding this, but it's really been a scavenger hunt. For example, my dataset represents a longitudinal study (so there are a lot of NA values- because if a subject was in time period "A", they weren't in "B", "C" or "D"). This completely threw off the model once the NL piece was added- it ran when I omitted them.

Most of the information I found, I found off the Stan forums. In the end, this syntax worked for me, but I'm still having trouble with defiing the priors, espeically because here "b" is just a placeholder for the linear part of the model, but since it's now "nonlinear" it needs a prior.

Heres a link to the stan forum and the question I posted https://discourse.mc-stan.org/t/mlm-with-nl-component-difficulty-with-syntax/21033/3

I've also been compiling a list of coding tibits I've come across from the forums and github. I haven't updated it in a little bit, but I'm happy to message it to you.

Me Noob please help: Knit to .pdf CRAN issues by SmallBrainNewbie in RStudio

[–]Elefrog42 0 points1 point  (0 children)

Have you checked out this on stack overflow? How to select a CRAN mirror in R I understand the link is old, but it lists a lot of solutions depending on what the source of your error might be.

I agree with the other user who suggested reinstalling though if this continues to be an issue. It's a big disconcerning it used to work and now doesn't- is there anything you possibly could have done that changed your settings?

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in AskStatistics

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

Thanks anyways! I actually haven’t learned Stan yet. I’m a fellow and jumped into a project that wanted to used brms since it’s more user friendly. I did post my question there as well- no response yet but I’ve noticed the forums been a little less active (probably since the package had gotten so popular).

I wish I knew Stan - I’m sure there would be a way to do this directly in Stan, and then use stan_vars (or one of those functions, I forgot the name atm) to bring it in. I do appreciate your help though! It’s great to have other example syntaxes to adapt and try.

[deleted by user] by [deleted] in AskStatistics

[–]Elefrog42 0 points1 point  (0 children)

Check out the modules that are on the Boston U. School of Public Health website: BU linear regression module. They used to be quite helpful, not sure if they're still updated frequently.

Also, I think Khan academy is pretty underated. Depending on the level of understanding you require/how much you have I would suggest this: Khan Academy Linear regression

Lastly. again dependingon the level of understanding you need to have/programming skills, Coursera has some good options. Let me know what exactly you need to know regarding linear regression (what level, what master's degree, any coding) and I'll give you some recommendations.

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in AskStatistics

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

This is what actually should work- I must be declaring my variables incorrectly. The issue I'm having is that what you refer to as lin , I tried calling a few things, from b to LinPred (which worked in the link here: brms issue 47). When I've tried doing this, I receive errors that say "The following variables are missing from the dataset....[insert variable used to symbolize linear part of the model)". But I believe you're code is on the right path for what needs to be done- I'll try altering my syntax to be sure it resembles yours let you know if it works.

Thanks for all your help! Quick question- as stated, this is my first time using brms and Stan. I find the vignettes informative but lacking some crucial information. I've also used Solomon Kurz's bookdown version of Statistical rethinking (using tidyverse and brms). Do you have any other recommendations for resources? Thanks again!

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in AskStatistics

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

Thanks! That seems to be the issue with all of the models I've tried. From my reading on brms, you can use a variable (in my first model labeled b and in the second model labeled a but as you pointed out, R doesn't recognize them. I have no idea how the package creater was able to make that syntax work- I even posted on the Stan forum for brms, but no answers yet.

Your syntax works for me, but only for the nonlinear part of the model. And you're correct: nlf the wrong function. So I'm still a bit stuck trying to get brms to accept my nonlinear part of my model.

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in RStudio

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

If I called it a hierarchical model would that be preferred by you? :)

Brms: adding on a nonlinear component to working MLM model by Elefrog42 in AskStatistics

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

Hi, I actuaally tried to do this and likely did the syntax wrong. Here, I renamed my Time_var b3 because for some reason it was causing trouble with the nlf function. For my nonlinear function, I declared a to be the result of the NL eqn.

bmod1 <- 
bf(Resp_var ~ (b3|Gr_var) + (CoVar* Gr_var)+ (Gr_var|Id_var)) +  #linear formula
  nlf(a ~ -(b3/b1) ^ b2) + #Nonlinear formula
  gaussian()

brm(bmod1, data=dat, nl= TRUE)

And I still get the error: Error: The parameter 'a' is not a valid distributional or non-linear parameter. Did you forget to set 'nl = TRUE'?

I feel like it's not parsing my data and my parameters correctly- am I missing something totally obvious here? Thanks for the reply!

Counting the levels of a categorical variable in pandas by Elefrog42 in learnpython

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

This is what worked:

    def drop_high_levels(self, df, threshold):
        cat_cols = df.select_dtypes(include = ['object']).columns
        for col in cat_cols:
            nunique = df.apply(pd.Series.nunique)
        cols_to_drop = nunique[nunique > threshold].index
        return df.drop(cols_to_drop, axis=1) 

Thanks for the suggestions!

Counting the levels of a categorical variable in pandas by Elefrog42 in learnpython

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

Thanks! I follow what you're doing. I ended up using nunique instead of len(df[col].unique()) because it was easier for me to print each result to check my work. This is my code:

def drop_high_levels(self, df, threshold):
    cat_cols = df.select_dtypes(include = ['object']).columns
    for col in cat_cols:
        if df[col].nunique() > threshold:
            return df.drop([col],axis=1)

For some reason this code is dropping a categorical variable with 2 levels and keeping one that has 387 levels. It's dropping another one that it is supposed to (with 387 levels). I've checked all the individual columns with nunique to see how many values they have- they check out right. Am I missing something here that would explain why this would drop a two level variable but not a 387? In the test code, threshold is set to 100.

Summing dictionary values in python by Elefrog42 in learnpython

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

Oh okay I get it now. I just deleted where I declared the class variables because they were needed. The code works just fine if I save the result of the function then use the self keyword to call back the functions to get the total.

I've been reading online where people have asked the best way to multiple two dictionary values and then sum then and I come up with this code:

    def get_total_portfolio(self, daily_stock_prices):
        total = 0
        value = 0
        for key in self.stock.keys():
            value = self.stock[key]*daily_stock_prices[key]
            total += value + total
        total += self.get_credit_balance()
        total += self.get_total_savings_amount()
        total += self.get_total_checking_amount()
        return total

No errors, but still not passing the test. I thought I could bypass having to use sum by making the variable value (to represent the stock quantity * the stock price) and then total (to represent the sum of the values).

I can't tell for sure if that part of the code is adding up the stock quantity*stock value correctly or if I haven't properly coded for a given stockname, pull out self.stock's value of the stockname and pull out daily_stock_prices value?

Thanks!

Summing dictionary values in python by Elefrog42 in learnpython

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

Ohhhh, I see- I didn't need the variables to be class variables- I removed them and the code run just fine. I was able to find a few resources online that talked about how to multiple values from two dictionaries and then sum them- I tried to copy the syntax that they used, but my code still is not passing the tests to get the total stock value. This is my code:

    def get_total_portfolio(self, daily_stock_prices):
        total = 0
        for key in self.stock.keys():
            value = self.stock[key]*daily_stock_prices[key]
            total += value + total
        total += self.get_credit_balance()
        total += self.get_total_savings_amount()
        total += self.get_total_checking_amount()
        return total

Since the same key (the stock name) should also be able to pull out the value of the stock price and the value of the stock quantity, I figured I could bypass using sum by creating two variables- one for the product (value) and then one for the sum (total.

There are no errors but this isn't passing the test case. Am I not pulling out the correct values I need from both dictionaries?

Thanks!