instruction
stringlengths
35
38.7k
Thanks for all the answer for the question Calculation of incidence rate for epidemiological study in hospital. And here come's the second part of the question: What about the prevalence rate then? I have read The new public health as suggested by Chi, the book says that prevalence is usually not available when using o...
I would like to gather input from people in the field about the Yates continuity correction for 2 x 2 contingency tables. The Wikipedia article mentions it may adjust too far, and is thus only used in a limited sense. The related post here doesn't offer much further insight. So to the people who use these tests regular...
Are there good tutorials on object-oriented programming in R? It would be great if it included the following: how to define a class; differences between S3 and S4 classes; operator overloading (I'd like to be able to write a+b where a and b are instances of the class I have in mind).
My question is: plus or minus? Is the Lagrange function: the objective PLUS lambda times constraints, or the objective function MINUS lambda times constraints? Example: want to maximize A=xy subject to g(x,y)=2x+y-400=0 is F(x,y,lambda): xy + lambda (2x+y-400), or xy - lambda (2x+y-400) I found both notations. Doe...
Who of you in this forum uses ">R with the multicore, snow packages, or CUDA, so for advanced calculations that need more power than a workstation CPU? On which hardware do you compute these scripts? At home/work or do you have data center access somewhere? The background of these questions is the following: I am curre...
I was reading about exponential smoothing on Wikipedia. I saw a sentence saying that I could find the optimal parameter $\alpha$ by using the method of least squares. How do I go about doing that? Are there other ways I can find the right $\alpha$? Edit: Also, if possible, I'd like a way to handle missing values.
Genetic algorithms are avoided in econometry literature as often as possible, but still sometimes they are inevitable. The question is: Which well known models are the most difficult to estimate using conventional algorithms? (By Conventional algorithms I mean Gauss-Newton method, Levenberg–Marquardt algorithm, and so ...
I am trying to detect text in a scanned document by examining variations in the lightness of the scan collapsed vertically. Here's a sample of the input I would receive, with the lightness plot of each vertical pixel strip superimposed: Note: I've applied a Gaussian smoothing function to the data ~ 10 times, but it se...
I have run a factorial type test in a processing plant and have run a forward and backward step regression in R. How can I use the regression results and the anova created from the regression to know what percent of the measured variation of the dependent variable was caused by the purposeful manipulation of the indep...
Are there any open-source Java implementations of lasso or least angles regression? Pure Java code would be best, but clean implementations in other languages would also be of interest. I am already aware of the existence of a variety of R packages than can do lasso/LAR fits. Thanks.
I'm doing some some analysis of an arbitrary string of text, modelling it as a Markov chain where the state is simply the value of the previous character. Call the current character $c$ and the previous character $p$; then it is trivial to calculate $P(c\ |\ p)$ for the given sample text. However, if there are not many...
I am thinking of using this code in a Monte Carlo routine to generate Kernel Density Estimates for subsequent use in a Naive Bayes Classifier (see this earlier post). The author of the code states on the above linked page that it will "recognise that the data you have provided is perfectly discrete and since discrete ...
I'm trying to implement basic gradient descent and I'm testing it with a hinge loss function i.e. $l_{\text{hinge}} = \max(0,1-y\ \boldsymbol{x}\cdot\boldsymbol{w})$. However, I'm confused about the gradient of the hinge loss. I'm under the impression that it is $$ \frac{\partial }{\partial w}l_{\text{hinge}} = \begin...
from what I can tell, PASW v.18 (the new version of SPSS) only gives you the p value of nonparametric tests. I am calculating Kruskal Wallis and Mann Whitney tests, and need to report the test statistic, not just p. Can someone please help? Thanks!
Statistics were never my strong point and it's my first question, so please be gentle :) I'm doing some research using Computational Fluid Dynamics, CFD, to model the flow of an oil aerosol through a fibrous filter. The aerosol has a droplet size distribution that is log-normal. The existing code only allows the s...
Which good econometrics textbooks would you recommend? Edit: there are quite a few books out there, with varying levels of mathematical sophistication. It would be good to get some idea of how technical the book you're recommending is.
I have two surveys of two separate populations (I don't know that they are necessarily distinct, but they are from two different databases) that ask a similar set of questions. Some questions are basic demographics (e.g. age, income), while other questions are a bit more detailed or about their opinions (e.g. brand pr...
Say, for example, that I want to determine the market share or relative popularity of coffee houses within a certain population through a survey. What is the best way to write a question that accurately measures this? Some issues that I am thinking of: I don't want to ask a single choice question ("Which coffee house ...
I have a 3-dimensional sample $(X_k,Y_k,Z_k), k=1, \ldots, N$ which I suspect to be uniform on some parallelepiped in $R^3$ (i.e. a set of the form [a;b]X[c;d]X[e;f], where numbers a,b,c,d,e,f are unknown). How should I estimate numbers a, b, c, d, e, f? Obviously I can try MLE, but then my estimates are biased. Does ...
I am fitting an L1-regularized linear regression to a very large dataset (with n>>p.) The variables are known in advance, but the observations arrive in small chunks. I would like to maintain the lasso fit after each chunk. I can obviously re-fit the entire model after seeing each new set of observations. This, however...
In R, the drop1command outputs something neat. These two commands should get you some output: example(step)#-> swiss drop1(lm1, test="F") Mine looks like this: > drop1(lm1, test="F") Single term deletions Model: Fertility ~ Agriculture + Examination + Education + Catholic + Infant.Mortality Df...
In R, the step command is supposedly intended to help you select the input variables to your model, right? The following comes from example(step)#-> swiss & step(lm1) > step(lm1) Start: AIC=190.69 Fertility ~ Agriculture + Examination + Education + Catholic + Infant.Mortality Df Sum of Sq ...
I am familiar with meta analysis and meta regression techniques (using the R package metafor from Viechtbauer), but I recently stumbled on a problem I can't easily solve. Say we have a disease that can go from mother to the unborn child, and it has been studied already a number of times. Mother and child were tested fo...
I originally asked this on a machine learning site, but one of the responses made me think that maybe this site is more suitable. Suppose you have two weighted coins, and every day you flip each one a number of times and record the total number of heads. So on the tenth day you might have flipped coin A 106 times, coin...
If the outcome of a market could be expressed as a probability it might be: Outcome - Description - Probability as a % Up a lot 20% (a move of say more than 10%) Down a lot 20% Up a bit 20% (a move of between 0 and 10%) Down a bit 20% Sideways 20% So the probability of any single outcome is 1/5 or 20%. Please ...
I'm trying to run a basic gradient descent algorithm with a absolute loss function. I can get it to converge to a good solution by it requires a much lower step size and more iterations than had I used square loss. Is this normal? Should I expect absolute loss to take a longer time to come to a good solution or potenti...
Background notation: RV= random variable, $\mu=$ mean $m=$ median Jensen's Inequality considers the relationship between the mean of a function of an RV and the function of the mean of an RV. If $f(x)$ strictly convex: $$\mu (f(x)) > f(\mu (x))\mathrm{\hspace{20mm}(1)}$$ Conversely if -f(x) is strictly convex: $$\mu ...
I have two set of data that are roughly centered around zero but I suspect that they have different tails. I know a few tests to compare the distribution to a normal distribution, but I would like to compare directly the two distributions. Is there a simple test to compare the fatness of tail of 2 distributions? Thank...
I'm more of a programmer than a statistician, so I hope this question isn't too naive. It happens in sampling program executions at random times. If I take N=10 random-time samples of the program's state, I could see function Foo being executed on, for example, I=3 of those samples. I'm interested in what that tells me...
Least-angle regression and the lasso tend to produce very similar regularization paths (identical except when a coefficient crosses zero.) They both can be efficiently fit by virtually identical algorithms. Is there ever any practical reason to prefer one method over the other?
Through a project I am now working on (which I won't link to so to not have this an ad question), I came to realize how difficult it is to find R resources, not in English. Thus my question is - what resources do you know of, recommend, for learning R in non-English languages? (tutorials, blogs, wiki's, forums, and so...
I am using an automatic model selection procedure, "step". The model of depart (the biggest possible) is a polynom, say of the 4th degree. Depart<-lm(y~x+I(x^2)+I(x^3)+I(x^4)) Final<-step(Depart) I need to transform the Final model to a corresponding function. How can i do this?
What is the difference between soft and hard expectation maximization? EDIT: ok, i've found out this paper: http://ttic.uchicago.edu/~dmcallester/ttic101-07/lectures/em/em.pdf that explain quite well the situations
Suppose that I have a population, each represented by a bit $b_i$ for $i \in \{1,\ldots, n\}$. I would like to compute an estimate $\hat{B}$ of the parameter $B = \sum_{i=1}^nb_i$ so that with high probability, the error $|\hat{B}-B| \leq k$ for some fixed $k$. However, I have to pay a cost $c_i$ to sample bit $b_i$, a...
I am trying to get a deeper understanding of the various types of Bayesian networks. Most of the literature/lectures I've come across use discrete random variables exclusively and only mention continuous random variables in passing. It seems if you want to mix discrete and continuous variables in a hybrid network, t...
What are the differences between generative and discriminative (discriminant) models (in the context of Bayesian learning and inference)? and what it is concerned with prediction, decision theory or unsupervised learning?
My teacher is asking whether it is possible to look at the Cronbachs's alpha when looking at the internal reliability of an ordinal scale. She thinks, because you use the mean of it, it is not possible, but I've seen it in previous research as well. I think it is possible, but I cannot give a technical explanation for...
Here is an example of hierarchical clustering of genes in the microarray data using the weighted pair gene method in Spotfire. I am not sure how to do this in R. In the hclust function, I see ward", "single", "complete", "average", "mcquitty", "median" or "centroid" as the methods. Also, lets say I have performed hier...
Suppose I have time series observations from distributions drawn from some population. That is, I observe $X_{t,i}$ for $t=1,2,...,T,$ and $i=1,2,...,n$, where I believe that $X_{t,i}$ have pdf $f(\theta_i)$. (I have some idea about the distribution of the $\theta_i$, but that may not be important here.) I have some sa...
I have two models $M_1$ and $M_2$ that I am using to try and compare to observed data $D$. $M_1$ is an $n_1$-dimensional model, and $M_2$ is an $n_2$-dimensional problem. The Bayes factor $K$ to compare the models can be calculated using: $K = P(D|M_1)/P(D|M_2) $ assuming no prior preference for either model. The nume...
In simple terms, how would you explain (perhaps with simple examples) the difference between fixed effect, random effect in mixed effect models?
As we know, we can get the same eigenvector if we apply PCA to the same data. But, is it possible that we get the same eigenvectors after we apply PCA to two totally different data sets (still same dimension)?
I am looking for a method to use to test for equality of two cumulative density functions.
I have used the following r code to estimate the confidence intervals of a binomial proportion because I understand that that substitutes for a "power calculation" when designing receiver operating characteristic curve designs looking at detection of diseases in a population. n is 150, and the disease, we believe, is 2...
In the literature on hierarchical/multilevel models I have often read about "nested models" and "non-nested models", but what does this mean? Could anyone maybe give me some examples or tell me about the mathematical implications of this phrasing?
I am interested in comparing a non-linear model with up to 12 parameters to many datasets. However, each instance of the model takes a significant amount of time to compute (~1 hour), so I am pre-computing instances of the model for various parameter values and then comparing these to all the different datasets. There ...
I am about to do a laboratory experiment in the scientific field of soil ecology and hydrology. Beforehand I want to make sure not to make any crucial mistakes, and therefore I would appreciate any hints and comments from your side. The main issue is how to deal with high natural variability (~25%) and a rather small s...
Can you suggest a tutorial or book chapter on basics of data analysis with exponentially distributed data / exponential noise, at undergraduate level? By "basics" I mean: is a given set of data exponentially distributed? should one generally use median instead of mean for exponential data? Should one simply trim the t...
I know what you're thinking, this is a duplicate of "What are the differences between Factor Analysis and Principal Component Analysis", but it isn't really. That other question deals with Confirmatory Factor Analysis. Either way, I would like to know what the difference is :) Thanks!
These terms get thrown around together a lot, but I would like to know what you think the differences are, if any. Thanks
I have a class with a set of descriptive statistic functions (mean, median, kurtosis, etc...). Now I need to include weight (array) into my equations. My first thought was to just create a weighted version of the functions where the additional weight array is passed. However, I was wondering if there is a way to alter ...
I do a counting experiment where I count observations as a function of two float parameters $x_1$ and $x_2$. This leads to a two-dimensional histogram where each bin corresponds to the number of observations with $x_1$ and $x_2$ in some range. I now see a lot of bins with zero counts in them (even though more counts ar...
I am interested in finding some practical (and reasonably well accepted) techniques for finding the underlying factors of a sparse matrix. Specifically, I have a very large sparse matrix whose cells appear to be populated from an approximately geometric distribution. In its natural form the matrix is square. The va...
I have a random sample of Bernoulli random variables $X_1 ... X_N$, where $X_i$ are i.i.d. r.v. and $P(X_i = 1) = p$, and $p$ is an unknown parameter. Obviously, one can find an estimate for $p$: $\hat{p}:=(X_1+\dots+X_N)/N$. My question is how can I build a confidence interval for $p$?
just for curiosity... What language is used most here? R? MATLAB? Python? Java? What for prototype or for production? For example I think MATLAB is mostly used for prototyping, python for both prot. and production...
Some googling revealed that doing the F-test for Lack-of-Fit in SPSS is not so trivial. It seems one has to “trick” SPSS to do that. See for example this. Can anybody suggest a better source of information on how this can be done? I have SPSS 16. Of course I know it can be easily done using R but I am interested in the...
Randomized SVD decomposes a matrix by extracting the first k singular values/vectors using k+p random projections. This works surprisingly well for large matrices. My question concerns the singular values that are output from the algorithm. Why aren't the values equal to the first k-singular values if you do the full S...
I was asked this question during an interview for a trading position with a proprietary trading firm. I would very much like to know the answer to this question and the intuition behind it. Amoeba Question: A population of amoebas starts with 1. After 1 period that amoeba can divide into 1, 2, 3, or 0 (it can die) wit...
I was wondering if it is possible to do symbolic computation in R? For example, I was hoping to get the inverse of a symbolic covariance matrix of 3D Gaussian distribution. Also can I do symbolic integration and differentiation in R?
I have some cumulative frequency data. A line $y=ax+b$ looks like it fits the data extremely well, but there is cyclic/periodic wiggle in the line. I would like to estimate when the cumulative frequency will reach a certain value $c$. When I plot the residuals vs. fitted values, I get a beautiful sinusoidal behavior. ...
I am looking at using Interior Point method for optimizing a convex function. The convex function is basically the log-likelihood of a binary logistic regression model. Can I use this technique? In generally, is there anything that prevents applying a constrained optimization technique to an unconstrained problem? From...
To me, the two are similar in the sense that slice sampling is just Gibbs sampling for the uniform distribution over the area under the plot of the density function. Is that right? I was wondering if someone can compare between slice sampling and Gibbs sampling. For example, in terms of rate of convergence, which one i...
Where can I find a good proof that CRF based models and logistic regression based models are convex? Is there a general trick to test/prove that a model or objective function is convex?
I am trying to determine if I can model my system as a M/M/1 queue and if so do the numbers I get from it help me at all. I can model my system like this: System Description A. I want to spec out the max number of clients I can have connect to my system. Each client can generate at max 40 messages/second that are plac...
I'm analyzing a noisy time series where where the inter-event interval is known to follow a two-gamma mixture distribution. If there was a simple model that would generate that kind of thing, it would be pretty simple to implement into BUGS. But otherwise, I can't think of anything that wouldn't be prohibitively kludg...
SAS EM has a node that generates the transformation for a dataset that makes it best fit a normal distribution. I can't imagine the people at SAS are the only ones to figure out how to do this. Is there any documentation out there on methodologies that do the same? Or an open source implementation?
I study labor and delivery as an epidemiologist. It is well established that a large fetus has a higher risk of causing maternal birth trauma. But a large baby is also likely to be delivered by cesarean section due to difficult labor. Those delivered by cesarean section will not have any risk for maternal birth traum...
I'm working on a meta-analysis and have generated a quirky question for which I'm at a bit of a loss. The MA is for a large set of factorial experiments. Calculating the Log Response Ratio (LRR) and variance in said ratio for the experimental data is a cinch, and we're comparing the effects of one type of treatment t...
This may be too much of a general question but I hope I can find help here. I am starting a RA job in my university and my topic will be related to Internet Traffic Analysis. I am fairly new to the world of analysis but I guess in the world of research this is what I have to do a lot of. I've been through a few papers ...
I'm currently working as a teaching assistant at my university, in an introductory statistics course (for medical students). Offline, there are many books available with information to aid the teacher. However, what I am interested to know is if you might direct me to any (good) resources that provide exercises (with ...
I have two LME models with the same interaction, one containing both main effects and one containing only one main effect, say : $$ H\_CE = Season + Crownlevel + Season:Crownlevel , random = 1|CollectorID $$ and $$ H\_CE = Season + Season:Crownlevel , random = 1|CollectorID $$ There are 4 levels of each, and every comb...
Let $X \sim \chi^2_k$ be a chi-squared distributed random variable with $k$ degrees of freedom. What are the sharpest known bounds for the following probabilities $$ \mathbb{P}[X > t] \leq 1 - \delta_1(t, k) $$ and $$ \mathbb{P}[X < z] \leq 1 - \delta_2(z, k) $$ where $\delta_1$ and $\delta_2$ are some functions....
I wasn't able to find one on Google, and was wondering if one exists...
I just noticed how the non exact McNemar's test uses the $\chi^{2}$ asymptotic distribution. But since the exact test (for the two case table) relies on the binomial distribution, how come it is not common to suggest the normal approximation to the binomial distribution?
I've got a dataframe like the following: case simulation temp plank oxygen 1 1 1 8 7 11 2 2 1 16 10 15 ... 17 17 2 26 12 17 18 18 2 15 8 12 19 19 2 28 11 21 20 20 2 24 6 14 I'd like to get...
Full Disclosure: This is homework. I've included a link to the dataset ( http://www.bertelsen.ca/R/logistic-regression.sav ) My goal is to maximize the prediction of loan defaulters in this data set. Every model that I have come up with so far, predicts >90% of non-defaulters, but <40% of defaulters making the classi...
When transforming variables, do you have to use all of the same transformation? For example, can I pick and choose differently transformed variables, as in: Let, $x_1,x_2,x_3$ be age, length of employment, length of residence, and income. Y = B1*sqrt(x1) + B2*-1/(x2) + B3*log(x3) Or, must you be consistent with your ...
In SPSS output there is a pretty little classification table available when you perform a logistic regression, is the same possible with R? If so, how?
One of the assumptions for using the Wilcoxon sign-rank test is that the underlying distribution is continuous (see here.) However, there are cases (for example, when analyzing Likert scale data) where this assumption might not necessarily hold. In such cases, what test can you use? And how would you do it with R? (My...
I have a survey where I have asked people which type of computer games they enjoy and whether they consider themselves a hardcore gamer. I allowed people to select multiple genres, but now I am unsure what to do with my data. I initially thought factor analysis, with the idea being if there were genres that belonged to...
my friend is a chemist and his problem is to predict the level of ozone concentration in a single site. We have the data for the last 12 years. We want to predict the concentration for the coming years (as much as possible). I know this data set is small, so my question is is this possible? And how much of data is requ...
The "standard" way to compute Kappa for a predictive classification model (Witten and Frank page 163) is to construct the random confusion matrix in such a way that the number of predictions for each class is the same as the model predicted. For a visual, see (right side is the random): Does anyone know why this is t...
I have a timeseries of data which was gathered by driving a car around randomly. One data point was gathered every minute and each data point is either "Yes" or "No". Yes = temperature is above a threshold, No = it is below the threshold. Assume the car never stops. I'm interested in the proportion of Yeses and relat...
I'm trying to precompute the distributions of several random variables. In particular, these random variables are the results of functions evaluated at locations in a genome, so there will be on the order of 10^8 or 10^9 values for each. The functions are pretty smooth, so I don't think I'll lose much accuracy by only ...
In Logistic Regression, is there a need to be as concerned about multicollinearity as you would be in straight up OLS regression? For example, with a logistic regression, where multicollinearity exists, would you need to be cautious (as you would in OLS regression) with taking inference from the Beta coefficients? Fo...
How can I rewrite an AR(p) model in state-space form? Max(p)=5 and I want to use Kalman Predictor.
I have been reading a good book called Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence by Judith Singer and John Willet. The book shows that by modeling in 2 levels, we can model the individual change in level 1 and in level 2 model for systematic interindividual differences in change. The R co...
Is it possible to do k-fold cross-validation to test all data, rather than using kfcv to find the optimal hypothesis as is typically done. Example: Say I want to use a svms on a dataset of size 1000. Could I use 900 events to train the svm for the testing of the other 100 events. Then use a separate 900 events to train...
what is the minimum entry degree to be employed as a statistician
I am trying to track the performance of a set of homogeneous subsystems vs the system as a whole. The performance metric is measured by a mean value based on a set of tasks performed by a the subsystem, for example, the mean wait time before scheduling task. Each subsystem may be responsible for varying numbers of task...
I have imported a datafile in R. It has different columns. There is one column that has the name of Operating System belonging to that row information. I wanted to get the percentage share of each unique OS (windows, linux, ios etc) from this column and plot it. I am very new to R and would like to know if there is any...
We're using Excel Solver to model a DEA problem. We've worked with a few resources and feel confident that the model is returning correct results but I need some help interpreting them. When solver completes its analysis, it provides an answer report that gives the slack found in some of the constraints -- which are b...
Hello fellow number crunchers I hope this a valid question for this forum. I am a lonesome quarter-statistician and have trouble finding someone to ask. Introduction: Wikipedia Explanation of AB-Tests A ton of examples for typical use of AB-Tests The AB-Test has become really popular since it is so easy to implement ...
I have a data set that I need to analyze in R. A simplified version of it would be like this SessionNo. Objects OtherColumns A 2 . A 3 B 4 C 1 D 2 D 1 D 2 D 3 E 5 here each sessionn...
What is the VC dimension of SVM with the polynomial kernel $k(x,x')=(1+<x,x'>_{\mathbb{R^{2}}})^{2}$ for binary classification in $\mathbb{R^{2}}$? It would be equal or more than v iff there exists a set of v points such that, any labeling (-1 or +1) of the points given, there exists a correct separating border. It wou...
If you choose to analyse a pre-post treatment-control design with a continuous dependent variable using a mixed ANOVA, there are various ways of quantifying the effect of being in the treatment group. The interaction effect is one main option. In general, I particularly like Cohen's d type measures (i.e., ${\frac{\mu_1...
Other than literally testing each possible combination of variable(s) in a model (x1:x2 or x1*x2 ... xn-1 * xn). How do you identify if an interaction SHOULD or COULD exist between your independent (hopefully) variables? What are best practices in attempting to identify interactions? Is there a graphical technique tha...
I'm searching for a statistical method to determine if a player is cheating in an online game. The game is a Quake3 like game (ego-shooter). Given a number of positive points and a number of negative points per player (score) and given n players (n<=64). The score comes together like this (positive/negative seen from ...
Lets imagine that we have some experiments. Each experiment may result in one of the outcomes: A, B, C. So we have probabilities distribution for each experiment $P_A, P_B, P_C$ which is context-dependent. E.g.: $Context_1 \Rightarrow \{P_A^1, P_B^1, P_C^1\},$ experimental outcome is A $Context_2 \Rightarrow \{P_A^2...
The empirical cumulative distribution function of a random variable, given observations $x_\left( k \right) > x_\left( k-1 \right)$, $k \in \mathbb N$, $k \le n$, is defined as $F_{emp}(x_\left( k \right) > X \ge x_\left( k-1 \right)) = \frac k {n+1}$ and $F_{emp}(X \ge x_\left(n\right))=1$. Why? As long as we're inter...