New answers tagged

1

You are looking for a mixed model (i.e. model which will allow you to use random effects along with the fixed effects you already use). You want to include device-specific random effect for the slope of log(X). Say you have a data.frame with columns logY, logX, deviceNumber. Than you get your desired result by: require(lme4) m <- lmer(logY ~ logX + (1 + ...


1

I will give you an example in R, using two contrast type, the default one and one that could be useful to you. The default contrast in R is to compare each level of a factor to the "reference", i.e. a baseline, the effect is estimated in the intercept term. Another set of contrasts is called "contr.sum", the intercept term now represents ...


1

Good question. Let $(y,x)$ be your test data with $y = x^T \beta^* + \varepsilon$ and assume that $x$ is random as well (independent of $\varepsilon$). To simplify, let $$\delta = \beta^* - \widehat \beta.$$ Then, your mean-squared prediction error is \begin{align*} \mathbb E [(y - x^T \widehat \beta)^2 \mid \mathcal T] &= \mathbb E [(x^T \beta^* - x^T \...


1

I would suggest trying some market mix models which does randomization of subjects and provide estimates at subject level.


1

As mentioned in the comment, the first n days in normalized days are disturbing to me, so I'd like to stay with discrete days. The data then becomes: data <- data.frame(day = 1:7, y = c(-1.77840188804283, -0.766238080609954, -0.174160208674574, 0.245925726822919, 0.571769693063722, 0.838003598758299, 1.06310115868241)) ...


0

I do not know why day is negative in your data and not in sequence from 1, 2, ... I guess those values are obtained after transformation. For simplicity, assume that we are day in whole number sequence. Suppose that you want to compute $sum(y)$ up to day 10, i.e., $sum_{y10}=y_1 + y_2 + ... + y_{10}$. You need to know $y_8$, $y_9$, and $y_10$. By inserting $...


0

A few suggestions with respect to working with crime data. First, your plot is investigating the relationship between unemployment rates and total crime counts across many geographic regions. It is unclear what a "region" represents, but it appears they are rather large aerial units (e.g., counties, states, countries, etc.). Some regions experience ...


2

Yes, this is generally true. Given data $(x_i, y_{1i}, y_{2i}),$ the second model supposes $$y_{1i} = \beta_0 + \beta_1 x_i + \beta_2 y_{2i} + \varepsilon_i$$ for fixed unknown $\beta_j$ (which are estimated by reg). The first model supposes $$y_{1i} - y_{2i} = \alpha_0 + \alpha_1 x_i + \alpha_2 y_{2i} + \delta_i.\tag{**}$$ By subtracting $y_{2i}$ from both ...


5

What is going wrong with ARIMA? The reason is, as @chris-haug suggested, that the large distance between the initial value and the mean of the process at the beginning of the series make it appear unlikely (in the sense of the likelihood function) that the series is stationary (in the sense of all the values being drawn from the same conditional distribution)...


8

TLDR The reason is because ARIMA class does regression with AR(1) errors when a constant is present, not the AR(1) model that you expect and created the series for. ARIMA class estimates AR(1) as you expect only when the constant is zero, i.e. unconditional mean is zero. I mean statsmodels v0.12.1. Theory The AR(1) that OP generated the series for is: $$x_t=...


1

I will try to answer your questions with following order 2,1,3, I believe understanding question 2 will make it easier to understand remaining questions. Question 2: Bayesian inference is done through posterior, not likelihood. The likelihood is just a component of the posterior. Maximizing the likelihood is the frequentist approach since Maximizing the ...


Top 50 recent answers are included