Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
With respect to bayesian curve fitting, eq 1.68 of Bishop - Pattern recognition
How is the following result derived :
p(t|x, x, t) = Integration{ p(t|x, w)p(w|x, t) } dw
Lets just consider a simpler case using the Law of total probability.
If w1, w2 are disjoint events then
p(A) = p(A|w1) p(w1) + p(A|w2) p(w2)
we can extend this to any number of items
p(A) = sum_{wi} p(A|wi) p(wi)
or indeed take the limit
p(A) = int_{w} p(A|w) p(w) dw
We can make A depend on another independent event B that the w's might depend on
p(A|B) = int_{w} p(A|w) p(w|B) dw
or an event C which the w's do not depend on
p(A|B,C) = = int_{w} p(A|w,C) p(w|B) dw
which is just your formula with different variables.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 days ago.
Improve this question
I want to know if there is a significant difference in a blood biomarker concentration between 2 populations (population 1 = healthy individuals - population 2 = sick individuals). I need to control for the factor 'region'.
My issue is that the distribution of population 2 is not normal (data are censored following the upper detection limit by the lab device) as shown on these plots:
With a normal distribution I would use this model in R:
m <- glm(blood.biomarker ~ status + region + status*region, data=f, family="gausian") # status = healthy or sick
summary(m)
emmeans(m, list(pairwise ~ status), adjust = "tukey")
I am a bit confused regarding the model or the glm family I should use in this case.
I also have a similar situation but with 3 groups (1 group has a normal distribution and 2 groups have a censored distribution). How to deal with this?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
How do I get the coefficient of a regression in R? In the equation of the Regression line, where y = a + bx, the Angular coefficient would be the "b". I would also like to know how to calculate the intercept - the "a" of the equation
I only speak enough spanish to understand a little bit, try:
Model <- lm(y ~ 1 + x)
summary(Model)$coefficients
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have distribution of parameter (natural gas mixture composition) expressed in percents. How to test such data for distribution parameters (it should be gamma, normal or lognormal distribution) and generate random composition based on that parameters in R?
This might be a better question for CrossValidated, but:
it is not generally a good idea to choose from among a range of possible distributions according to goodness of fit. Instead, you should choose according to the qualitative characteristics of your data, something like this:
Frustratingly, this chart doesn't actually have the best choice for your data (composition, continuous, bounded between 0 and 1 [or 0 and 100]), which is a Beta distribution (although there are technical issues if you have values of exactly 0 or 100 in your sample).
In R:
## some arbitrary data
z <- c(2,8,40,45,56,58,70,89)
## fit (beta values must be in (0,1), not (0,100), so divide by 100)
(m <- MASS::fitdistr(z/100,"beta",start=list(shape1=1,shape2=1)))
## sample 1000 new values
z_new <- 100*rbeta(n=1000,shape1=m$estimate["shape1"],
shape2=m$estimate["shape2"])
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Let's say I want to predict a dependent variable D, where:
D<-rnorm(100)
I cannot observe D, but I know the values of three predictor variables:
I1<-D+rnorm(100,0,10)
I2<-D+rnorm(100,0,30)
I3<-D+rnorm(100,0,50)
I want to predict D by using the following regression equation:
I1 * w1 + I2 * w2 + I3 * w3 = ~D
however, I do not know the correct values of the weights (w), but I would like to fine-tune them by repeating my estimate:
in the first step I use equal weights:
w1= .33, w2=.33, w3=.33
and I estimate D using these weights:
EST= I1 * .33 + I2 * .33 + I3 *. 33
I receive feedback, which is a difference score between D and my estimate (diff=D-EST)
I use this feedback to modify my original weights and fine-tune them to eventually minimize the difference between D and EST.
My question is:
Is the difference score sufficient for being able to fine-tune the weights?
What are some ways of manually fine-tuning the weights? (e.g. can I look at the correlation between diff and I1,I2,I3 and use that as a weight?
The following command,
coefficients(lm(D ~ I1 + I2 + I3))
will give you the ideal weights to minimize diff.
Your defined diff will not tell you enough to manually manipulate the weights correctly as there is no way to isolate the error component of each I.
The correlation between D and the I's is not sufficient either as it only tells you the strength of the predictor, not the weight. If your I's are truly independent (both from each other, all together and w.r.t. D - a strong assumption, but true when using rnorm for each), you could try manipulating one at a time and notice how it affects diff, but using a linear regression model is the simplest way to do it.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
A reviewer of a paper I submitted to a scientific journal insists that my function
f1[b_, c_, t_] := 1 - E^((c - t)/b)/2
is "mathematically equivalent" to the function
f2[b0_, b1_, t_] := 1 - b0 E^(-b1 t)
He insists
While the models might appear(superficially) to be different, the f1
model is merely a re-parameterisation of the f2 model, and this can be
seen easily using highschool mathematics.
I survived High School, but I don't see the equivalence, and FullSimplify does not yield the same results. Perhaps I am misunderstanding FullSimplify. Is there a way to authoritatively refute or confirm the assertion of the reviewer?
If c and b are constant, you can factor them out relatively easily given the property of the power operator:
e^(A + B) = e^A x e^B...
so
e^((c - t)/b) = e^(c/b - t/b) = e^(c/b) x e^(-t/b) = b0 x e^(-t/b)
The latter expression is commonly used to simplify linear differential equation.