Quantcast
Channel: User Alex J - Cross Validated
Browsing latest articles
Browse All 63 View Live

Comment by Alex J on Calculated spread and mean using mean results only

For now, I've reverted the edits. If you think something can be clarified, I'm happy to do so, but I'm not convinced at this stage that you've understood what I wrote.

View Article



Comment by Alex J on Why the p-values of a zero-inflation model are not...

The original post linked in the question was referring to an intercept-only term; I thought we were talking about that. But my last paragraph also talks about a situation when the p-value is useful.

View Article

Comment by Alex J on Understanding Fixed Regressors and Conditional...

Linear models are always modelling $E[Y|X]$, or more explicitly, $E[Y|X=x]$. Since we are conditioning on $X$, this means $X$ is known and not a random variable. It doesn't matter how $X$ is...

View Article

Answer by Alex J for Noise cancels but variance sums - contradiction?

I think you've confused averaging, and summing. You're almost onto it with "because the noise components average to zero."Consider a series of independent variables $\{X_i\}$ (with $i$ running from $1$...

View Article

Answer by Alex J for Kaplan Meier but no individuals' data

You do have the individuals' data. It's just not formatted in a nice way at the moment, and it will be some work to manipulate the data to extract it.Let's say Treament X, Replicate Y has this...

View Article


Answer by Alex J for Modeling continuous interaction effect with very small...

I agree with @Jeremy Miles' answer.Further to that, I suggest looking at the data from an "exploratory data analysis" approach. Visualise it, tabulate it, use models and statistics to help explore the...

View Article

Answer by Alex J for Help for structuring pertinent GLM model

This is not a full "how to do it" answer, but some thoughts and leads.You need to account for there being 10 individuals. This could be done either by a multinomial model (more complete), or binomial...

View Article

Answer by Alex J for Paired t-test with redundant data

I think you're looking at a mixed effects model where the random effect is the mouse ID, and the fixed effect is the binary control/treatment status. Your response variable will be the difference: for...

View Article


Answer by Alex J for Dubious Binomial Residuals

The binomial distribution has variance $np(1-p)$. Therefore, the variance is dependent on the mean.The reason why in usual linear regression, that we look for heteroscedasticity, is because the...

View Article


Answer by Alex J for Inverse and log link give opposite results in Gamma GLM

This isn't an error. The GLM is doing exactly what you're telling it to do.The log link is an increasing function of the linear predictor, while the inverse link is a decreasing function of the linear...

View Article

Answer by Alex J for Definition of events in independence simple coin toss

In point 2), _ the experiment of tossing a coin that is repeated twice_, this is the same as 1) experiment of tossing a coin twice. The sample space is {HH, HT, TH, TT}. Note: there are four possible...

View Article

Answer by Alex J for Which mixed effects model to use?

Something like score ~ group + (1|ID) (that syntax means that ID is a random intercept term), with a right skewed distribution (e.g. gamma or lognormal) would probably be a good place to start.

View Article

Image may be NSFW.
Clik here to view.

Answer by Alex J for Geometric meaning of cross product of a design matrix...

Multiplying the design matrix (blue) by fitted coefficients (red) has the geometric interpretation of fitting a line (or higher-dimensional version of a line). A line is just anything that can be...

View Article


Answer by Alex J for How to generate binomial point estimate consistent with...

Compute the probability by cum_success/nobs

View Article

Answer by Alex J for Robust clustered errors using the survey package

svyglm always returns standard errors account for the clustering in the design - see the Notes section of ?svyglm.

View Article


Answer by Alex J for Draw 21 cards from a standard deck, what are the odds of...

Use the hypergeometric distribution, which is analagous to the binomial distribution but the draws are without replacement.success is defined by being (A, K, Q)the number of draws $n$ is 21the...

View Article

Answer by Alex J for Using Histograms To Study Conditional Distributions

Yes - the residuals overall in your Poisson distribution, are not Poisson distributed. They are only Poisson distributed conditional on the linear predictor.The DHARMa package implements something akin...

View Article


Answer by Alex J for What is the probability a difference of two appears...

