matteo
  • Member for 7 years
  • Last seen this week
3 answers
31 votes
24k views
When to use a GAM vs GLM
Accepted answer
21 votes

The main difference imho is that while "classical" forms of linear, or generalized linear, models assume a fixed linear or some other parametric form of the relationship between the dependent variable ...

View answer
1 answers
5 votes
36k views
R - lmer vs glmer
13 votes

lmer is used to fit linear mixed-effect models, so it assumes that the residual error has a Gaussian distribution. If your dependent variable A is a binary outcome (e.g. a yes/no response), then the ...

View answer
1 answers
0 votes
8k views
Expected value of simple normal distribution with non-zero mean
Accepted answer
7 votes

The expected value of a random variable $X\sim\cal N\left( {1,3} \right)$ is 1. However, as noted by Dilip Sarwate in his comment, your pdf is wrong: there should be no was wrong, there was an extra $...

View answer
1 answers
2 votes
707 views
How to generate random data, that's from Beta distribution with specific density function in R?
Accepted answer
6 votes

To obtain the function $f(x) = \theta x^{\theta - 1}$ you need to use rbeta( , 2, 1), not rbeta( , 1, 2) (to see why look into ?rbeta). density_fun <- function(x,theta=2){ theta * x^(theta-1) } ...

View answer
1 answers
6 votes
223 views
For what types of research designs should (Days|Subject) vs. (1|Days:Subject) random effect specification be used?
Accepted answer
6 votes

Your fit2 does not really fit a random slope. Instead, it sets a random intercept for each combination of Days and Subject. This implies that for the computation of the random effects fit2 treats Days ...

View answer
4 answers
6 votes
24k views
What are neurons in neural networks / how do they work?
6 votes

Within an artificial neural network, a neuron is a mathematical function that model the functioning of a biological neuron. Typically, a neuron compute the weighted average of its input, and this sum ...

View answer
3 answers
6 votes
287 views
How to interpret $\mathbb{P}(B|A)$ when $\mathbb{P}(A) = 0$
5 votes

No (no such thing as infinite probability: a certain event has probability 1). In fact if it is a probability of an event (and not of a continuous random variable) then it is an ill-posed problem: ...

View answer
1 answers
0 votes
49 views
How to interpret results of GLM logistic regression?
4 votes

The exact interpretation depends on how the predictor variables are coded. Recall that the logistic GLM can be expressed as $$ \log_e \left(\frac{p}{1-p} \right)=\beta_0 + \beta_1x_1+ \ldots+\beta_n ...

View answer
1 answers
2 votes
37 views
Illustration of response variable plane in multiple linear regression with 2 regressors
Accepted answer
4 votes

If you have only 2 predictors, e.g. $y=\beta_0 + \beta_1x_1 + \beta_2x_2+\epsilon$, then yes it could be represented as a sort of surface, although note that you might have multiple values of $y$ for ...

View answer
1 answers
1 votes
114 views
Interpretation of coefficients in linear regression of data in repeated measure
Accepted answer
4 votes

Given that your observations are clustered according to individual participants, which can be considered random samples from a population distribution, the best and most robust approach is provided by ...

View answer
1 answers
2 votes
2k views
Problem understanding the interaction term of mixed effects model
4 votes

I think the way you formulated the model is a bit misleading: you have Site as grouping factor (i.e., there are random intercepts contingent on which site you are measuring), but then you add it also ...

View answer
1 answers
1 votes
71 views
In what instance would r, R, and β be the same?
4 votes

Pearson's $r$ correlation coefficient is computed as the covariance of two variables, divided by the product of their standard deviations. It is bounded between -1 and 1. $$ r_{x,y}=\frac{\text{cov}(x,...

View answer
1 answers
0 votes
51 views
Why is an ROC curve TPR (Y) against FPR (X)?
Accepted answer
3 votes

I think the reason is mainly conventional: If you plot FPR against TPR you obtain the same curve, except that is concave upward instead of downward, and the conventional summary statistics change ...

View answer
3 answers
1 votes
19k views
How to normalize data between 0 and 1?
3 votes

The formula $x' = \frac{x - \min{x}}{\max{x} - \min{x}}$ will normalize the values in $[0,1]$. I am not sure of why you want to exclude $0$ and $1$, anyway one way would be to choose a new minimum ...

View answer
1 answers
1 votes
116 views
Calculating the mean analytically in R
Accepted answer
3 votes

You are not doing anything wrong as far as I can tell. I think the problem is that your integrand is approximately zero almost everywhere except for a small range around 50. From ?integrate If the ...

