instruction
stringlengths
9
38.7k
I have a parameter $\theta$ and data $y = f(\theta) + \mathrm{noise}$. My goal is finding the best fit for $\theta$ and assess the uncertainty I have on this best fit. I see two competing approaches for doing this: I can compute the MLE $\widehat \theta =\arg \max_\theta p(y \mid \theta)$ with some optimization algori...
I know that the variance of a linear combination of correlated random variables can be generalized (as in Variance of linear combinations of correlated random variables). My question has to do with the variance of an additional linear combination of two or more such linear combinations. This is a different question fro...
Let's say mtcars contain 3 independent datasets: cyl=4, cyl=6 and cyl=8. I'd like to use two of the groups as my training set, and cyl=4 as the testing set. The aim is to check how well my model performs on the test data: training <- mtcars[mtcars$cyl!=4,] testing <- mtcars[mtcars$cyl==4,] Model: m <- lm(mpg ~ disp + ...
I have 2 questions I'm trying to answer. (1) w/in subject: How does a person's experience with (A) change overtime? (2) btwn subjects: That person belongs to a certain group. How do groups' experience with (A) compare to each other? How can I go about answering these questions using SAS? If not with SAS, what about R o...
I am fitting a hierarchical state space AR(1) model in Stan and am struggling use common model evaluation metrics on the model output. Computing the WAIC or using loo_cv in the loo package give warnings as described in this post: Warnings during WAIC computation: how to proceed?. Specifically: loo::waic(log_lik) > (98....
This toy problem was just thought of by me to get an better intuition for the SVM algorithm. Assume the following optimization problem: $$ L(w, b, \alpha)=\frac{1}{2}||w||^2 - \sum_{i}\alpha_i[y_i(\langle w, x_i\rangle)+b)-1] $$ This is the objective function of a SVM problem. To find the boundary that solves a given C...
I have been reading that the features should be standardized before performing PCA but I couldn't relate to my understanding of the same. PCA try to project the dataset in the direction of maximum variance and the whole idea of PCA is the dimensionality reduction. So, If I achieve the maximum variance in less component...
I am trying to understand which kind of test I could use in order to test if two distributions differ significantly from each other. My data has the following structure: I have for two countries the numbers of cars sold per 100,000 citizens for 5 different car manufacturers. Any help would be appreciated.
This issue arose using R's psych package, specifically the fa function, but the problem is a theoretical one: When generating the factors for a dataset, the reported "cumulative variance", i.e. the proportion of variance explained by the factors, appears to change based on the rotation method chosen. Specifically, vari...
My study is not intervention-based, and both the X and Y variables were collected at the same time point. As such, the data only allows for correlation analysis and does not establish a causal relationship between X and Y. I am wondering if it is still appropriate to analize the moderating role of W on the relationship...
If we're studying a population over time where each individual is subject to the same time-varying intercept, we can model it with time-fixed effects (ignoring any individual-fixed effects): $$ Y_{it} = X_{it}\beta + \alpha_t + \epsilon_{it}\,. $$ We can then form a within(-time) transformation by subtracting the mean ...
sorry if this is kind of a basic question, I’m no expert in stats. I am a PhD student (biologist) working on my thesis and I’ve been dealing with some complicated data that I obtained from an experiment. My animals are fruit flies and I want to study whether their sleep changes after a treatment (sleep deprivation whic...
I'm working on my master's thesis where I'm trying to determine whether sea turtles are capable of discriminating between colour. One subcategory I'm looking into is seeing whether the speed they learned to discriminate between the colour is affected by which colour was their reinforced colour (ie whether colour affect...
I just started learning the concept of variational inference in the context of variational Autoencoder, so please excuse me if the answer is obvious. I would like to know why traditionally, KL-divergence is used instead of the Wasserstein distance in the Loss-function of a VAE.
This question comes from the Bayesian Thinking in Biostatistics textbook. So I've been given a dataset where the mean is shown to be 134.5 and the variance 242.2. Using a normal prior for the population mean μ ~ N(130, 100), I need to plot the posterior and prior distributions of μ and obtain the posterior mean and med...
Studying NN and I wanted to grasp from scratch the theory of gradient descent and matrices derivatives, so I took a simple scenario and tried to apply gradient ascent and see if everything made sense. I took a simple linear function $f(x): Ax$ where $A \in \mathbb{R}^{2 \times 2}$ whose gradient should simply be: $$ \n...
G-test statistic is defined as $$ G(O,E) = 2 \sum_{i=1}^N O_i \ln \frac{O_i}{E_i} $$ and $G \sim \chi^2_{N-1}$ asymptotically. How is $$ \begin{eqnarray} S &=& G(O,E)+G(E,O) \\ &=& 2N\big(D_{KL}(O||E)+D_{KL}(E||O)\big) \\ &=& 2\sum_i(O_i-E_i)(\ln O_i - \ln E_i) \end{eqnarray} $$ distributed? If $G(O,E)$ and $G(E,O)...
I am using case control studies for a meta analysis. The participation selection is not random but the studies used different statistical analysis methods with their results and there is significant heterogeneity between studies used (Using a random effects model for meta analysis I2 = 95%, p=<0.00001). Also a previous...
Let us say we have a random sample $X_1,...,X_n\sim F(\theta)$ and we do inference over $\theta$ and give a maximum likelihood estimate $\hat{\theta}$ and a confidence interval at the $\alpha$% given by $(\hat{l}_\theta,\hat{u}_\theta)$. Does invariance apply for the quantiles of the distribution? This is, is $\hat{F}^...
If I do a t-test of the control and treated group to get the mean, difference, and p-value. How do I know if there is good comparability between groups?
In genomics, nearby SNPs are in LD (correlated) with each other. It violates the independence assumption in linear models and are being treated as random effect in linear mixed model in a method estimating the degree that phenotype is influenced by genotype (i.e., estimating heritability in GCTA). Random effect is a gr...
this is equation of functional response following polynomial logistic regression with binomial distribution Na=N (exp p0 + p1 N + p2 N^2 + p3 N^3 ) /(1 + exp (p0 + p1 N + p2 N^2 + p3 N^3)). I would like to know how to estimate Maximum likelihood of this equation with parameters p0, p1, p2 and p3 being constant, linear,...
Background: I am studying a course on statistical experiments using the textbook by Douglas Montgomery on the analysis of experiments. This is an introductory course and so I am relatively new to the study of these types of models. Question: Consider the model $Y_{i,j,k} = \mu + R_i + C_j + T_k + \epsilon_{i,j,k}$ wher...
Suppose I have two Gaussian distributions $N(\mu_0, \sigma), N(\mu_1, \sigma)$ with identical variance, where $\mu_0, \sigma$ are known and $\mu_1$ is unknown. Suppose I realize a sample $x$ from one of these two distributions. What can I say about the probability that $x$ is not from $N(\mu_0, \sigma)$? A reasonable ...
I have a regression I ran with a continuous dependent variable (CSI), and independent continuous variable (ACI) and a categorical variable with 4 levels (Relationship_Type): model_complex = smf.ols('CSI~ACI + C(Relationship_Type) + C(Relationship_Type)*ACI', df).fit() I want to compare all the beta coefficients for my...
I'm using Gaussian Process regression for the first time to model the unknown energy efficiency of a compressor which I know is a smooth, non-linear relationship that looks something like the line in this plot: One option (option 1a) is to have the GP model map load (kW) to power (kW) just like in the figure above. Ho...
I have a dataset with ~6k data points. Each data point has two labels, both categorical (unlike measuring temperature from cold, warm, to hot, my labels in the same category is totally non-continuous). Category A contains labels ABCD... in total >10 labels. Category a contains labels abcd... in total 30 labels. I would...
In my research I am currently conducting a monte carlo simulation, in which I end up computing the sum of say $X$ and $Y$, where $X \sim N(0,1)$ and $Y = X^2$. That is, I sum up a standard normal distributed random variable and the square of this random variable. Now, this is not so important for the simulation itself,...
Suppose the DID model is Y = a + b(Treatment) +c(Time) + d(Treatment*Time). Now, If i wanted to find out the average treatment effect on the treated, how should i modify my model?
I'm trying to understand what is the meaning of having a k x k parameter matrix for the long term (cointegration) relationship in a VECM model, and a rank r such that 0 < r <= k. The way I understand it for now (and I'm not sure if this is correct) is that if r = k then there are k cointegrated relationships in the sy...
I apologize in advance for the possibly philosophical nature of the question, however I would like to get answers from this website rather than from Philosophy exchange at the moment. I also come from a Pure mathematics background, so I might have some misconceptions about how the field of Statistics works. The scienti...
I will simplify my research question. I have 40 patients (group 1) with assessed a variable v1 (e.g. their blood preassure) at timepoint 0 ( v1(t0) ). After treatment (treatment 1 at timepoint 1) I measure the same variable v1(t1). A second group (group 2) is treated with different treatment and v1 were assessed at to...
I have a dependent variable which is tree cover loss and independent variable which is temperature. Both variables have 20 groups/regions in a country in them and I want to do some kind of stats test/correlation test but am not sure which one to do? I have each region with the years from 2001-2021 but I also have just ...
One of the examples online is about how to write the Metropolis-Hastings algorithm from scratch. This tutorial uses a linear regression model as an example. Estimate three parameters: an intercept, a slope, and a standard deviation. The code in that tutorial proposes three candidate samples (theta_star) from proposal ...
I have a resources lets say $x$ and $y$. These resources produces location data with a timestamp, hence its timeseries data. The data looks like this (resource_uuid,timestamp, location). It might be the case that resources both belong to a same class in sense of a higher abstraction(they behave same way and the data wh...
I have been using elliptical slice sampling (ESS) with much success lately and I have a question I can't seem to figure out myself. Does a whitening transformation of the prior affect ESS performance? In other words, does ESS take advantage of the particular covariance structure to propose better moves? To clarify, say...
Simple linear regression is symmetric in the sense that, if I regress $Y$ on $X$ or $X$ on $Y$, I get the same $R^2$ and result from the overall $F$-test. set.seed(2023) N <- 1000 x <- rnorm(N) y <- rnorm(N) Ly <- lm(y ~ x) Lx <- lm(x ~ y) summary(Ly) summary(Lx) #######################################################...
I have a data that looks like the following: ID Male Diabetes Renal failure Hepatic disease Coronary artery disease Cancer COPD 1 1 1 1 0 0 0 0 0 2 2 1 1 0 1 0 0 0 3 3 0 0 ...
Context Imagine a plant where a piece of equipment is placed outside, subject to wind and temperature changes. To monitor a specific aspect of this equipment, two identical sensors were installed at different positions at the equipment. The sensors and produced by the same manufacturer, and they measure exactly the sam...
I am working with a treatment that has three nominal (I suppose these could be considered ordered) values: 0 = no mediation, 1 = failed mediation, 2 = successful mediation, For the purposes of the project I am working on, "failed mediation" is the treatment of interest. In particular, I am interested in whether failed ...
I've been trying to fit mixture cure models in Python. My data has 3 columns: Time, Event_Status(1 and 0) and Cure_Status(1 and 0). I would actually like to extend this problem to a multiple event mixture cure model, but the code for that is even scarcer. How can I fit a Weibull Mixture Cure model in Python using my da...
Let $\mathbf{x} := (x_0,\cdots,x_{N-1})$ be a $N$-tuple of elements of a finite set $\mathcal{X}$, and let $p$ be a probability measure on $\mathcal{X}$ that we assume to be nonzero everywhere. The $T$-statistic (used in the $\chi^2$-test) is defined as $T(\mathbf{x}) := N \sum_{x \in X} \frac{\left(\frac{\vert \{k \ \...
Say I have draw N values from a normal distribution [$\mu_1$, $\sigma_1$]. Below are 10 sampled points compared to the normal distribution they're sampled from I then create a normal mixture of normals [$\mu_2$, $\sigma_2$], where $\mu_2$ are the values sampled in step 1, and $\sigma_2$ is constant. Below are the 10 i...
Consider some standard 1d Gaussian Process Regression (GPR). Suppose you are not happy with a typical mean-zero prior away from the data and you actually want something like the derivative of the mean to be zero (away from the data). I think one way of getting at this is to start by modelling the observations as coming...
I'm currently struggling with my hurdle-regression analysis. My sample consists of randomly selected people in my hometown. The sample size is around 600 participants. My DV (count of car thefts) has way too many zeros (~95%), so my IVs only become insignificant (very large SEs) whatever I do. Since these zeros are tru...
I have read up on a number of threads discussing this, but none address my exact situation so I thought I would try my luck with outlining what I'm working with and getting more relevant insight. I am doing a pilot study using just one group of subjects. This group has undergone several weeks of an intervention, and I'...
Consider a ARMA$(p,q)$ model of $y$ with $m$ external regressors $x_1, ..., x_m$. Do I understand the documentation of the R package rugarch correct, that the considered model is of the form $$y(t):=\mu + \sum\limits_{i=1}^{p}a_i y(t-i)+\sum\limits_{i=1}^{q}b_i\varepsilon(t-i)+\sum\limits_{i=1}^{m}c_ix_i(t)+\varepsilon...
I have the following model: $ \ln(wage) = \beta_0 + \beta_1educ + \beta_2educ*college $ the variable $college$ is from the condition that if $educ \geq 16$. Should I include the variable $college$ in the model or just omit it as it is already explained by the $educ$ variable? I built the model from the following questi...
I have this problem. I have to analyze 13 chemical substances (n=13) in more than one analysis cycle. In each cycle of analysis, 8 substances are randomly chosen (m=8) to be analyzed. I would like to know how many analysis cycles I need to do in order that each of the 13 substances be analyzed at least once.
Is it possible to write $\beta$ as a function of $\gamma$ given the following definitions: $$\beta = \frac{cov(\log(W+X),\log(Y))}{var(\log(W+X))}$$ $$\gamma = \frac{cov(\log(W),\log(Y))}{var(\log(W))}$$ where $W$,$X$, and $Y$ are all random variables?
This is a very basic question, but I need help. Imagine I have a dataset for variables y, x, and z. I am running an instrumental variable regression such that y is my main outcome variable. So I am trying to estimate the following regressions. $$y=β_{0}+β_{1}x+e$$ $$x=α_{0}+α_{1}z+u$$ I have N observations. K observati...
I'm running a Chi Square test in SPSS to see if there are differences in the variable sex (levels: male, female) between my three treatment groups (levels: CBT, DBT, and no treatment). When I run the Chi Square test, I get a non-significant result (p= ~.14) with a small effect size. This seems a bit odd to me because i...
I have a dataframe X (with columns x1 and x2) and would like to calculate conditional probability, something like P(x1<0.5|x2<0.3), which can be calculated using BiCopCDF. My question is: how do I obtain the transformed values (i.e., u and v) from the original data (x1 and x2)? How can I obtain the u and v values corre...
The wasserstein_distance will be smaller the longer u_values and v_values are. from scipy.stats import wasserstein_distance def wassersteindist(n): a = np.random.randn(n) b = np.random.randn(n) w = wasserstein_distance(a,b) return w np.mean([wassersteindist(100) for r in range(1000)]) 0.1786 ...
I'm taking a university course in statistics where the Box-Cox transform is being discussed. As I understand it, we assume that there is some $\lambda$ that makes the sample normally distributed after applying the Box-Cox transform. To find said $\lambda$, we maximise the log likelihood of the sample, where the likelih...
Let $Y$ be a $\text{Gamma}(\alpha,\beta)$ random variable with known shape parameter $\alpha$ and unknown scale parameter $\beta$. Suppose we assign a $\Gamma(\alpha_0,\beta_0)$ prior to $\beta$. I am trying to show that the posterior distribution $\pi(\beta|\alpha_0,\beta_0)$ is again a Gamma random variable. I am con...
Neural networks operate on numbers, and it's well-known what the derivative of numeric functions are, as well as what the derivative of matrix functions are. What about functions that operate on maps or strings? Is there a derivative of the union/difference of a map, or the append/replace/delete/concat of a string? Doe...
I am struggling to understand what is meant by Equation 1.8 in Vapnik's Statistical Learning Theory. Vapnik introduces the equation below as the regression function. $ r(x) = \int y\ dF(y|x) $ I know that $x$ and $y$ are random variables -- where $x$ is an input and $y$ should be the outcome. I know $F(y|x)$ is the con...
I am trying to train a Transformer for sequence model, specifically for time series denoising. I have observed that the loss function (MSE) has been significantly improved during the evaluation which theoretically has not activated the weight of the model from the very beginning. However, after several epochs (1 or 2)...
I am part of a Survey Research Team and we are analysing Likert Scale Data.I would like to do a factor analysis for 9 items in the Survey,in order to find underlying structur. We also have Survey Design Weights for each person who took part in the Survey. The Data looks like this: I know how to calculate weighted corr...
I have a continuous target variable and 40 independent variables - some of them are ordinal, some are binary (Yes/No). When creating a correlation matrix I get correlations between: continuous and ordinal variables, between continuous and binary, binary and binary, ordinal and ordinal. I have household level data: th...
I am working with a dataset containing rare events (around 5%) and I am interested in performing exact survival analysis using R. However, I have noticed that some of the packages I previously used for this purpose are no longer available. Can anyone recommend any R packages that are currently available for performing ...
I'm fairly new to linear models so I'd like to have an explanation for this phenomenon. I calculated two linear models with R. The first one outputs this: lm(formula = Gries_PM10_value ~ Gries_PM10_value_lag1 + Gries_LUTE_value + Kalkleiten_WIGE_value) Residuals: Min 1Q Median 3Q -23.1273 -4....
I noticed that in difference-in-differences (DiDs), group fixed effects (FE) are predominantly used over unit/individual FE: $$Y_{ist}=\alpha_s+\gamma_t+\delta D_{st}+\varepsilon_{ist}$$ What I don't understand is, e.g., if $Y_{ist}$ is the employment status of an individual $i$ in a state $s$ at time $t$ after some ki...
I'm reading the paper (Mcnemar 1947), which introduces the origin of Mcnemar's test. And it gets me confused by understanding the equation of sampling variance of difference between proportional frequencies for paired data. For example, suppose we have a $2\times 2$ contingency table No Yes Yes A B A+B No C...
So my data is looking at the incidence of emotions within therapy sessions. I am looking at three groups that I suspect have different pattern across several emotions Group 1 n=36 Group 2 n=12 Group 3 n=6 The variables are measured in terms of time spent in that emotion (e.g., 10 minutes of anger, 5 minutes of sadness)...
Suppose we have independent family of random variables $\{Y\}_{i\in\mathbb{N}}\cup\{N\}$, where $Y$s are identically distributed. Next consider a sum of random number of random variables $W_N\equiv\sum_{i=1}^NY_i$, where $N\sim Binomial(n,q)$ ($n>1$ is a number or trials, and $q$ is success probability). Distribution o...
I want to run a binary logistic regression. After pearson test I have 2 correlated variables, one continuous and one categorical. I guess I should eliminate categorical variable. But I want to know the theory of eliminating correlated variables. Thanks.
I am trying to do a design of experiment to detect a defect (with little information given to me). In order to do that, I need to calculate the sample size. I am not really sure whether my attempt is correct, so any feedback would be much appreciated it. Variables: Response variable : defect/non defect. The reliabilit...
Here, UCLA gives a number of pseudo $R^2$ values for evaluating logistic regression models. Despite the issues with doing this, the last two deal with hard classifications rather than the probabilistic model outputs. The second-to-last pseudo $R^2$, "count", makes sense, as it is just the proportion classified correctl...
I have a question about simulating data in the context of (exploratory) factor analysis. I need to simulate n observations of p measurable variables derived from k latent variables given factor loadings for each measurable variable. That is, given a p x k matrix of factor loadings, I'd like to generate a set of n plaus...
A famous restaurant selling burgers has closely studied the demand for burgers for past months including the times the customer requested a burger and it was already sold out. Further analysis of data showed that the demand closely follows normal distribution with mean 20 and a standard deviation of 5 and the rule of t...
Let we have random variables $X$, $Y$, $Z$ and a function $q: Z \to \mathbb{R}$. How to write a Kullback–Leibler divergence between $q(Z)$ and $p(Z|X)$ mathematically correct? If we write $D_{\text{KL}}(q || p)$, this is ambigous. What $p$ do we mean: $p(Z)$, $p(Z|X)$, or $p(Z|Y)$? If we write $D_{\text{KL}}(q(Z) || ...
When I test the GBM boosting model on the Caravan data set and predict whether there will be a purchase I get all positive values. I thought I was supposed to log-transform the data to get whether a prediction is greater than 50% and in that case it will be "Yes" otherwise "No". I am not sure how to interpret this: whi...
I'm trying to simulate what is essentially a multiple linear regression for MASEM with some interaction terms. The idea is to have something like this: In this model, the S variables are all likely correlated and I'm assuming that the mod variable is not correlated with the S variables, but I have included it's covari...
I am having trouble understanding how the result of categorical cross entropy loss can be used to calculate the gradient for all of the weights. The output of cross entropy function is the sum of all of the negative log likelihoods multiplied by the one-hot encoded vector of the actual(desired) result of the neural net...
I have fitted respectively a zero-knot, a one-knot and a two-knot linear spline to my data, and I need some index of model performance for model selection. The crucial point is that the splines are fitted with robust linear regressions, specifically with Huber estimations, which makes the usual estimator of prediction ...
I am a physician conducting some research in Critical Care patients (I have full ethical approval, none of my results will be used to inform patient treatment, etc). When a person's lungs are enormously sick, they can be turned on their front. It often helps. I have a dataset from around 135 patients who have had this ...
I was task with analyzing some within/between-subject data, but my current guess is that I have no way of analyzing a combined within-subject score since an identifier/ID is missing. Is there a different way to how to do significance testing between groups for a overall score? Given are 2 tables (t), t1 has first ratin...
I am new to neural networks. I am studying back propagation and saw different references. for a layer $k$, some references state that the error $\delta_j^k$ for neuron $j$ at $k$th layer is $$ \delta_j^k = \dfrac{\partial E}{\partial a_j^k} $$ while some other references state $$ \delta_j^k = \dfrac{\partial E}{\partia...
I am going through a Machine Learning tutorial, where the problem statement is expressed using Bayes theorem. Particularly, $P(y|Data) = \frac{P(Data|y) P(y)}{\int P(Data)}$ The data part is particularly confusing to me as is meant to be a normalizing constant, however, it does not depend on $y$ from the above definiti...
I'm currently working on a mobile app that offers premium subscription plans. I'm interested in testing whether increasing the price of the subscription might result in a significant increase in revenue even though the number of subscriptions might drop. I have data on the number of subscriptions and revenue for two ra...
I am analysing HR data where event is leaving (so right-censored and many more survivors than not). My Kaplan-Meier survival curves all look like this (and many of them wilder, so Cox is not an option): data("Melanoma") fit <- survfit(Surv(time, ulcer) ~ status, data = Melanoma) ggsurvplot(fit) I am aware from the lit...
I've recently started an introductory machine learning course and the first topic we have covered is prinicpal component analysis (PCA) and overall I am finding the whole topic quite tricky to wrap my head around. I understand that the goal is to reduce the dimensionality of the data, but how we interpret results has m...
I am using OLS on log(outcome) to predict future outcomes.  My question is which method of correction to backtransformed predictions will least bias the modeled effect of change in predictor values.   I know that transforming outcomes is fraught.  An answer of “don’t transform” or “don’t use OLS” is often or even usual...
From Causal Inference In Statistics, A Primer by Judea Pearl, I learnt that for linear SCMs (Structural Causal Model), the arrow strengths can be related to the appropriate linear regression coefficients. For example, in SCM - $Z:=U_1$ $X:=aZ+U_2$ $Y:=bX+cZ+U_3$, where $U_1,U_2,U_3$ are assumed to be independent of eac...
If we have two variables, $X$ and $M$, which follow a multivariate normal distribution, have a mean of 0, are correlated ($r_{XM}$), and have known reliabilities ($\rho_X$ and $\rho_M$), then the reliability of the interaction term $XM$ ($XM = X * M$) is: $\rho_{XM} = \frac{\rho_X*\rho_M + r_{XM}^2 }{1 +r_{XM}^2} $ Se...
I have p-values from several tests (k~50) that I'd like to combine. I don't have a model of their correlation structure. They aren't independent. In the worst-case scenario, my effective sample size might be more more like 15. I'm dealing with marginally significant results (About 10% remain significant after a two-sta...
I have a complicated data set which was made by a multistage stratified cluster design. I had originally analysed this using glm, however now realise that I have to use svyglm. I'm not quite sure about how is best to model the data utilising svyglm. I was wondering if anyone could help shed some light. I am attempting ...
This is a question I have after seeing Q1 of this question. There are a total of 6 people including you and your friend, and you guys are about to sit at a round table. The method of counting the number of sitting positions makes sense to me in this answer, i.e. First there are 6 ways for you to take a seat, 2 ways fo...
I am reading about the bias-variance decomposition from An Introduction to Statistical Learning with Applications in R (Second edition at page 34). It states that $$Y = f(X) + \epsilon$$ where the term $\epsilon$ is random. Does $Y$ vary? It then calculates the expected test MSE at $x_0$ as: $$ E (y_0 - \hat{f}(x_0))^2...
I would like to simulate a structural equation model in R and fixing the mean and standard deviation for each variable. I attempted to perform a simulation in Onyx, but I can't fix this parameters My model should include: Three endogenous variables Four latent variables Eight exogenous variables (two for each latent va...
I would like to use the cube root transform on data in order to preserve the sign of the original data and 0 values. The data are percent differences between control and treatment groups, (treatment - control)/control left in decimal form. I wondered how the cube root transform would affect fractional values. If I ha...
In this answer is shown that the variance of the sample variance is $$ \text{Var}(S^2) = \frac{1}{n} \left(\mu_4 - \frac{n-3}{n-1}\sigma^4\right) $$ where $\mu_4$ is the fourth central moment, ie $E[(X-\mu)^4]$. My question is, what prevents the variance from being negative? As far as I know, it can happen that $\mu_4 ...
Let’s say I want to measure the correlation between two variables, both measured on a ratio scale. Let’s say however that the relationship between the variables isn’t linear (so I can’t calculate Pearson’s r because one of the assumptions is linearity). Let’s also say that the relationship between the variables isn’t m...
I'm having a lot of issues trying to derive an equation for the relative error in the following problem. Someone has used the following incorrect formula to perform Neyman allocation $n_{h,e}=n\frac{W_hS_{U_h}^2}{\sum_{h=1}^{H}W_hS_{U_h}^2}$ instead of the correct formula given by $n_{h,o}=n\frac{W_hS_{U_h}}{\sum_{h=1}...
In Bayesian inference, the gamma distribution is the conjugate prior to many likelihood distributions: Poisson, exponential, normal (with known mean), etc. The update rule seems to always add to $\alpha$ and $\beta$. For example, if: $$ X \sim \Gamma(\alpha, \beta)\\ Y\sim Poisson(X) $$ then $$ X|Y \sim \Gamma(\alpha +...
I want to measure the associations between a number of variables and all of them are measured on a ratio scale. If I am to run Spearman's correlation, can I just run it on the variables as is? Or do I have to rank them first? So to give a simplistic example, if variable 1 is IQ score (subject 1 has a 100, subject 2 has...
It is often the case that the predictors are variables that take continuous or categorical values in machine learning. However, if the predictors or some of them are vectors, how can we deal with it? Take interpolation in traditional practices for an example, we use the neighbors to predict the values at the center loc...
I have a question about correlations. Let's say I want to measure the associations between a number of variables and all of them are measured on a ratio scale. I know I can use Pearson's $r$ correlation to do this, assuming the assumptions to run Pearson's correlation are met (i.e., normality, linearity, no outliers, h...