I don't think there's a particular distribution for this. I have sketched a derivation from first principles.If we have a sequence of absolute differences of die rolls $D_1, D_2, D_3, \cdots$ (which...

View Article

Answer by Alex J for glmmTMB truncated models with zero inflation

I think there is some confusion about what the two zero-inflated models actually are. Your two dot point definitions in the question are good. However, there appears to be some confusion in the...

View Article

Answer by Alex J for How do I use something like predict.glm (in R) with a...

It defaults to predicting on "link" scale see (?survey:::predict.svyglm()), i.e. the prediction is of the logarithm of the mean (as you've defined your model with Gamma(link="log")).If you do type =...

View Article

Answer by Alex J for Parameterization of Negative Binomial for Dynamical...

Checking ?dnbinom, the equivalent parameterisation is: your $d$ is R's x, your $p$ is R's prob, your $r$ is R's size, and your $I$ is R's mu.mu is the mean, $I_t$ in your case. Then prob =...

View Article


Answer by Alex J for $\rho( A, B ) = 0.9999$, $\rho( X, Y ) = 0.9999$,...

Your second sentence $A$ and $X$, $B$ and $Y$ are really almost just two pairs of near-identical time series does not necessarily follow from the first statement.Consider this example in R. I define...

View Article


Answer by Alex J for Compare 2 systems using pairwise preferences

How about a binomial mixed effects model?Collapse the data from matrix form, into a $K\times N$ length vector.Your model would be $\text{logit}(p) = \beta_0$ (where $p$ is the probability of picking...

View Article

Image may be NSFW.
Clik here to view.

Answer by Alex J for Confidence box for coefficients of linear regression?

As I see it, there are two options. The first is to use the log-transformed formulation you are using. The second is to use a generalised linear model formulation. I think the second way is better, but...

View Article

How to manually calculate dAIC (survey design-based AIC) in R survey package

In preparation for fitting some more complicated distributions to survey-weighted data, I am trying to reproduce the $d\text{AIC}$ by hand for a simpler distribution (binomial in this case). I am...

View Article


Image may be NSFW.
Clik here to view.

Answer by Alex J for Finding Cumulative Distribution Function of weighted data

The empirical cumulative distribution function (ECDF), describes at every $x$ point (income in this case), the proportion of the population that is less or equal to that $x$ value. It doesn't matter...

View Article

Comment by Alex J on How should I visualise uncertainty in a histogram from...

It's a numeric variable. In my particular use case, it's a non-negative integer (but that's probably not relevant for answering the question). Thanks, I have clarified that in the question body.

View Article

Comment by Alex J on Choosing between Negative Binomial, Zero-Truncated NB,...

IMO - it doesn't make sense to run a NB regresssion if the values are all > 30. Neither does it make sense to run zero-truncated, if it's actually truncated at 30. The last option which you...

View Article

Comment by Alex J on For the binomial distribution, is the proportion of...

They can't have the same distribution. The proportion of success must be a real number between 0 and 1, while the count of success is a positive integer.

View Article



Comment by Alex J on Forcing GLM with binomial distribution through zero...

You could use binomial(link='identity') to force the intercept through zero. However, why are you trying to use a binomial model? A binomial model is generally used for binary outcomes (1/0, yes/no,...

View Article

Comment by Alex J on If IV and DV shares a component, can you simplify the...

I think you mean (a-b) ~ (c-b), and a ~ c in the question body

View Article

Comment by Alex J on Regression model detects effects that are much smaller...

A power analysis should give you output along the lines "if the effect exists and is of size $d$, your study as a $x$% chance of detecting it." But there's no reason why it can't detect an effect of...

View Article

Answer by Alex J for If IV and DV shares a component, can you simplify the...

In standard linear regression contexts, anything on the right side of the formula is treated as fixed.So, "y = a - b, x = c - b" in your original question would be formally treated as modelling the...

View Article


Comment by Alex J on Required sample size for logistic regression?

Hi @Annie, welcome to CV! "My usual go-to of G*Power is asking for a bunch of figures that I'm unsure of" - what are these? If you could explain this, and a bit more about the context, and what you're...

View Article

Comment by Alex J on Relative importance of equal sample size vs equal sample...

"what is the relative importance of maintaining equal sample sizes versus equal sample densities?" <- depends. What are you trying to achieve? This will determine what's important. For an extreme...

View Article

Comment by Alex J on Sample size calculation for generalized linear mixed...

"Can I somehow make use of the model without random effects used in the previous experiment and make reasonable (possibly conservative) assumptions about the variance before running simulations?" -...

View Article


Comment by Alex J on How to account for uncertainty in population "mu" in...

A bootstrap, perhaps?

View Article


Answer by Alex J for Relative importance of equal sample size vs equal sample...

To determine what's optimum, a good way is to first identify a few key research questions. Then, do a power analysis to design a study that can answer those questions. The key takeaway is, what you're...

View Article

Comment by Alex J on determining if odds-ratio for a numerical x variable and...

Hey @mz., welcome to CV. As a simple start, you could try fitting a model (e.g. say if you want to see if the effect of x on y differs by sex) with an x:sex interaction term, and see if the coefficient...

View Article

Comment by Alex J on what is the meaning of “One-sample test.”?The following...

What I can think of, is that this is called a "one sample test", because it is looking at the differences between x and y (e.g. see the second wilcox.test call). So it's a one-sample test of differences.

View Article

Answer by Alex J for Contrasting answers on problem on populations and samples

This is an interesting one. You're both correct... in a sense. The assignment is poorly worded though.In survey design, there are actually two populations. There's the target population, which is the...

View Article

Browsing latest articles
Browse All 63 View Live




Latest Images