instruction
stringlengths
9
38.7k
Following up on this question, How would you explain covariance to someone who understands only the mean?, which addresses the issue of explaining covariance to a lay person, brought up a similar question in my mind. How would one explain to a statistics neophyte the difference between covariance and correlation? It se...
There's a lot about collinearity with respect to continuous predictors but not so much that I can find on categorical predictors. I have data of this type illustrated below. The first factor is a genetic variable (allele count), the second factor is a disease category. Clearly the genes precede the disease and are a...
Are there any "good" ways to eliminate the effects of ties in a data set for statistical analysis? For example, in finding the correlation between two series which has lots of ties? I would like to estimate the dependence between two series by a Pearson correlation coefficient and other correlation measures, like Kenda...
Suppose I have some measurement for each subject at each site. Two variables, subject and site, are of interest in terms of computing intraclass correlation (ICC) values. Typically I would use function lmer from R package lme4, and run lmer(measurement ~ 1 + (1 | subject) + (1 | site), mydata) The ICC values can be ob...
Is there a canonical textbook or textbooks on the use of numerical methods in solving stochastic differential equations that you would recommend?
I have a variety of brain regions and information about how they're connected. (Not FMRI in this case, but the diffusion information about the white matter tracts connecting gray matter regions.) I'd like to graph this information sensibly to deliver to the scientist who asked me for this information along with a spre...
I have a large quantity of financial trading systems that I believe are highly duplicative, meaning that I believe a large number of the trading systems are essentially the same thing. I am looking for a way to measure the differences between each of the trading systems. One simple way to do this is correlation of da...
I am familiar with using regression with ARIMA errors to model interrupted time-series, in order to estimate the change in magnitude caused by a policy intervention. These models seem to be designed for a single time series, and thus if multiple time-series are analysed a model must be fit separately for each time-seri...
I collaborate with colleagues in other cities using other operating systems. My colleagues are in the public service and so have limited flexibility to configure their (windows) machines. I want to be able to show them what I'm doing and ideally see what they are doing. How have people tackled this problem? We prese...
I have closed form moment-generating function and characteristic function of a distribution, which describes waiting time of a continuous univariate random process. However, I cannot analytically invert the characteristic function to get PDF. Now, I have run simulations of the original process in order to verify that...
Does it make sense to say that the odds of some risk for a person in group A is $0.4$ times lower that that of someone in group B? Or would it be better to phrase it in "higher than" language?
In my work, we are comparing predicted rankings versus true rankings for some sets of data. Up until recently, we've been using Kendall-Tau alone. A group working on a similar project suggested we try to use the Goodman-Kruskal Gamma instead, and that they preferred it. I was wondering what the differences between the ...
How do you get a confidence interval for an odds ratio between two different groups (both of which are not the reference group) in SAS? Suppose $x_1$ is the reference level and $x_2,x_3,x_4$ are the other variables. Odds ratios in SAS give them for each level compared to the reference (e.g. $x_2$ vs $x_1$, $x_3$ vs $x_...
My understanding of the difference between machine learning/other statistical predictive techniques vs. the kind of statistics that social scientists (e.g., economists) use is that economists seem very interested in understanding the effect of a single or several variables -- both in terms of magnitude and detecting wh...
I want to predict a health problem. I have 3 outcome categories that are ordered: 'normal', 'mild', and 'severe'. I wish to predict this from two predictor variables, a test result (a continuous, interval covariate) and family history with this problem (yes or no). In my sample, the probabilities are 55% (normal), 3...
I will frame this question for Ordinary Least Square (OLS) regression, but my question is for both OLS and Logistic. Let's say we data over 10000 different individuals. For each person we have three variables - $x_1$, $x_2$, $x_3$ and a target variable $y$ which is how much they have spent on the product. Let's say tha...
I just read Finding Seasonal Spreads, by Paul Teetor. As far as I understand how ANOVA works, it should be accurate for NORMAL distributed series. Financial series are not normally distributed, or maybe am I wrong? Could someone explain why he used ANOVA in this case?
I have a dataset containing information about various factors influencing the amount purchased of different products. factors include the number of people who bought it, the degree to which the product was on sale (90 or 80%), the number of times the product was on sale, etc. I would like to see how much such factors i...
I am working on RNA-Seq data (on alternative splicing). Let's say I am looking at a particular type of alternative splicing event - exon skipping. For each intron (or junction), I look if it is normally spliced or if there is an exon skipping event happening. I have three biological replicates ( for each junction, I ha...
I'm working through Applied Linear Regression Models (Kutner) and having a hard time figuring out this problem (it's actually problem 6.26): Given a First-Order Model with Two Predictors: $Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + \epsilon$ , show that the coefficient of simple determination between $Y$ and $\hat{Y}$ ...
I have a time series and I want to check whether it has a unit root or not. I want to use the Dickey-Fuller test. How should I choose the regression equation from the three options: regression without constant and trend, with constant (drift) and with constant and trend? Is there a procedure that I should follow to se...
The simplest form of a white noise process is where its observations are uncorrelated. We can check this by applying e.g. a portmanteau test such as Lung - Box or Box - Pierce. The series might be Gaussian white noise where the observations are uncorrelated and also normally distributed and hence independent. We can te...
I found many tests like: Fligner, Levene etc etc to check homogeneity of variances, my question is: What is the difference between those tests and ANOVA ?
my level of stats is kind of restricted to some undergraduate courses. Anyhow I received some data from a planned experiment. Basically it is about to test the shear strength (interval scale) for electronic devices. The experiments should look for differences in different materials and process parameters. So I facto...
Suppose you have two groups $A$ and $B$ and you want to find the odds ratio of some outcome. How do you denote this odds ratio? Is it just $OR(\text{A} \ \text{and} \ B)$?
I have a number of trading strategies, and trading systems which are subsets of the strategies (many systems in one strategy). I also have a number of market indicators created by a portfolio manager which act like technical trading indicators which indicate his beliefs about certain market conditions. I am trying to ...
I have a situation in which I have $n$ observations, each with $p$ independent variables and $q$ dependent variables. I would like to build a model or series of models to obtain predictions of the $q$ dependent variables for a new observation. One way is to build multiple models, each one predicting a single dependent ...
Let $X$ and $Y$ be two independent random variables having the same uniform distribution $U(0,1)$ with density $f(x)=1$ if $0≤x≤1$ (and $0$ elsewhere). Let $Z$ be a real random variable defined by: $Z=X-Y$ if $X>Y$ (and $0$ elsewhere). Derive the distribution of $Z$. Compute the expectation $E(Z)$ and variance $V(Z)$....
Let $a$ and $b$ be two positive integers. Let also $X$ be a discrete random variable varying in $X(\Omega)=\{1, 2, \ldots, ab\}$ such that for every $x∈X(\Omega),P[X = x]=1/a - 1/b$. a) What conditions should $a$ and $b$ satisfy? b) Determine the cumulative distribution function $F$ of $X$. Compute $u$ such that $F(u)=...
We generated repeated measures data from a sample of people evaluated at 4 timepoints in 2 groups. We wish to compare the groups over time. There are significant missing values. The questionnaire is very insensitive and has a score range from 1-30, however the vast majority of people are scoring 29 or 30. The numbers f...
I will try to be as clear as I possibly can: I want to populate a matrix of about 10 million rows by 43 columns as a test to an application The first task is to generate a random number around 10 million Second I need to fill out the columns. Let's say for column 2, random ints can only be generated between 1 and 25. ...
I have a dataset of cases and age & sex matched controls (n=25). I need to do a statistical test to find the significantly different incidences of ICD-9 codes using a p-value or similar measure. What test should I use in this scenario and how should I define significance ? Given the low number of samples, should I use...
These coefficients look way too large to me, they seem to imply probabilities of around 0.5, instead of around .01, as I would expect. Here is sample code: set.seed(1L) ids <- as.factor(rep(1:10,rep(10,10))) ps <- rnorm(n=10,mean=0.01,sd=.002) ns <- sample(500:2000,replace=T,size=100) ks <- rbinom(n=100,size=ns,prob=ps...
I'm confused about how to calculate the perplexity of a holdout sample when doing Latent Dirichlet Allocation (LDA). The papers on the topic breeze over it, making me think I'm missing something obvious... Perplexity is seen as a good measure of performance for LDA. The idea is that you keep a holdout sample, train you...
I have a system with two components, component A and component B. Let $X$ be the random variable representing time between failures of component A and $X$ is exponentially distributed. Let $E[X]=m$. Now we want to test the following hypothesis: null hypothesis: $m\le m_0$ where $m_0$ is some given constant alternate hy...
I have a question regarding the ppois function in R: ppois(x,lambda,lower.tail=TRUE) gives $P[X>x]$ ppois(x,lambda,lower.tail=FALSE) gives $P[X\le x]$ How can I calculate $P[X=n]$? I mean is there any function in R for this?
I have a trained logistic regression model that I am applying to a testing data set. The dependent variable is binary (boolean). For each sample in the testing data set, I apply the logistic regression model to generates a % probability that the dependent variable will be true. Then I record whether the acutal value wa...
Given a DNA sequence of $L$ I am looking for a distribution to model the starting positions of $k$ blocks with length $w$. I am starting to investigate in a discrete form of dirichlet distribution but I was curious if any of you ever faced the same problem and how you solved it. So, any ideas?
This example is from the first chapter of Gelman & Hill 2007: The following are the proportions of girl births in Vienna for each month in 1908 and 1909 (out of an average of 3900 births per month): .4777 .4875 .4859 .4754 .4874 .4864 .4813 .4787 .4895 .4797 .4876 .4859 .4857 .4907 .5010 .4903 .4860 .4911 .4871 ....
I would like to run a 1000 simulations of $X-Y$ where $X$ is the average of 100 random observations with mean of 69.5 and SD 2.9 and $Y$ is the average of 100 random observations with mean of 63.9 and SD 2.7. I did the following: x <- rnorm(100, 69.5, 2.9) y <- rnorm(100, 63.9, 2.7) And now I would like to somehow ...
I have been given a project to implement an SIRS model. While searching how to do it, I found this site and a question related to epidemic model. It is very much related to my project and is quite helpful. However, since I'm new to this topic, can you please help me on how to start implementing SIRS model. I have to im...
H0 is commonly understood to signify the absence of a treatment effect or difference between two groups. Doesn't this understanding ignore the fact that sample data (being a sample) can never fully accurately reflect the nature of the phenomena being studied? Doesn't the existence of things like Type II errors requir...
I have four letters: A B C D, I need to calculate all the combinations on the follow type: A - B A - C A - D A - BC A - BD A - CD A - BCD AB - C AB - CD AB - D ABC - D As you can see no letters are repeated LEFT - RIGHT, IF the letter is on the left it is not repeated on the right again. I need a method to generate ...
I'm wondering how to interpret the coefficient standard errors of a regression when using the display function in R. For example in the following output: lm(formula = y ~ x1 + x2, data = sub.pyth) coef.est coef.se (Intercept) 1.32 0.39 x1 0.51 0.05 x2 0.81 0.02 n = 40, k ...
I've looking around Google Scholar for the earliest mention of this particular classifier and have not had much luck finding a definitive source. I've seen some sources cite as late as the 1980s and other as early as the 1930s. Does anyone know when the Naïve Bayes Classifier was developed and/or first used as a classi...
Common data-based variable selection procedures (for example, forward, backward, stepwise, all subsets) tend to yield models with undesirable properties, including: Coefficients biased away from zero. Standard errors that are too small and confidence intervals that are too narrow. Test statistics and p-values that do ...
It is well known that confidence intervals and testing statistical hypothesis are strongly related. My questions is focused on comparison of means for two groups based on a numerical variable. Let's assume that such hypothesis is tested using t-test. On the other side, one can compute confidence intervals for means of ...
I have a study in which participants facebook profiles were rated by a group of students. The participants were then randomly allocated into one of three groups: the uncertain condition (where they could have been assigned either a liked-best or liked-least rating but they are not told which one), the Liked-Best condit...
Something has been bugging me about E.T. Jaynes' treatment of continuous parameters. In his book Probability Theory: The Logic of Science, uses notation that I am unfamiliar with when getting probabilities for continuous parameters from their densities. For example, in chapter 4, page 420, equation 4-49, Jaynes "discr...
The following is from Gelman & Hill 2007: Suppose that, for a certain population, we can predict log earnings from log - A person who is 66 inches tall is predicted to have earnings of $30,000. Every increase of 1% in height corresponds to a predicted increase of 0.8% in earnings. - The earnings of approximat...
In the case of multiple regression where I have dependent variable Y and two predictors X1 and X2 I would like to make a plot of their relationship before fitting a regression, however the plot function only allows the plotting of two variables at a time. for example plot(x, y) how can I look at the overall data then?
After running a regression of the form reg <- lm(y ~ x1 + x2, data=example) on a dataset, I can get predicted values using predict(reg, example, interval="prediction", level=0.95) I'm wondering what the predicted values actually refer to when I'm using the regression to predict the actual dataset. Shouldn't I obtain ...
I'm wondering what the difference is between: 'predicted by residual plot' where I plot the residuals of the regression with the predicted values of the regression ; the case where I plot the residuals with the predictor variables. Also I'm wondering how to make such a plot in R in the case of multiple regression. Do...
What are some good ways of quantitatively characterizing the periodicity level of an approximately periodic $f(t), t \in \mathbb{R}$ signal? I need this to tell if the output of some system is periodic or not, and to be able to decide the output of which system (out of a given set) is "more" periodic (approximates a pe...
Possible Duplicate: Computing chi-square for large tables with some expected cell counts equal to zero The formula for chi-squared goodness-of-fit statistic is $\sum_i (O_i-E_i)^2/E_i$, which $O_i$ is observed frequency, $E_i$ is expected frequency. But, what can I do if $E_i$ is zero?
I have a time series with prices (around 800 prices). I need to test if the mean is constant during all the series. I think I should subdivide the series in groups, but what method do I have to use to check if the mean is constant if the distribution is not normal?
This question arises from my actual confusion about how to decide if a logistic model is good enough. I have models that use the state of pairs individual-project two years after they are formed as a dependent variable. The outcome is successful (1) or not (0). I have independent variables measured at the time of forma...
Normally when I create an index I basically just take the or averages of the individual variables that comprise the index. But I'm wondering if one should / could not, take the product? E.g., a scale "friendship" is comprised of the variables 1) "fun to be with" and 2) "good to talk to when I am sad". (just a hypotheti...
Given a very large number of samples $n$ from the population, suppose that I am trying a standard hypothesis test on the means: $$\begin{align}H_0:&\overline{x}\leq\mu_0\\ H_1:&\overline{x}>\mu_0 \end{align}$$ I am interested in the power of my test as I increase $n$. If I am given nice probability measures associat...
I have run into an error associated with truncating a distribution in JAGS. In my minimum reproducible example, I have data for 9 observations and would like to find a posterior predictive distribution for the 10th observation. To do this, I include the 10th observation as an NA and estimate its posterior predictive di...
Not exactly the most accessible explanation can be found here, but I'm looking for something more intuitive, examples of applications and so on. Help is much appreciated.
I want to find most frequent words in some cases that some words stand out. I have two data for each case, the word and the number of times it appears. I want to know which algorithms, techniques can be used to find the most frequent data. At the moment, I'm using the discard for data normalization (Mean + Standard De...
One of my problems https://stackoverflow.com/questions/7783933/clustering-data-outputs-irregular-plot-graph suffers from the curse of dimensionality, which also makes it infeasible for exhaustive search or analytical methods, metaheuristics for combinatorial problems like simulated annealing might help in my endeavour...
I've struggled with this question for several months and found this website, which is amazing. Imagine a hypothetical league composed of players competing in a simple contest where the object of each contest is to score more than an opponent. Player strategies are simple, existing on a range from focusing on scoring, t...
I need to calculate confidence and prediction bands for a linear regression that is in the general form of $y=ax$, where $a$ is the multiplier and $x$ the variable. I found a code in http://demonstrations.wolfram.com/ConfidenceAndPredictionBands/ , though it gives the confidence and prediction bands for $y=ax+b$ which ...
I have a job doing data analysis in finance. My current job is such that I don't have much exposure to things happening in the rest of my industry or other industries. I have a fair amount of knowledge about Bayesian statistics. I'd like to keep myself marketable, so I am curious what data and statistics skills are cu...
Using a two stage RJMCMC process I obtain a vector of log posteriors pertaining to each model. My goal is to convert these to probabilities after normalization (to use in the second stage of the RJMCMC process). The problem is the log posteriors are large (ex. 1100). To convert to probabilities (not on the log scale)...
My dependent variable is, by origin, absolute residual* left after some regression; it is distributed half-normally. Now I plan to use Generalized linear model in SPSS (GENLIN) to regress it on some predictors (totally different from those which produced the residuals). What distribution type should I use for the DV? F...
Given a time series, one can estimate the autocorrelation-function and plot it, for example as seen below: What is it then possible to read about the time series, from this autocorrelation-function? Is it for example possible to reason about the stationarity of the time series? Edited: Here I have included the ACF of...
I am working my way through Think Stats, where the author states that "there is no closed form expression for the normal cumulative density function" but does not provide any further details as to why this is the case, simply saying that the alternative is to write it in terms of the error function. Is there some w...
I have a series and I need to check if the values are asymmetric or not (less or more) with respect to the mean. What test should I use?
I just ran an experiment and I'm not sure how best to analyse the data. My data are distance values between objects in a metric space bounded by [0,1]. I have drawn up a probability density estimate as follows: This looks to me like a kind of hybrid between an exponential and normal distribution, what tests can I run...
I have to run a SPSS two-step cluster analysis. All my 4 variables are continuous scalar standardized parameters (with normal distribution). The dataset includes 10,000 cases. SPSS suggest to use euclidean distance with such a dataset, but the resuls are not significant (2 clusters: 99% and 1%), while using the log-lik...
I am trying to solve a problem about my homework. The problem says that Assume a two-class problem with equal a priori class probabilities Does it mean, mean vectors and covariance matrices should be equal? The question of the homework is: Assume a two-class problem with equal a priori class probabilities and Gaussi...
I have data from an experiment where students were tested on multiple words for the correct pronunciation of a specific linguistic phenomena. The experiment was done with a control and experimental group, and all students were tested prior to a specific instruction and at the end of the experiments (roughly 8 weeks lat...
This question is an extended version of this one. As you can see here, two distributions are equal, I need to compute the parameters a,b,c,d and e. Could you show me a way to do that? Assume a two-class problem with equal a priori class probabilities and Gaussian class-conditional densities as follows: $$p(x\mid w_1) ...
Is the likelihood ratio test ($-2 \log L$) basically like the partial F-test in that you are using it for logistic regression instead of linear regression?
Apologies for the uninformative title. This is actually a fairly simple problem which I could easily do myself in matlab or perhaps stata, but the professor demands it be in SAS, which seems to have been designed for robots not humans. Say I have a matrix of farm output data with rows of crops at the farm and field le...
I'm using KPSS method to check if the time series is stationary, but I would also like to use another test to confirm the hypothesis that the time series is stationary. I'm already using Unit root tests as ADF or PP, but I need a more specific test to check the stationarity. What method should I use?
The Problem: Retailer Y uses (for client operation purposes) a network of about 3000 devices. The whole network has 10 different models (from distinct manufacturers), aged from 0 years old (purchased in the current year) to 12 years old. Each device may suffer from malfunctions for which immediate repair is requested....
I have 4 correlated time series, and I want to predict one of them, from the other 3. There is a clear seasonal effect in the 4 time series, so my first thought was to fit a multivariate ARIMA model, but I can not seem to find an R-function for this.
This is for my hw, and if anyone can solve the first part of the question it will be great. Here is the question: Assume a two-class problem with equal a priori class probabilities and Gaussian class-conditional densities as follows: $$p(x\mid w_1) = {\cal N}\left(\begin{bmatrix} 0 \\ 0 \end{bmatrix},\begin{bmatrix} a ...
I'm currently taking my first applied linear regression class at the graduate level, and am struggling with predictor variable transformations in multiple linear regression. The text I'm using, Kutner et al "Applied Linear Statistical Models" doesn't seem to cover the question I'm having. (apart from suggesting that th...
This questions is in reference to equation 3.15 in the book Elements of Statistical Learning by Tibshirani and coll. I do understand the individual beta confidence interval estimation as provided in equation 3.14, but equation 3.15 just bowls me: $$\beta|(\hat{\beta} -\beta)^TX^TX(\hat{\beta} -\beta)\leq \sigma ^2\chi ...
I have a data frame which contains several true/false columns, some numeric and a class (target) variable which has true/false values. Now, how can I produce with R multiple barplots for all numerical and factor columns without having to specify each data frame's column name and imposing the class attribute's distribut...
I have a trial with 8 groups. Each group experienced one of two treatments - four groups got treatment A & 4 got B. Within each group, the dependent variable was measured 4 times. Unfortunately, the dependent variable is not normally distributed (or anywhere close). Given the repeated measures, I cannot therefore perfo...
As I understand, we can get correlation by normalizing covariance using the equation $$\rho_{i,j}=\frac{cov(X_i, X_j)}{\sigma_i \sigma_j}$$ where $\sigma_i=\sqrt{E[(X_i-\mu_i)^2]}$ is the standard deviation of $X_i$. My concern is what if the standard deviation equals zero? Is there any condition that guarantees it can...
I want to eliminate the unit root from the series using different detrending methods. Please help.
How could I use GARCH model to detect if the volatility is constant during all the series(time series)? I can't do a visual check, I need to detect if the volatility is constant using R and GARCH function of tseries package
I would like your thoughts about the differences between cross validation and bootstrapping to estimate the prediction error. Does one work better for small dataset sizes or large datasets?
What do you think about the following method to perform a random sampling: Generate as many floats (between 0 and 1) as individuals using a quantum random generator (each value appears only one time). Assign floats to individuals. Sort individuals according to the order of the floats. Select individuals as needed. Si...
In our group, we have measured grey matter volumes of about 20 regions of interest (ROI) and frequency of cannabis use. Now, we would like find out whether cannabis use is associated with grey matter volumes of any of the measured brain regions. Furthermore, we would like find out whether these associations differ in s...
Suppose one wants to compute the odds ratio of a disease for a person in group $A$ versus that of a person in group $B$. Suppose we consider the following: (i) include age in the odds ratio calculation, (ii) include age and height in the odds ratio calculation. Is it possible for the odds ratio for (ii) to be much grea...
I have a small set (say, 200 data points) of estimates about the time to complete a varied group of tasks, along with the actual times used to complete those tasks. These estimates are divided in four groups: 0:30, 1:00, 2:00, and 4:00. These groups indicate that the task should be completed in 30 minutes, 1 hour, and...
I am new to R and seeking some advice. I have a set (~20M) of data describing on which step a process did fail or succeeded: name;star_time;step1;step2;step3 A;2011-07-22 11:02:44;passed;passed;failed B;2011-03-06 19:33:06;passed;failed;failed ... I want to search for clusters of processes which have mostly succeed on...
Consider survey data from surgeries. $Y$ represents observed surgical quality and is measured post-surgery; $X$ represents perceived surgical difficulty level and is measured pre and post surgery. It is desired to assess the relationship between $Y$ and $X_{pre}$ and also $Y$ on $X_{\delta} = X_{post} - X_{pre}$. Ho...
library(caret) set.seed(1) x <- data.frame(runif(10),runif(10)) y <- rnorm(10) rfeModel <- rfe(x,y,rfeControl = rfeControl(functions = lmFuncs)) returns: Error in { : task 1 failed - "undefined columns selected" While this code: data(BloodBrain) x <- scale(bbbDescr[,-nearZeroVar(bbbDescr)]) x <- x[, -findCorrelati...
The references I can find on HAC procedures (like Newey-West) in regression focus on the standard error of the estimated regression coefficients and hypothesis testing involving the same. I cannot find any references where the HAC estimate of error covariance is used in a generalized least squares procedure to get 'bet...
I have two measurements $x_1\pm s_{x_1}$ and $x_2 \pm s_{x_2}$. The error intervals ($\pm$ one standard deviation) do not overlap. Does this necessarily mean that these are two samples from normal distributions with different means? Or should I run a test to exclude (to some degree) the fact that they might still be fr...
In my experiment, I compare the resistance of 12 different seed types to seed beetles. I have 30 replications (i.e. 30 times a single beetle larva developing in a single seed) for each variety and assess whether an adult beetle emerges from the seed or not. The resulting two-way table I analyzed using logistic regressi...