instruction
stringlengths
9
38.7k
There seems to be a lot of confusion in the comparison of using glmnet within caret to search for an optimal lambda and using cv.glmnet to do the same task. Many questions were posed, e.g.: Classification model train.glmnet vs. cv.glmnet? What is the proper way to use glmnet with caret? Cross-validating `glmnet` using ...
My question arises after reading this link, which presents 7 methods of regression, we know that each of these methods is determined by a loss function, my question is What is the intuition behind these loss functions? I arrived at that link since in my study I am trying to find a loss function that is concave with res...
The question could also be: "estimating the true ability of each player", though I think that already implies some assumptions. In this paper I saw some references to Rankade and TrueSkill used by Microsoft, but I couldn't find any simple implementation for my relatively simple case. Let's say there are 5 total players...
I have a question regarding the task of my term paper case study, which is about Bayesian multilevel modelling and I would greatly appreciate it, if you could help me out. The exact assignment reads as follows: Estimate Bayesian random-intercept-random-slope hierarchical models using an R package and a sampling eng...
I have a data set that is highly negatively skewed. I first used OLS to probe the data set and I noticed that regressing (y = bX + e | y > 0) and (y = bX + e | y < 0) gives very different results, where some of the coefficients in b have opposite signs depending on whether y > 0 or y < 0. So I suspect there is non-line...
I'm in a bit of a quandry with a logistic model I'm working on. As one of the explanatory variables, I want to include "Days since last visit" (or some transformation of it), however about 20% of the population I'm predicting for has never made a visit so their value for this would be Null. Options I'm aware of: Setti...
In Goodfellow et al.'s Deep Learning, the authors write, "rectified linear units use the activation function $g(z) = \max\{0,z\}$... The gradients are not only large but consistent" (187). What does it mean for a gradient to be consistent? I always understood consistency to mean that for an estimator of a parameter, th...
I have a specific question about an important point made in [http://arxiv.org/pdf/1507.06173.pdf, Sec. 4]. To summarize, let's consider a signal model $\overrightarrow{R} \sim p(\overrightarrow{R} \vert t)$, where $\overrightarrow{R} \in \mathbb{R}^n$ collects some noisy sensor measurements and is modeled as a multivar...
Suppose that $W$ follows the Wishart distribution with parameter $\Sigma$ and d.f. $n$. Then, I would like to know the result of the following expectations. $E[tr(WAWB)tr(WC)]$ $E[tr(WAWB)tr(WCWD)]$ where $A,B,C,D$ are fixed matrices. Are there any books or papers that derive this result?
I understand that logistic regression has no analytical solution, but I was investigating the marginal effect in a simple logistic regression and followed this train of thought to the final line. Here it seems we have an analytical solution for $\beta$, so I must have done something wrong?
I have a set $A$ that consists of 5 million objects. Each object has a color, size and cost. I'd like to do a cluster analysis, e.g. K-means, on cost. However, it is computationally not feasible to use all 5 million objects to do the analysis. I have 2 options: Option 1: Someone else performed a stratified random samp...
I'm running LDA topic modelling on my corpus. In this corpus, there are numbers of documents with exactly the same content, and it is just one word. I understand each document could assign to different topics in different probability. But I think, in theory, if the content are the same for two documents, they should be...
I've been reading the Introduction to Statistical Learning and Elements of Statistical Learning by the Stanford professors Hastie and Robert Tibshirani and I've been trying to derive the discriminating function knowing the posterior for LDA, assuming common covariance matrix, p=1 and Gaussian distribution. . If our ass...
I am trying to run a regression, taking StudentMarks as the dependent variable and regressing this on the following variables: Nomadic/Semi Nomadic: if the Child lives in a nomadic family then performance would be affected And, likewise more qualitative variables like Caste , Religion, Traditional Family Occupation ,...
Here is a GRE verbal question : The company at which Mark is employed has 80 employees, each of whom has a different salary. Mark’s salary of $43,700 is the second-highest salary in the first quartile of the 80 salaries. If the company were to hire 8 new employees at salaries that are less than the lowest of the 80 sal...
I'm looking for the best way to analyze and visualize a simple dataset. One way is by contrasting CDFs, as in the figure below: Imagine that you have children of different age, and their height. Currently, children older than 10 years are placed into one group (green), and their height is plotted by the CDF; the other ...
The Wikipedia article on moments states that "The higher the moment, the harder it is to estimate, in the sense that larger samples are required in order to obtain estimates of similar quality". Why is this so? And what does "quality" mean here?
In Adaboost, each sample is given a weight and the machine learning model will be trained with these weights. I want to use logistic regression model in Adaboost, but how can i use these weights in logistic regression? I mean the classic logistic regression model do not use the weight of sample, how can I change the mo...
Since precision and recall are trade-off to each other. It seems to me all PR curves should be strictly decreasing (assuming (0,0) at bottom left). However, sometimes I do see PR curves (like following fig) that are not decreasing. Why would that be possible?
I am conducting an analysis of pharmacokinetics data in which I have plasma concentration of drug for different dosage groups. In this way, the area under the concentration-dose curve is computed as $$ AUC=\sum[({\bar c}_i + {\bar c}_{i+1})\times(d_{i+1}-d_i)/2] $$ In which ${\bar c}_i$ and $d_i$ are the mean plasma c...
I have two sets of data: first one is independently observed while the second one is combination of 7 variables. I am trying to assign weights (or betas if this is considered as a multiple regression) and then use Excel's Solver function to reduce the sum of squared differences between the first set of observations and...
I think linear model is such as linear regression, logistic regression (including one with polynomial features), SVM (including one with kernel). I think non-linear model is such as decision tree, random forest, neural network, kNN. Why do we need non-linear model, though we can deal with non-linear separable problem, ...
I am getting started with NLP and Sentiment Analysis. I would like to train a model with Scikit-Learn for detecting the sentiment of tweets. I have a labeled dataset of tweets, how should I train a model (can I have some sample code with a Bayes classifier?) df = pd.read_csv('Trainded Dataset - Sentiment.csv', error_ba...
I am training a SVM and apply the sklearn learning_curve function on order to get the training and testing error curves. However, although the testing error is decreasing finely, the training error is not growing, as it would be expected to do. My dataset contains around 25,000 samples, distributed in 9 classes and the...
The Mean Absolute Percentage Error (mape) is a common accuracy or error measure for time series or other predictions, $$ \text{MAPE} = \frac{100}{n}\sum_{t=1}^n\frac{|A_t-F_t|}{A_t}\%,$$ where $A_t$ are actuals and $F_t$ corresponding forecasts or predictions. The MAPE is a percentage, so we can easily compare it betwe...
Can someone explain how to apply an Hidden markov model on a stock dataset which has many rows and columns. I am new to HMM but have been going through it for a week. Here is a snapshot of dataset: quarter stock date open high low close volume 1 AA 1/7/2011 $15.82 $16.72 $15.78 $16.42 239655616 1 A...
I plot Score (y variable) against Year (x variable) and I want to be able to show that there is an increase in the score as the year increases. The scatter plot indeed indicates this but I would like to get a p-value for this by way of an appropriate hypothesis test on this slope. I believe that a linear regression t T...
I have a multilabel classification on audio files and I'm troubled about the architecture. First of all, I would like my model to output the probabilities of each label which in my case are all independent (don't need to sum up to 1). So I have constructed a CNN that consists of : 3 convolutional layers 1 fully co...
The title is the question. I am told that ratios and inverses of random variables often are problematic. What is meant is that expectation often do not exist. Is there a simple, general explication of that?
I have run a 3-way ANOVA and the interaction between two of the factors looks significant when plotted (i.e. the two lines cross). However the p-value is 1. Should I be worried about this? In particular: Is a p-value of 1 in a 3-way ANOVA weird? If the lines cross in a plot of a 2-way interaction, does this mean that ...
I'm trying to perform binary classification on a data (80 sample data points, 39542 predictor dimensions). The data contain 2 classes, one in 18 samples and the other one in 62 samples. I split my data into training, validation, and test samples, but each time I run the classifier it gets a different result, e.g., 0.87...
I have a set of probability distributions. I am also going to be sampling some data and I would like to determine which distribution the data fits to best. But there are some caveats: The probability distributions are beliefs moreso than probability distributions. I will have very small samples. This means that I wou...
I have 2 algorithms, A and B, and 9 data-sets. I ran both algorithms on the data-sets and got 9 pair of results. I have to prove that algorithm A is better than algorithm B by comparing the results. I used Wilcoxon rank sum test to prove it. I used scipy ranksums function. Following is the python code I used: from sc...
I have regression equation of the form: M=a+b*log⁡(SRL) where a and b are derived constants. I would like to plot error bars around the regression line, like so: How do I calculate the error lines? I have the standard errors for the constants a and b; do I simply calculate M using +/- 1 standard error?
I have two models. The variable x is the same for both models (time). The dependent variable (y) is a measure taken in one model with the left hand and in other model with the right hand. I want to know if they are significantly different from each other. I searched but I think I can't use ANOVA() right? I don't know h...
Imagine the following dataset: First 4 columns are predictor variables and the engine running index is the response variable. O2 level | Cylinder pressure | Fuel Flow | Engine temp | Engine running index 5 15 3 31 7 2 31 18 ...
I have one or more batches. For each batch I know the size of the biggest item in the batch, and I also know the size of the smallest item in the batch. What would be the best way to estimate the standard deviation of the sizes of the items? The two variations on this are: a) where I know the size of each batch (which ...
What is the purpose of the square root in Cohen's w, a measure of effect size used when analysing contingency tables? Here is the formula: $w = \sqrt{\sum_{\text{cells}} \frac{(\text{obs. rel. freq.}-\text{exp. rel. freq.})^2}{\text{exp. rel. freq.}}}$
So, I have some data from video game playtests, where players were allowed to play a game at home for a week, and were asked to fill out a daily survey. In particular, they were asked to rate a number of things on a 5-point Likert scale, such as how much fun they had that day, and how difficult they found the game tha...
I am having a list of unevenly spaced data points - just occurrences, no values - and want to split them into intervals grouping occurrences, which are close together like so: Currently I am utilizing a fairly simple approach and iterate over the ordered list of time stamps evaluating the distance to the next time sta...
I'm new to bootstrap and I would need an explanation about resampling techniques for comparing two populations. Suppose we have two samples, of respective sample sizes $n_1$ and $n_2$. The total number of individuals is $n = n_1 + n_2$. We want to use a bootstrap/resampling technique to compare a given statistic (say, ...
I am trying to locate information which discusses any of the technical implications of training an ANN against a data set where the number of outputs is larger (in my case 2x) than the number of inputs. I am having a very difficult time finding anything. Though I am not completely convinced that it should exist. My on...
In Goodfellow et al.'s Deep Learning, the authors write, "the universal approximation theorem means that regardless of what we are trying to learn, we know that a large MLP will be able to represent this function. We are not guaranteed, however, that the training algorithm will be able to learn that function" (193). Wh...
I'm using ANOVA F-Value from Scikit-learn (link) to find importance of features in a machine learning task. I have numeric feature and binary classification. I'm also filtering the features whose p-value is > 0.05, but I don't know what value for the ANOVA F-Value is good enough?
Suppose I'm trying to figure out the relationship between home-ownership and wine drinking. My information on where home-owners live comes from the census, and it divides a given geographical area up into zones like this: This (made up) data is organized like this: Census Zone | Home-ownership rate ____________|____...
I understand that the Markov Chain generated by the Metropolis-Hastings algorithm satisfies the detailed balance condition, thus implying that the chain has a stationary distribution, $\pi(.)$, say. However, I'm not sure how we can then apply the ergodic theorem to this Markov Chain? The ergodic theorem states that th...
Correlation does not imply causation, but causation causes correlation. By correlation I do not mean exclusively linear correlation, it could be arbitrarily shaped, as long as it is consistent and reflects dependency. Does correlation correlate with causation? At first I thought: "Yes, because every causation implies c...
I am using re-sampling methods to address the imbalance between classes for my binary classification problem. I am not sure how to measure the performance of my model on the test set: should I re-sample the test set to have an idea how my model is performing on the test set compared to the training set? or should I me...
I'm calculating the fits of Brownian motion and Ornstein-Uhlenbeck models to data, given a phylogeny. However, when deriving the likelihood functions, it appears that the Ornstein-Uhlenbeck model is identical to the Brownian motion model except the variance-covariance matrix is scaled by sigma2/(2*alpha) rather than s...
I'm working on a customer churn model. Currently i have a variable for increased returns (1/0). After i run the model and convert the coefficient to and odds ratio, then convert that to probability; I wind up with 70%. (Churn =1, Not Churn = 0) My question is can i use the inverse of this probability to say that a cust...
I want to get the variance-covariance matrix manually, then take it's diagonal elements to derive coefficient standard errors, according to: sqrt(diag(vcov(lm_obj))) My code: dummy_data <- data.frame( x1 = rnorm(100, 0, 1), x2 = rnorm(100, 0, 1), y = round(runif(100, 0, 1), 0) ) dummy_glm <- lm(y ~ x...
(I'm not sure I am on the correct site, if not do not hesitate to move this question.) I'm currently reading the following paper: Evasion Attacks Against Machine Learning at Test Time and I'm not sure to understand how they apply their gradient descent on the PDF files. But first, a bit of context. The aim is to dete...
I am trying to determine if 3 stock indices are cointegrated. After running the cointegration test it fails to reject no cointegration. I have used AIC to determine the appropiate number of lags, but at different lags I get some cointegration. What would be the next step? I know that VECM is used only for cointegratin...
I want to do a difference-in-difference study of a prevalence estimate (binary data), but am struggling to find guidance on an appropriate power analysis/sample size calculation procedure. The goal is to calculate the sample size necessary for an 7 percentage-point reduction in the adverse outcome in an intervention ar...
I am writing a software to help me train my speedcubing skills (specifically I want to execute 800 different sequences of moves fast) and there is one subproblem I am struggling with: What kind of probability distribution can I use to model my times to execute a given fixed sequence of moves? It doesn't have to be perf...
Please consider the snippet below out of Bishop's book on PRML. I am trying to figure out how to show the equality between: the RHS of eq (3.63) on the first line & the LHS of eq. (3.63) on the second line According to the book, this step makes use of eq (3.49). I included these equations below for your convenience....
I'm running a multiple linear regression on 2 years of daily sales data. When running against the daily data, I get a correlation of 84%, but when summarized to weekly totals, the correlation over the same period drops to 68% with the same underlying inputs/output. How/why would this be? Further, hold-out testing shows...
Let $x,y$ be sampled from a bivariate distribution $\mathcal{D}$ with zero covariance / no correlation. Let $r(x,y)$ be the Pearson correlation between $x$ and $y$. Let $H_0$ be that there is no association between $x$ and $y$ and let $H_1$ be that there is. I calculate the p-value using a permutation test as follows: ...
I'm trying to evaluate a binary classifier on imbalanced data but have trouble coming up with a metric that emphasizes on correct classification of minority class. (I have already looked at Cohen's Kappa and ROC) Accordingly, I was wondering if the following can be a valid approach: To me, the following emphasizes on t...
I have an idea for working with geospatial rasters to predict housing prices. I have done this before using mulitivariate linear regression. I would like to try using a convolutional neural network. I have a series of rasters that represent a surface of interpolated housing prices over time. The convolutional neura...
Assume the true (cross-section) regression model is $$ Y_i = \alpha + \alpha_mD_m + \beta X_i + \beta_m X_iD_m + \epsilon_i $$ where $D_m$ is a dummy for gender (equal to 1 if individual is a male). Assume I have a random sample of the above population, of size $n$. Now, instead of estimating the above, I estimate sepa...
In every instance of A and B (A and B always occur when either occurs), A always comes before B. In such cases, it can be inferred that A causes (predicts) B. Does a single instance of B coming before A discredit this? Consider the alleged theoretical reason against information traveling faster than the speed of light...
I would have a question regarding the estimates of the random effects for a model fitted with JAGS. I want to fit a mixed model of the form: $$y_{ij}=\beta_{0j}+\beta_{1j}x_{ij}+\beta_2+e_{ij}$$ $$\beta_{0j}=\beta_0+u_{oj}$$ $$\beta_{1j}=\beta_1+u_{1j}$$ to a multilevel dataset. The depedent variable represents the ...
I have just started learning about machine learning, and I started reading about handwriting recognition. Apparently (please correct me if I am utterly wrong), handwriting is treated as a classification problem. It makes sense because you are assigning a certain value depending on other factors (e.g. two vertical lines...
I am working on revising a manuscript where the analysis being used is multinomial logistic models. Based on suggestions from the editorial board and my reading of the literature, it would appear that an appropriate measure of goodness of fit for logistic regressions is Tjur’s Coefficient of Discrimination. Yet, since...
I have signals of a time series of length 50. I want to give a try to a PCA like method for classification extracting features from the signal. I am considering several summary descriptors (e.g, mean, var, range, ...). This work well for some of the categories but I still have a strong overalap. I would also like to ex...
Suppose I have multi-dimensional datasets, which have many vectors as data. I am writing an algorithm which needs to do k nearest neighbour searches for all those vectors - classical KNN. However, during my algorithm I add new vectors to the overall dataset and need to include those new vectors into my KNN search. I wa...
How to statistically compare two time series? After reading the above responses, I realized that what I should be doing for my data is exactly what https://stats.stackexchange.com/users/3382/irishstat recommended. However, I am having trouble determining the correct parameters for the arima(p,d,q) function in r. Could...
I've tried searching for a general method for calculating a weighted average with multiple weight variables, but no luck so far (almost all search results are related to Excel implementation and I don't know Excel formulae). Let's say I have a vector $X = (x_1, x_2, ..., x_n)$ and two weight vectors $U = (u_1, u_2, ......
I am looking into neural networks and had a conceptual question about time series forecasting. Let's say I have hourly temperature measurements at a given location several for several month. My goal would be to forecast, from a time t, the expected temperature for the next k hours. Which of the following architectures ...
I was looking at sklearn gridsearchcv but i see no gridsearch for GaussianNB. I am very beginner in this field. Edit: Gaussian Naive Bayes may not have any hyperparameters but I know Bernoulli Naive Bayes has the hyperparameter of alpha. Can we potentially do grid search with this?
I'm a software engineer with a weak background in probability and statistics. I want to determine whether the position and color of the "Purchase" buttons affects my conversion rate. I want to create a test with a control and 3 variants. The control is the original checkout page. Variant 1 changes the button's color bu...
I have composited Likert scales from many items for some employee motivation variables. what is the most suitable way to build the scale from discrete Likert items? is it using the mean or the median? I need to study the correlation between motivation and burnout Likert scales or variables. what is the most suitable co...
Imagine that there are $N$ balls in a box, among which $m$ are white and $N-m$ are black. If one blindly picks a ball in the box, the probability that the ball is white is simply: $$p_w = \frac{m}{N}$$ Now, Imagine that $m$ is not a constant, but the outcome of some random process; as a consequence, $p_w$ becomes a ran...
Sorry if this is obvious but I haven't been able to find it anywhere else. I'm using xgboost's importance() function to generate a matrix of information about the variables in a multinomial classification model. I know the "Gain" column indicates roughly how much each variable contributed to the model's predictions. Bu...
I am training a model using random forest in Python. The dataset is about 5 million entries with ~60 numerical features, and my target is to do a classification among 30 different groups. When I apply the model to the data I used for training, it gives almost perfect prediction. That makes me feel like I am overfitting...
In statistics, how do you know if your count data is over dispersed after applying a glm, family =poisson to the data. I have 24 results in total, 12 with treatment, 12 without. There are 3 species, for each species 4 are with treatment and 4 without. So 8 results for each species, totaling 24 results. Is there a stand...
Pretty straightforward question. Does it check every feature and pick the one that maximizes some split-quality metric (like a decision tree), or does it just select a feature at random (like a random forest)?
My question is related to the answer in this post. The definition of the Gaussian copula is easy to understand and the simulation algorithm as well, but I do not see how does the two relate. My question is why does the following algorithm (where $P$ is a correlation matrix) Perform a Cholesky decomposition of $P$, an...
Does anyone know where I can find particle filtering code for R? In particular I'm looking for code for filtering a forward-rate curve.
Can anybody tell me the differences between those quantities. As I know, p-value is the minimum level of significance for a test to reject the null hypothesis with the observed data. level of significane is a number that is greater than or equal to the power function of the test among all possible values of the parame...
SVM is actually a single layer neural network, with identity activation and squared regularized hinge loss, and can be optimized with gradients. In addition, squared regularized hinge loss can be transformed into dual form to induce kernel and find the support vector. Compared with softmax+cross entropy, squared regul...
Stats newbie here. Is there any meaning to the critical F value if the two samples have the same degrees of freedom? For example, I have 2 sets of data, each with the same number of degrees of freedom. If I calculate the chi-square value for each data set, then the F-test is defined as: $$F(\nu_1,\nu_2) = \frac{\chi_1/...
I am counting the proportion of seeds that have germinated (RV) in petri dishes. 5 petri dishes each had 25 seeds in them. Treatment (EV) was applied. No seeds germinated. When this is put through the glm binomial in R, the P value, instead of indicating that it is significant, indicates that it is not. Other treatment...
From the paper by Ioffe, it is mentioned batch norm's benefit is that it is able to fix the distribution of the layers' input, which allow the layers to learn the same representation rather than having to constantly compensate their learning due to a varying distributions. However, as this could potentially misrepresen...
I am doing FAVAR analysis with two-step principal component method. I have estimated VAR including factors obtained using principal component analysis and assumption that variables can be divided to slow- and fast-moving variables. I can draw the impulse response functions for my factors but my problem is that I do not...
Is there a general framework for recognition and representation of states in markov decision process? Let's say, I want to train an agent to play tic-tac-toe and I use simple Q-learning and $\epsilon$-greedy policy to find the optimal Q-function. I would proceed like this: Let $\mathbb{S}$ be a set of all possible...
I am struggling with figuring out whether the variable "Education in years" should be used as an ordinal variable or as a continuous variable, or would either work? I haven't coded the data myself. What I would like to do with the 'education' variable is to run a linear regression with it as a dependent variable. My i...
I'm doing a mobile customer segmentation and I was using K-means to cluster my data according to the various data points (location, time of use, duration used for etc). After reading a lot of posts in the last couple of days on CV, I know these clusters are more of a pattern discovery to be combined with business acume...
I am interested in finding the mean and standard deviation of the whole distribution by looking only at a random sample. I don't know anything else about the distribution (for example I don't know if the distribution is normal or not). Is what I'm asking even possible?
I have prior information about the outcomes of tossing different coins in the form of "$a_i$ heads and $b_i$ tails" records. I do not have the true probabilities/ratios, but for some records the number of tosses is high, so the ratios are quite localized in those cases. I see that coins seem to have different probabili...
Imagine you are trying to explain the purpose of f1, precision and recall to a person? How would you proceed on why do we need such measures instead of simply computing incorrect / correct ratio? I tried traditional explanation with false/true positives/negatives but failed because the person brought up the following e...
Quick question, what is the distribution of a q-matrix in standard q learning? As a q-matrix, lets assume a 2x2 matrix with states 1 and 2, and actions A and B. And lets further assume that In state 1, the values in the matrix are 15 and 20 for actions A and B respectively, and in state 2, the values in the matrix are ...
When used as an activation function in deep neural networks The ReLU function outperforms other non-linear functions like tanh or sigmoid . In my understanding the whole purpose of an activation function is to let the weighted inputs to a neuron interact non-linearly. For example, when using $sin(z)$ as the activation,...
I want to update a bias in my Neural Network using the gradient descent optimization algorithm. Unfortunately, the bias has different dimensions than the derivative of the loss function with respect to the bias. For example, the bias in the first hidden layer has dimensions 1 x hidden_size and the delta error (i.e. the...
I am attempting to discover through surveying something about the population of beer drinkers in a country. I carry out a nationally representative survey asking questions about awareness of beer and knowledge. I then ask the same questions at a one-week course on everything to do with beer and also beermaking. I ask t...
I have been trying to get a better understanding of momentum, but in my search for clarification I got pretty confused. The main reason is that there seem to be multiple different, non-equivalent formulations. Lets consider the example of gradient descent of some objective $J(\theta)$ with step size $\eta$ and momentum...
Is it possible to create a neural network that has a matrix as its output instead of a vector? Or do I have to vectorize the matrix, i.e. make make one long vector instead of a matrix.
Suppose I fit a quantile regression model with BMI as a response and gender as a predictor. Now, How can I interpret the estimated coefficient for gender. Note that :gender 1=male , 0=female.
I cannot wrap my head around what does it mean that the OLS estimators are being normally distributed.