instruction
stringlengths
9
38.7k
We have many good discussions about perfect separation in logistic regression. Such as, Logistic regression in R resulted in perfect separation (Hauck-Donner phenomenon). Now what? and Logistic regression model does not converge . I personally still feel it is not intuitive for why it will be a problem and why adding ...
(Suggestions for tags welcome, could only think of r tag and predictive-models tag) Here is a variable from my data: > table(processed_train$cat89) A B C D E F G H I 183744 4312 220 33 5 0 1 1 2 I split my data into test and train, creat...
My question is: is it possible to use HMM when the number of latent states ($S_i \mid i = 1..N$) is more than the number of emission symbols ($Y_j \mid j = 1..K$), i.e., $N > K$.
I use Python to run a RandomForestRegressor on my dataset. It usually happened that every set of result (estimators, feature importance, ROC score, accuracy score etc.) from a single run is different from others. Let's set apart the issue of parameter tuning, how can I get the convinced outcome from various running out...
I'm learning about the Empirical Cumulative Distribution Function. But I still don't understand Why is it called 'Empirical'? Is there any difference between Empirical CDF and CDF?
After implementing random forest (with randomForest package in R) with satisfactory results, I'm trying now to make a rolling version that updates at a preset frequency. So far I tried with the following approaches : use a 1 or 2 year rolling window to fit the random forest and predict over the following month use a...
Consider a model for a quantity $y = f(\mathbf{x})$, where $\mathbf{x}$ is a vector of covariates, and $f$ is some smooth and continuous function. Let $\ell(\mathbf{x})$ denote the loss function for predictions $\hat{y}$ made using this model. Let's say that my function $f$ depends on a new covariate $x_m$, constructed...
I have two groups (36 patients and 30 controls) and I want to check five or six normally distributed (as I checked using skewness and kurtosis values) variables (numeric) that discriminate between the two groups. Which is the best method to analyze my data? Should I perform a logistic regression or a discriminant analy...
In autoencoders when using tied weights, it was mentioned the gradient with respect to w is the sum of two weights. I didn't understand this, can someone elucidate this. it is mentioned here on slide 4 in the end.
Is there a formula that can help me categorically define if a variable is leading or lagging other than knowing any background of the data aside from the data itself? In economy, there are well known lead and lag indicators which requires one's knowledge of the economy beforehand. There are known tests, granger causali...
How to interpret Pr(>|t|) of factor variables? The reason asking is the following: summary(lm(dta$X.U.FEFF..mpist. ~ dta$matem + dta$aidink + dta$sukup)) gives Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 253.630 12.763 19.873 < 2e-16 *** dta$matem 20.247 1.6...
Having graduated in econometrics I am now working as a Data Science Consultant. I would like to gain a deeper knowledge of (theory of) inferential statistics. Is there any recommendable online course/book/slide material in this area. I would like to gain a deeper understanding of concepts like: Cramer-Rao Lower Bound ...
I am trying to construct a covariance matrix between a set of demands $t \in T$. The only information I have of the demands are the mean and the standard deviation. I intend to apply Cholesky Decomposition to this covariance matrix and the resulting values shall then be used in an optimisation problem related to Gamma-...
I have a situation where an indicator pathway has a factor loading that is exactly 1.00 (in the AMOS output the estimate is .998). The model converges, is positively defined and has a decent model fit (χ2 382.864, df: 99, CFI: .935, TLI: .911, RMSEA: .059). Overall, there are five factors in the model, which are all t...
I am developing a set of medical diagnostic procedures that will be assessed using binary categorical variables. I want to assess the relative importance of these criteria. So that we can focus our treatments on those that have the highest level of impact on the patients overall health. Mock Example of Our Data This i...
I want to find the principal direction in a set of spatial coordinates (i.e. in a 2D table). To do so I'm using PCA implemented in prcomp (because it allows missing values). prcomp returns a 'rotation' matrix which is said to be the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors). ...
I am a student who is performing a meta-analysis and want to select the best regression model (in terms of AICc values) that explain what are the explanatory variables that can explain better the negative impacts of nitrogen fertilization on plant biodiversity. The idea then is to always keep nitrogen amounts as explan...
I am working on thousands of datasets. Many of them are "unbalanced"; either a multi-class list with highly skewed distribution (For example, three categories with the ratio of 3500:300:4 samples) or a continuous number with skewed distribution. I am looking for some metric that can say "How badly unbalanced" the datas...
Let me be very specific.This is how the dataset looks like- For example, for a 6 years period, Number of students staying in a college: 45,85,44,952,7955,1522. Number of students leaving the college: 1000,86,49,30000,745,5699 Method I am using: for any pair,if (leaving/staying)*100 is above X%, then I will consider tha...
I think I understand likelihood, and also log-likelihood as well. After reading about log-likelihood in various sources, I thought that the purpose of taking the logarithm of likelihood was all about computational convenience since adding up too small values is easier than multiplying them. However, my instructor clai...
Let an observed $2 \times 3$ contingency table be $$ \begin{array}{c|ccc|c} v_1 \backslash v_2 & 0 & 1 & 2 & \\ \hline 0 & m_0 & m_1 & m_2 & m \\ 1 & ? & ? & ? & n \\ ...
I was watching a youtube tutorial that looked at logistic regression. To illustrate this they showed a graph that plotted p on the y-axis, where they used the inverse of logit(p). Can anyone help me understand the algebra behind how they got from logit to inverse logit as below? Finding it quite frustrating to just see...
I'm in materials science. I have a fractional factorial experiment. I am investigating the main effect of various treatments on a measured response. The exact details are probably not needed to understand my question so I will simplify things in order to frame my question a more straight forward way (I have 7 factors,...
I am performing nonlinear analysis in ABAQUS software, with 5 input variables. For each realization of the input vector, I run the code and I get a scalar response value. I am using the Monte Carlo method to generate a sample for the input vector. I generated a Monte Carlo sample of size $N=500000$ for the input vector...
I came across the following graph in a report where the authors report the results of a Monte Carlo simulation study in terms of proportions. I have never seen such kind of plots before. Does anyone know the name of this type of plots?
Let's just say that the 4 items making one construct are not well correlating (for whatever reason) and their Cronbach is 0.62 despite loading into 1 factor. Is there an alternative way to proceed? Can I skip Cronbach/validity issues/factor analysis by just summing all 4 items and then getting their mean by dividing th...
Suppose that $\{X_t\}$ is a weakly stationary time series with mean $\mu = 0$ and a covariance function $\gamma(h)$, $h \geq 0$, $\mathrm{E}[X_t] = \mu = 0$ and $\gamma(h)= \operatorname{Cov}\left(X_t, X_{t + h}\right) = \mathrm{E}\left[X_tX_{t + h}\right]$ Show that: $$ \operatorname{Var}\left( \frac{X_1 + X_2 +\ldots...
Got a dataset of 63 observations of 900 variables. The Variable data is arranged as 63x900. I'm trying to build a prediction model based on this dataset. Three methods have been tried: PCR, PLSR, and Random Forest Regression. PCA returned a 63x63 matrix, which obviously something happened there which I dont know why. ...
When using repeated cross-validation for evaluation, should I aggregate the results for each cross-validation? When aggregating, a 10-times repeated 10-fold, will provide 10 values for each measure like AUC. (Therefore, k=10 for my t-test with k-1 degrees of freedom when comparing algorithms.) When not-aggregating, a 1...
I have a multivariate normally-distributed random variable: $X \sim \mathcal{N}(\mu, \Sigma)$ And another RV which is a deterministic elementwise function of this variable (producing another random vector of the same dimensionality): $Y=f(X)$ . In my case $f(X) = \max(0, X)$, which truncates negative parts of the distr...
I have a dataset with 26 features and 31000 rows. It is the dataset of 38 subjects. It is for a biometric system. So I want to be able to identify subjects. In order to have a testing set, I know I have to remove some values. So what is it better to do and why? (a) keep 30 subjects as training set and remove 8 subject...
Related to this question, @AlexR gave a perfect answer, but left a non-trivial statement as an ending to the proof. He said that $\forall\epsilon>0 \ ,\ \sum\limits_1^\infty P(|M_n-x^*_F|>\epsilon)<\infty\implies M_n\xrightarrow{a.s.} x^*_F$ I have tried to prove it. Have I gone wrong anywhere or assumed something ...
I've read elsewhere that Alpha is probably a low-bound estimate of realibility if the tau equivalence is violated (which is often is). An alternative was proposed which is the composite reliability. Let's say that my Cronbach Alpha produced a reliability (or internal consistency) of 0.62. However and using factor loadi...
what is the difference in training and testing between the Gaussian and Mixture of Gaussians? Are they the same except one is unimodal and one is multimodal?
I am trying to utilize the classification learner app in Matlab for a set of data for cancerous and noncancerous cells (6 different types of cells). Would bootstrapping the data prior to feeding the data into the app lead to an overfitting of the model since some of the algorithms might already contain a bootstrapping ...
I have run 3000 finite element (deterministic) simulations of a physical model, which has 10 design variables and one output variable. I have generated the sampling plan using the LH method. My question is if the following procedure for building and evaluate a Kriging model is correct: Select a random subset of the in...
What type of statistical test I could apply in order to test if my dataset, which follow a Poisson distribution, contains clustered observations? Here my dataset: df = read.table(text = Year Freq 1975 10 1976 12 1977 9 1978 14 1979 14 1980 11 1981 8 1982 7 1983 10 1984 8 1985 12 ...
We have installed an alarm at home. At burglary it makes noise by 96% certainty, but also on other nights it can make noise at probability of 0.3% due to disturbances. In our neighborhood there is a burglary chance of 3% on any given night in a given home. Tonight the alarm makes noise, how likely is it that there real...
(This is problem from Bruce Hansen's Econometric Lecture notes (2.16). But there's no solution there and I have no one to ask because I am not a student.) The joint density function is given as $(3/2)(x^2+y^2)$ on the support $[0,1]$ ($x,y$ both). I want to calculate best linear predictor for equation $y=a+bx+e$ and co...
Suppose that I have two time series $\{x_1, \ldots,x_t\}$ and $\{y_{1+k}, \ldots,y_t\}$ which have some level of correlation over an overlapping time period. What techniques can I use to decorrelate these two time series? Perhaps multivariate AR models or something of the like?
This is a follow-up to a previous question of mine, explaining the problem in more detail in the hopes of getting more precise advice. Consider the following structured additive regression model or GAM, commonly fit by the mgcv or BayesX packages in R. I will write it a bit differently than usual, to emphasize the stru...
Suppose that I have two features: age and income. I'm told that I need to normalize features before modeling with KNN. What's the difference between scaling to 0 and 1, taking a unit norm, or z score? I've been taught all of these to "normalize" data, but don't know how or why each apply.
I want to compare the mortality rates of 2 groups (control vs treatment). I have binary data (1 = Alive ; 0 = Dead) which gives me a mortality rate (%). What is the best way to compare these 2 groups and see if there is a significant difference between them?
All, R provides information about how it calculates skewness (uses the formula provided by Kirk, 2008). My students are noticing that SPSS provides a different value, for which the formula is unclear. Does anyone know how SPSS calculates skewness and what that might be worse (or better?)?
Is there any test (preferably without assuming any distribution) that can give us a confidence interval on the maximum value of a (small) sample? context: I am trying to get some estimate of upper bound on a parameter which is expensive to evaluate. Also, maximum value of this parameter is much more useful compared to ...
Suppose $\hat{\theta}_1=\int_0^x \frac {dF_n(y)} {1-F_n(y)}$ and $\hat{\theta}_2=\int_0^x \frac {f_n(y)} {1-F_n(y)} dy$ are two estimators of cumulative hazard function, where $f_n(y) =\frac {1} {b}\int k\left(\frac {y-u} {b}\right) dF_n(u)$ is an estimate of the density $f(y)$ by assuming $b\rightarrow 0$ with $bn\rig...
For any classification/recommendation algorithm how should I approach to decide from a given list of features which is the strongest predictor? Is this known as feature engineering? what analysis should one do on the data like plotting graph etc. to determine the good set of features?
I am confused with the term Generalized additive model Basis expansion Boosting If we fit a data with "spline basis", is it a "Generalized additive model"? To me it is just a linear model with different basis, we can do it with polynomial basis or Fourier basis etc. Also there is a notion "additive" in "Generalized ...
The objective of clustering analysis is to group data with similar characteristics in clusters, but in this case, I want to find the most unrelated data to group into clusters. In my particular case, I have 100 weather stations during one year with a 1hr interval, and I want to group the most similar weather stations(I...
I've been looking at charts of probabilities of certain hands occuring in poker and have been trying to work them out myself to see if I get the same answer. I'm having real trouble with having a starting pair and then flopping quads. According to charts, the probability of that happening is 0.25% or 400 to 1. I do not...
I'm conducting an analysis in SPSS looking at the relationship between a categorical independent variable (with three levels) against a continuous dependent variable, but wanting to control for the effects of gender on the dependent variable (categorical covariate). I initially conducted an ANOVA (general linear model>...
I need to calculate the prevalence, bias, positive agreement and negative agreement (or other similar meansure) related to Kappa in a matrix with size 3 x 3. I consulted several papers, but they only calculate it for a 2 x 2 matrix, as below. Confusion Matrix positive agreement = (2*a)/(N+a-d) negative agreement = (...
In SPSS, I find that the Mauchley's test does not provide any result if the sample size is less than the repeated measurement count. I have a sample size of 19 and a repeated measures of 22. My Mauchley test's value results are as 'p=.' (just a dot) and chi square values = '.' (just a dot; no number gets displayed).  I...
Suppose we have $n$ random variables distributed normally with the same mean and different variances. Suppose we know these variances. Which will be the variance of the marginal distribution induced by a finite mixture of $n$ normal distributions with the same mean and different variances?
Is it necessary to account for autocorrelation of data in a predictive model? I ask because it seems that accounting for autocorrelation (temporal or spatial) by means of ACF, PCF, etc. is typically performed to better understand (isolate?) the actual effects (correlation) that an independent variable has on some respo...
I have been working on an assignment where I train upon 3 corpora in 3 separate languages, and then I read in a set of sentences and use a number of models to determine the most likely language for each sentence. That part I have done. (for reference: the models I implemented were a Bigram Letter model, a Laplace smoot...
The objective of clustering analysis is to group data with similar characteristics in clusters, but in this case, I want to find the most unrelated data to group into clusters. In my particular case I have 100 weather stations during one year with a 1hr interval, and I want to group the most similar weather stations(I...
Suppose you have a longitudinal dataset, in which several subjects, sampled independently of each other, were measured at one or more timepoints each. The timepoints need not have equal intervals between them, and different subjects may have been assessed at different timepoints. In general, there are lots of subjects ...
I'd like to develop some intuitions about linear regression and KNN in a regression setting. Let's say I have 6 different datasets below. They all have 1 independent variable X and corresponding real value Y, and let's assume that X values do not overlap in each dataset. Imagine that I separate them into a training se...
I'm a developer and I've being playing around with R association rules to create a recommendation system. My stats understanding is a little basic. So I've created a set of rules with varying levels of confidence and I can use this to make predictions. However what I thought would be interesting would be to design a re...
I have two sets of monthly data that spans over almost 2 years. The subscriber volume, and the customer complaint volume. I'm trying to determine the best way to adjust the changes in complaints volume for the growth in subscribers, so I can compare YoY growth in complaints, without the impact that more subscribers wou...
[A version of this question was previously posted by another user, but the OP deleted rather than edit the question into a more suitable form for routine textbook work. I am reposting in the hope of attracting an answer that was outlined there,] Suppose $X_1 \sim \text{Bernoulli}(p_1),... , X_n \sim \text{Bernoulli}(p_...
So I just asked earlier about how to calculate the probability of a starting pair making quads (four of a kind) on the flop and was informed that it's a hypergeometric distribution and essentially it's just (48C1)/(50C3) = 0.25% or 408 to 1. However, when calculating the probability of a starting pair making three of a...
I am training several classifiers and looking into different ensemble methods on a large dataset (17000 examples and 300+ features). I want to use grid search and cross validation as granularly as possible in terms of parameter options; however running all of this on my laptop is taking forever and severly limits what ...
In my linear-fixed effect model, I have two fixed factors "Fix-1" and "Fix-2", and a random factor "Ran". I think the continuous factor "Cov" may influence the dependent, and this influence is mainly works on "Fix-1". Now my R code of this model is: Dependent ~ Fix-1 * Fix-2 + (1 + Fix-1 + Fix-2|Ran) How can I put the...
This seems rather simple. I know that the expected value of a constant is just the constant. But I feel like I'm missing something. Any help would be appreciated, thanks
I have a per hour data in 1 year for a total of 8,640 observations. These data will be used to model ARIMA and ANN to predict a day-ahead forecast. My question is, is these data enough? or too much?
I read the material on the difference betweeen accuracy and precision, but it makes me feel confused. Can I define accuracy as: \begin{equation} accuracy=\frac{TruePositive+TrueNegative}{TruePositive+TrueNegative+FalsePositive+FlaseNegative} \end{equation} So in machine learning, what is the difference between accuracy...
I'm having a hard time finding the right way to explain to an engineer friend why binary classification isn't quite the same as a statistical hypothesis test. Clearly, in both cases we are choosing between two alternatives using some statistical procedure. Yet the intent, the language, and the methodology are rather ...
Consider the following simple linear model
I am trying to work on a clustering problem where I actually know the sublcass. Suppose I am trying to predict cluster patients a group of people into male and female where I actually know the label male and female but I take it I don't know Suppose my clustering method produces subclasses label 1 and 2. Is there a q...
I want to fit a straight line through a scatter plot of two timeseries to understand the influence sea surface temperatures (x-axis) have on land temperature over a particular region (y-axis). I have calculated the correlation coefficient which isn't particularly strong (0.16), but I also want to fit a straight line th...
The function is given as $f(x)=P(X=x) =\frac{1}{n}$ for $x=1,2,...,n$, and $0$ otherwise. Does this mean $E(X) = \sum_{x=1}^n p_nx_n$ with $\frac{1}{n} + \frac{2}{n} +\frac{3}{n} +...+\frac{n}{n} = 1$.
In Bayes networks it is assumed that directed acyclic graphing makes for simple calculations where there are conditional dependencies between the states. I do not understand what calculations are made easier, would someone please give an example for this? I understand a Markov Net and a Bayes Net can be called a zeroth...
I'm kind of new here, and also not a professional statistics guy, so sorry if the answer is obvious and I'm missing something, but I looked everywhere and couldn't figure it out. I'm doing geometric morphometrics on 52 lithic artifacts. All the artifacts are of the same type but they come from the different sites (site...
The established soft-clustering algorithms like Fuzzy-k-means (Wikipedia), Gustafson-Kessel, Gath-Geva for point wise data or the funclust algorithm in functional data context are random-operating algorithms. The randomness of the initialization is why we get different cluster assignments for the observations at each c...
I once read around here that with binary factors in mixed effects models (lmer specifically), one shouldn't specify both random and fixed effects. The person went on to note that some people wouldn't combine fixed and random even for three- and four-level factors. Unfortunately, I can't recall if the person referred to...
This comes from operations analysis. Often you have measurement of times, such as time between customers arriving at a store (e.g. Starbucks) or time it takes to process an order (e.g. a cappuccino). Say you have two such variables X and Y, with X being time between customer arrival and Y being time required to process...
This is a more theoretical question, perhaps less suiting to the required format of a question on cross validated. Still I hope someone can help or advise me. I'm using r. I have a data frame with roughly 180k observations and 120 variables. When running through a multiple regression model there ends up being ~1000 var...
As far as I know the usual method for estimating the parameters in GMM is EM. However, it is also possible to use maximum likelihood. What are the differences between these two methods? Why would one prefer either of them?
I have (a lot of) datasets with points having 1d distributions like these: Note, that the data is periodic in nature, like time of a day, so left and right sides of the plots above correspond to the same value. Basically I need to detect peaks (= modes?) here (parameters like location and spread are important), togethe...
Starting from Poisson distribution and cluster analysis I am trying to find a statistical/empirical method in order to test if my Index of Dispersion (https://en.wikipedia.org/wiki/Index_of_dispersion) is significant or not. I am not a statistician so please forgive any possible mistake I made on the calculation. Here ...
A standard problem of statistics is to evaluate statistical properties (mean, variance, probability distribution) from a set of numerical observations. However, in some cases instead of having numerical observations we have ranges for the observer number. For example, we know that value is between 1.3 and 3.5, or that ...
For logistic regression to work well we need to convert a non linear feature to a linear feature. how should one determine whether a feature is linear or not? How should one convert a non-linear feature to a linear feature?
I'm trying to estimate macroeconomic VAR model in R using package vars. Since I need to omit simultaneously all coefficients with t-ratio in absolute value less than 1.65, I used package function restrict with adequate restriction matrix. After that, $R^2$ for unemployment equation jumped from 29,2% (in the unrestri...
We have an independent ordinal variable which may or may not explain a dependent binary target. We would like to know if this effect is significant, for example linearly. Doing a logistic regression and testing the parameter for a significant difference from 0 makes sense. Someone proposed to compute the observed proba...
Let $\hat\beta$ be the least squares estimator of $\beta$ in the regression model $y = x \beta + \mu$ where x is an $n \times k$ matrix with rank k and $\mu \tilde ~ N(0, \sigma^2 I)$. 1) Find the non-random matrices $A$ and $B$, such that $\hat\beta$ - $\beta$ can be written in the form $A\mu$ and the sum of the squar...
I have a linear model with 4 independent variables. To confirm that there are not omitted nonlinear variables left out, I ran the RESET test. It turned out that a multiplication by two variables (AB) is highly significant. Therefore I also included it in the model such that there are now 5 independent where one is a ...
I just ran a Cox model with some covariates interacted with survival time to account for violations of the PH assumption. To do that, I needed to create a multi-episode dataset with an observation for each survival time unit per individual in the data (acutally Stata does it automatically when using the tvc() option in...
I am doing a parallel mediation analysis using PROCESS, model 4. If I understood correctly, when doing mediation analysis for model with multiple IV, all IV, apart from the one that is placed as predictor should be treated as covariates? However, what I am interested in, is there any reason why we should not include ...
Context I ran an experiment with a two-factor within-subjects design (factor A with 3 levels (small, medium, large) and factor B two level (open, closed), so 6 test condition). 12 subjects have repeated 5 times each of the six test conditions (so 30 test per subject). I tested for significance using a repeated measures...
I’m using GPower to perform a priori power analysis. Let’s say that I want to do a 2x2 factorial ANOVA. I’m interested in the power of the interaction. I set effect size f to .25, alpha value to .05, power to .80. The degree of freedom of my interaction is 1 and I have 2x2 = 4 groups. GPower calculates that I need 128 ...
I'm working with a stratified sample by minimum variance method with 3 levels that becomes at 1176 stratum. The sample comes from finite population of income taxes data. I'm looking for how calculate the Gini index and Lorenz curve with this data. Any help or guidance, like bibliography, would be appreciated.
There is a command in R to derive the variance-covariance matrix of a glm (model) objects. Does any one know if there is a command which one can derive variance-covariance matrix of a Zero inflated Poisson regression model object?
We have an app, where you post projects and we'll be running A/B test on new version of posting page. How do we ensure that the new version is not worse? We have 14 days of time to decide that. And on average we get 708.73 projects posted in 14 days with standard deviation of 36.16. We could just wait until we see the ...
So I have this data from of 26 predictors and 418 observations which I want to use to predict an outcome that is normally distributed (and continuous). The outcome variable looks like this when compared to the theoretical Gaussian distribution: But for some reason the GLM model I’ve created for it does not predict it ...
It can be derived from here by the triangle inequality that for unimodal distributions, the distance between the mean and the mode satisfies the bound $$\left|\overline{X} - \text{mode}(X) \right| \leq (1 + \sqrt{5})\sqrt{\frac{3}{5}}\sigma.$$ Is it possible to improve upon this bound if we also know the skewness of th...
Does it matter to "goodness of the model" what values are used as references in factor data? The reason for asking is that when using factor data such as in the following post: How to interpret Pr(>|t|) of factor variables? one can adjust the p-values of independent variables of the factor data by changing the referenc...
In this deck about the perceptron, there's a pseudo-code for the batch version on page 12. During each iteration of the inner loop, the dot product $y_ix_i\theta$ is compared to 0, however since the weights ($\theta$) are initialized to $\vec{0}$, and only updated in the outer loop, this product will stay the same thro...
My understanding of Fisher vectors can be described in the following manner: A GMM is trained on all data, which gives $p(X,\theta)$, then, for each image/video ($X_i$), the gradient of $p(X,\theta)$ is computed w.r.t $\theta$, evaluated at $X_i$. This shows how the GMM should be altered to fit $X_i$. I believe this gr...