View answer
2 answers
4 votes
4k views
Modeling reaction time with glmer
3 votes

The high AIC value is not a problem in itself: the AIC is a measure of the relative quality of a model; it says something about how good is the fit of a model but only with respect to another model ...

View answer
1 answers
0 votes
122 views
Estimating Parameters using MLE
3 votes

The output gives you the shape and rate parameter of the gamma distribution; you can find on Wikipedia the formula for the shape-rate parametrization. To plot the probability density function you can ...

View answer
2 answers
6 votes
3k views
Maximal model for linear mixed-effects model for repeated mesaures design
Accepted answer
3 votes

The maximal structure would need to include also a random effect for the interaction between color and shape, that is: Y ~ color * shape + (color + shape + color:shape | subject) This will result in ...

View answer
3 answers
1 votes
628 views
find peaks from response signal
3 votes

If you know the formula of the response to a single pulse/peak, you could do a deconvolution of the observed response. You could use the approach described in this article http://www.pnas.org/content/...

View answer
1 answers
0 votes
66 views
Estimate an error bound for an estimate
2 votes

If you want to give a confidence margin on the estimates, your approach of estimating the standard deviation of the errors, $\sigma$, and then giving a confidence interval of $2\sigma$ is sound; ...

View answer
1 answers
1 votes
53 views
How to identify outliers in a ratio X/Y where Y is a frequency, and thus implies a confidence?
2 votes

Perhaps this could be addressed using a beta-binomial model? You could have a predictor that code for possible changes in the underlying (unknown) fraction of people with the disease in the population ...

View answer
1 answers
1 votes
152 views
pwr.anova.test : increasing power, decreases sample size?
2 votes

I think you may be confused about some concepts: The effect size is a (standardized) measure of the magnitude of the phenomenon that you are investigating - in other words, it is a property of the ...

View answer
2 answers
2 votes
171 views
How to model this mixed model
Accepted answer
2 votes

I think the model you want in lme4 syntax should be written as lmer( R ~ c + Manufacturer + c:Manufacturer + ( c | sensor), data = data) This model will have sensor-specific random intercept and ...

View answer
1 answers
6 votes
538 views
Bootstrapping with more than one random effect
Accepted answer
2 votes

I think in this case it is recommended to do a parametric bootstrap: the mixed effect model gives you an estimate of the variance of the effects of words and subjects, so you can generate new random ...

View answer
1 answers
2 votes
293 views
Correct or not? Mixed Bayes' Rule - Noisy Communication
Accepted answer
2 votes

Both answers are correct. The likelihood is defined as $$ p \left(Y \mid X=1 \right) = \frac{1}{\sqrt{2\pi}}\, e^{\frac{-\left(y-1 \right)^2}{2}} $$ Assuming both $X=1$ and $X=-1$ have the same ...

View answer
1 answers
2 votes
454 views
How to simulate "empirical" fixed effects in linear mixed models
Accepted answer
2 votes

Since the mean of the simulated residuals is not exactly zero, the model cannot possibly disentangle the mean residual from the true effect. Nevertheless, the model clearly does a good job in taking ...

View answer
1 answers
1 votes
1k views
Maximum Likelihood Estimation to fit Von Mises to grouped (interval) circular data
Accepted answer
2 votes

The mixture model (for a continuous response variable) has the following density function $$p(x)= \frac{p_{guess}}{2\pi} + (1-p_{guess}) \frac{e^{k \cos (x-\mu)}}{2\pi I_0(k)} $$ To fit this model to ...

View answer
1 answers
1 votes
314 views
LMM with standardized predictor - how to retrieve intercept & slope in the original scale
Accepted answer
2 votes

You have a model of the form $$y = a + b\left( {\frac{{x - {\mu _x}}}{{{\sigma _x}}}} \right)$$ And need the parameters of this equivalent model $$y = c + dx$$ ($\mu_x$ and $\sigma_x$ are the mean ...

View answer
2 answers
2 votes
4k views
Leave-one-out cross validation output interpretation and ROC curve
2 votes

The first delta value outputted by cv.glm is the mean squared error between your dependent variable Sex (dummy coded as 0 and 1 values) and the predicted probability that Sex$=1$, averaged over the ...

View answer
1 answers
1 votes
3k views
What do the thresholds on x and y axis of ROC curve represent?
Accepted answer
2 votes

They correspond to different decision thresholds, however they are the proportion of correctly classified data points (true positive rate; usually on the y-axis) and the proportion of "false positives"...

View answer