Re: [R] How to find inverse of glm model?

2025-04-15 Thread Luigi Marongiu
Thank you. This topic is more complicated than anticipated. Best regards, Luigi On Tue, Apr 15, 2025 at 11:09 PM Andrew Robinson wrote: > > A statistical (off-topic!) point to consider: when the GLM was fitted, you > conditioned on x and let y be the random variable. Therefore the model > suppo

Re: [R] Drawing a sample based on certain condition

2025-04-15 Thread Bert Gunter
The Wikipedia entry for the "subset sum problem," which I noted in my prior comment in this thread, describes several (exponential time, of course) algorithms for solving it. I think these should be useful to those pursuing code for the problem discussed here. -- Bert "An educated person is one w

Re: [R] How to find inverse of glm model?

2025-04-15 Thread Andrew Robinson via R-help
A statistical (off-topic!) point to consider: when the GLM was fitted, you conditioned on x and let y be the random variable. Therefore the model supports predictions of y conditional on x. You’re now seeking to make predictions of x conditional on y. That’s not the same thing, even in OLS. It

Re: [R] Drawing a sample based on certain condition

2025-04-15 Thread Ebert,Timothy Aaron
It is not clear if the problem is a generic example or if the requester is only interested in the case where sample size is ten and the sum of the sample is 20. If the true population size is 100 (as in the example) then problem is trivial. However, there was described a "denied population, wher

Re: [R] ggplot trouble when I combine a layer with group and a layer with group=1

2025-04-15 Thread Laurent Rhelp
For interested people I got an answer on this link, thank you. https://stackoverflow.com/questions/79573847/ggplot-trouble-when-i-combine-a-layer-with-group-and-a-layer-with-group-1?noredirect=1#comment140334381_79573847 Le 12/04/2025 à 17:24, Laurent Rhelp a écrit : Dear RHelp-list,   I wan

Re: [R] How to find inverse of glm model?

2025-04-15 Thread Gregg Powell via R-help
Take a look at this Luigi... ># The model is: logit(p) = β₀ + β₁*Cycles ># Where p is the probability (or normalized value in your case) > ># The inverse function would be: Cycles = (logit⁻¹(p) - β₀)/β₁ ># Where logit⁻¹ is the inverse logit function (also called the expit >function) > ># Extract

Re: [R] How to find inverse of glm model?

2025-04-15 Thread Ben Bolker
If you mean the *link function*, which translates from the data scale to the linear predictor scale, you can get it via b_model$family$linkfun If you want the cycles at which the signal is equal to 0.5, eta <- b_model$family$linkfun(0.5) with(as.list(coef(b_model)), (eta-`(Intercept)`)/Cycle

[R] How to find inverse of glm model?

2025-04-15 Thread Luigi Marongiu
I have fitted a glm model to some data; how can I find the inverse function of this model? Since I don't know the y=f(x) implemented by glm (this works under the hood), I can't define a f⁻¹(y). Is there an R function that can find the inverse of a glm model? Thank you. The working example is: ```

Re: [R] Drawing a sample based on certain condition

2025-04-15 Thread Rui Barradas
Às 14:04 de 14/04/2025, Rui Barradas escreveu: Às 12:26 de 14/04/2025, Brian Smith escreveu: Hi, For my analytical work, I need to draw a sample of certain sample size from a denied population, where population members are marked by non-negative integers, such that sum of sample members if fixe

Re: [R] Drawing a sample based on certain condition

2025-04-15 Thread Jeff Newmiller via R-help
Tim, do you know what you are talking about? If so, please do share sample code so we can follow along. If you pick nine uniformly distributed variables (the tenth is constrained) and reject sets that do not add to the desired sum then only (1/10)^9 or so of the draws will not be rejected. This