GithubHelp home page GithubHelp logo

Comments (7)

ericward-noaa avatar ericward-noaa commented on September 1, 2024 1

Yes -- the last column is used as the baseline / reference. The choice here is arbitrary, and the back transformed proportions will be identical, no matter which column is set to 0

from zoid.

ericward-noaa avatar ericward-noaa commented on September 1, 2024 1

Ok great, closing this issue -- thanks!

from zoid.

ValentinJourne avatar ValentinJourne commented on September 1, 2024

Ok, so I do not know if it is the best, but from your function fit_zoid, I commented on those lines (because parse_re_formula will already generate the matrix, and extract random effect factor? L16)

#model_frame <- model.frame(formula, design_matrix)
#model_matrix <- model.matrix(formula, model_frame)
res <- parse_re_formula(formula, design_matrix)

from zoid.

ericward-noaa avatar ericward-noaa commented on September 1, 2024

Great questions and thanks for the help in catching issues. On the parameters:

The betas represent the mean estimates of the parameters in logit space, before being back-transformed. Maybe a clearer example would be to use a case of 3 observations (rows) and 4 groups:

y <- matrix(c(3.77, 6.63, 2.60, 0.9, 1.44, 0.66, 2.10, 3.57, 1.33, 3.4, 1.4, 5),
  nrow = 3, byrow = TRUE
)
fit <- fit_zoid(data_matrix = y)
p_hat <- get_pars(fit)

Now, p_hat$betas contains the estimated intercepts in logit space (the last is set to 0 for identifiability)

image

And then the back-transformed estimates of proportions are given by p_hat$p

image

Note that the intercepts are not varying across observations -- so they're the same for all groups. More complicated models with fixed / random effects could make them vary

from zoid.

ericward-noaa avatar ericward-noaa commented on September 1, 2024

For the question about the error and random effects, I'm not sure there's anything wrong here? I was able to run the example just fine (I realize there was the warning message, and just have pushed a commit to suppress that message)

set.seed(123)
y <- matrix(runif(99,1,4), ncol=3)
design <- data.frame("fac" = sample(letters[1:5], size=nrow(y), replace=TRUE))
design$fac <- as.factor(design$fac)
fit<-fit_zoid(formula=~(1|fac),design_matrix=design,data_matrix=y,chains=1,iter=100)

What's the results of sessionInfo()? Here's mine:
image

from zoid.

ValentinJourne avatar ValentinJourne commented on September 1, 2024

Thanks for the fast answer! :) but in your example, how is the variable defined at 0 (the group you use by default)? In your first screenshot we can see that m = 4, the coefficient is at 0. Does this mean that you are using the 4th column from Y as a reference? Or is it the first column? If I am asking, it's because by default in brms::, when you are fitting a dirichlet model, it will use the first column as "reference category"

from zoid.

ValentinJourne avatar ValentinJourne commented on September 1, 2024

OK, I found the issue,...!
I used in my code

options(na.action = "na.fail")

And because this function was loaded at the beginning of the code, I did not pay enough attention to it. Thanks a lot for your answers and your help!

from zoid.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.