interpreting posterior distribution in JAGS [closed] - r

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
Summing up the posterior probabilities of a discrete distribution gives a value of more than one. Where am I going wrong?
This is the posterior generated by jags

My guess is that the histogram is supposed to be interpreted as a density function, and the probability mass of each bar is therefore the width of the bar times the height of the bar.
Given that interpretation, it looks like the masses sum to approximately 1. The width of each bar appears to be 1/2 and the sum of the heights is about 2 (to judge by eyeball).
If that's not it, you'll have to give more information e.g. show your R script and any data.

Related

How to Constrain the slope to be positive in regression? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How can I constrain my regression coefficient (only the slope, not the intercept) to be positive? It's a general statistical question, but specifically, I would like to have an r solution, and even more specifically when using model 2 regression (major axis regression).
You could do linear regression with nls, and limit the paramater range there.
Example: Using the nl2sol algorithm from the Port library we want to find a data set with x and y values with a negative Y-intercept and slope between 1.5 and 1.6:
nls(y~a+b*x,algorithm="port",start=c(a=0,b=1.5),lower=c(a=-Inf,b=1.4),upper=c(a=Inf,b=1.6))
This solution and others are explained in the more general question at https://stats.stackexchange.com/questions/61733/linear-regression-with-slope-constraint

Why does the desnity plots exceed the unity value in the hist(x,freq="FALSE") command of R? [closed]

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 5 years ago.
Improve this question
I am using hist(x_new,freq = FALSE) command to plot histogram, but the probability density exceed the value unity.
Probability density is not the same thing as probability. Densities are not in general bounded by 1. The point is that the total area under the density is 1, which is completely consistent with portions of it being above 1. In fact, it is quite common for a density function (or density histogram) to be above 1 in some places.

Interpretation of ACF plot [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Need help on interpreting the acf plot(sin graph pattern)
May be you will need to examine the PACF, you have a large peak in the first lag, followed by a decreasing wave that alternates between positive and negative correlations. Which can mean an autoregressive term of higher order in the data.
Use the partial autocorrelation function to determine the order of the autoregressive term.

Correlations, Scatter Plots and P-Value [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a set of data, after questioning customers.(it's about a shoe company) Two of the columns include GENDER and INCOME. I am supposed to test if there are any significant differences in income between genders, and give the corresponding P-value.
I'm still a n00b when it comes to R, I'm still learning and I've been struggling for 3 days now to find the functions to do so. Does anyone have any lead, or could help me with it? would be awesome.
I am editing this because I realized my other answer was not correct.
What you want is a linear model.
say
GENDER <- factor(c(0,1,1,0,1)
INCOME <- c(20000,30000,40000,50000,550000)
then you want
model <-lm(INCOME~GENDER)
and
summary(model)
anova(model)
will give you the information you are after.
Good luck,
Bryan

How to identify the distribution of the given data using r [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
The community reviewed whether to reopen this question 10 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I have the data as below and i need to identify the distribution of the data. pls help.
x <- c(37.50,46.79,48.30,46.04,43.40,39.25,38.49,49.51,40.38,36.98,40.00,38.49,37.74,47.92,44.53,44.91,44.91,40.00,41.51,47.92,36.98,43.40)
A neat approach would involve using fitdistrplus package that provides tools for distribution fitting. On example of your data.
library(fitdistrplus)
descdist(x, discrete = FALSE)
Now you can attempt to fit different distributions. For example:
normal_dist <- fitdist(x, "norm")
abs subsequently inspect the fit:
plot(normal_dist)
As a generic point I would suggest that you have a look at this discussion at Cross Validated, where the subject is discussed at lengths. You may be also willing to have a look at a paper by Delignette-Muller and Dutang - fitdistrplus: An R Package for Fitting Distributions, available here if you are interested in a more detailed explanation on how to use the Cullen and Frey graph.
First, thing you can do is to plot the histogram and overlay the density
hist(x, freq = FALSE)
lines(density(x))
Then, you see that the distribution is bi-modal and it could be mixture of two distribution or any other.
Once you identified a candidate distribution a 'qqplot' can help you to visually compare the quantiles.

Resources