instruction
stringlengths
9
38.7k
I created a software platform on which about 110 participants could contribute at any time of their choosing over the course of 12 weeks (think something like a wiki). These participants were then randomly split to use one of two otherwise identical platforms. One key difference was implemented between the two platfo...
I was trying to compute the 95th percentile on the following dataset. I came across a few online references of doing it. Approach 1: Based on sample data The first one tells me to obtain the TOP 95 Percent of the dataset and then choose the MIN or AVG of the resultant set. Doing so for the following dataset gives me: ...
I have data that look like this, with a tonnage measure and density measure for each carriage in a bunch of trains. Train Carriage_No Tonnes Density A 1 105.5 2.12 A 2 104.9 2.28 A 3 101.2 2.30 A 4 108.7 2.41 B 1 112.3 2.51 B 2 ...
I need to optimize based on an objective function that is non-standard, as far as I know. If the predictors are $X$, output of the model is $\hat y$, and response is $y$, my objective is essentially: $$j = \sum( \hat y \cdot y ). $$ Minimized it would just be $-j$. Does anyone know of an existing approach to optimizat...
How do you cluster a feature with an asymmetrical distance measure? For example, let's say you are clustering a dataset with days of the week as a feature - the distance from Monday to Friday is not the same as the distance from Friday to Monday. How do you incorporate this into the clustering algorithm's distance me...
Let's assume one has an analysis in which there are multiple correlated DVs (average correlation .46) being examined in separate univariate analyses (e.g. t-tests; insufficient df and frustration tolerance to restructure the data fro a MANOVA) in relation to a single IV. All except one of these DVs is not significantl...
We are currently converting student test scores in this manner : ( ScaledScore - ScaledScore Mean ) / StdDeviation ) * 15 + 100 I was referring to this calculation as a z-score, I found some information that convinced me that I should really be referring to it as a t-score as opposed to a z-score. My boss wants me...
I was wondering if anybody had some good references on dynamic neural networks. The goal is to have a neural network that responds in real-time (and is governed by say a system of DEs) instead of at discrete time-steps. The prototypical application is a robot: we have a series of sensors that are constantly feeding dat...
I have some data that I'm playing around with; for simplicity, let's suppose the data contains information on number of posts a blogger has written vs. number of people who have subscribed to that person's blog (this is just a made-up example). I want to get some rough model of the relationship between # posts vs. # su...
There are generally many joint distributions $P(X_1 = x_1, X_2 = x_2, ..., X_n = x_n)$ consistent with a known set marginal distributions $f_i(x_i) = P(X_i = x_i)$. Of these joint distributions, is the product formed by taking the product of the marginals $\prod_i f_i(x_i)$ the one with the highest entropy? I certainly...
I would like to manipulate the work done by the loess function in R. However, the main workhorse of this function is written in C. Is there some pure R implementation of the code? Thanks.
As a non-statistician, I have a real world statistical/probability problem that I'm having trouble framing. The software I rely on in inventory management interprets the 'movements' (number of times inventory is used) in a strange way. It offers the number of months, out of 24 months, that the item has been used. For ...
In my research I'm comparing the variance of a method and I would like to describe the overall variance between individuals and the variance of the replicates of these individuals. Things like 'comparing the intra-individual variance and between-individual variance' seems to get people confused. I would like to make a...
If somebody can tell me what R commands I need to use for a repeated measures ANOVA, I'd really appreciate it. I have trouble with the random term. I've seen random=id, random=id/(treatment*group) and others. Also can you please indicate to me what the formula for the Bonferroni adjusted intervals is?
Suppose $X$ and $Y$ are two random samples (not necessarily iid, but one can make this assumption) and that $Z=X+Y$. If one computes the order statistics of $X$ and $Y$, what can be said about the relative order statistic of $Z$? To be more clear, let $\tilde{X}_{0.99}$ and $\tilde{Y}_{0.99}$ be the 0.99th quantiles of...
I need help in knowing which test to perform with this analysis. I have two groups (lets say group A and B). A study was performed with initial rates of heart failures in group A and B (i.e, baseline rates) were measured. After 6 months of follow up the heart failure rates in group A and B (i.e, re measurement rates)...
Context I want to set the scene before somewhat expanding on the question. I have longitudinal data, measurements taken on subjects approximately every 3 months, primary outcome is numeric (as in continuous to 1dp) in the range 5 to 14 with the bulk (of all data points) being between 7 and 10. If I do a spaghetti plot...
I am trying to express a hypothesis to test for the following claim: A biologist is presented with the data that shows an increase in the average number of bacterias, though he suspects there was no actual change. I came up with the following: $H_0:\; \mu = 40.10^2$ [no change had occurred] $H_A:\; \mu > 40.10^...
I am new to R and using rpart for building a regression tree for my data.I wanted to use all the input variables for building the tree, but the rpart method using only a couple of inputs as shown below. As we can see, I have provided 10 inputs, but rpart used only two inputs. Please let me know how can force rpart meth...
I understand this to be a binomial distribution: There are 100 balls in a bucket. 10 are red, 90 are blue. I select a ball at random and then replace it in the bucket, and I do this 20 times. I then calculate the probability that none of the selected balls were red. But what if I don't put the ball back in the bucket? ...
In particular, how should the standard errors of the fixed effects in a linear mixed effects model be calculated (in a frequentist sense)? I have been lead to believe that the typical estimates (${\rm Var}(\hat\beta)=(X'VX)^{-1}$), such as those presented in Laird and Ware [1982] will give SE's that are underestimated ...
For one of my academic project I ran a sample survey. But unfortunately the respondents were not very proactive & I get just 25 responses for my study. With this small response I guess I can't do any statistical studies (e.g. anova, regressions, etc). So, I was wondering if based on the sample's mean & standard deviat...
I have bird count data and use classical poisson loglinear model, i.e. we have counts obs(i,j) - observed count for site i and year j, and the model is: ln(model(i,j)) = site_effect(i) + year_effect(j) where model(i,j) is expected count for site i and year j, and it is assumed that counts are poisson distributed, i.e....
For my research I am currently working in R and I have created a function which gives me the loglikelihood. Now, I would like to optimize it for multiple parameters. So I decided to use the optim() function in R. Since I have 1 vector parameter and another parameter which are constrained to have values between 0 and 1,...
When doing a GLM and you get the "not defined because of singularities" error in the anova output, how does one counteract this error from happening? Some have suggested that it is due to collinearity between covariates or that one of the levels is not present in the dataset (see: interpreting "not defined because of ...
Are there R packages that offer eigenvalue de-noising methods grounded in Random Matrix Theory? Various cleansing methods include the Power Law and Krazanowski filter.
I have collected 70 organisms from 4 different sites; two sites of treatment 1 and two sites of treatment 2. I also have a continuous explanatory variable (average temperature) which is different for each site. How can I test if measures of richness and diversity differ between sites or by temperature? Richness is t...
Tools such as random forests or adaboost are powerful at solving cross-sectional binary logistic problems or prediction problems where there are many weak learners. But can these tools be adapted to solve panel regression problems? One could naively introduce a time index as an independent variable but all this does i...
Sorry to keep bothering you guys with this thing, but another stupid question: Given the following data (from my previous question), how would one calculate the conditional probability and marginal probability (for Bayesian inference) of both the positive hypothesis and the negative hypothesis for, say, choice #3? Sup...
I have used rpart.control for minsplit=2, and got the following results from rpart() function. In order to avoid overfitting the data, do I need to use splits 3 or splits 7? Shouldn't I use splits 7? Please let me know. Variables actually used in tree construction: [1] ct_a ct_b usr_a Root node error: 23205/60 = 386....
Note: I'm not even sure how to best title this question, so if anyone has any ideas, please edit! Consider six independent draws from a distribution defined by a cdf $F(x)$ over 0-1. Let’s call them $X1, X2 . . . X6$. I want to define the distribution for X1+X3, if I know the following information: $X1 +X4 < X2 + X6...
Let's say I have 100 parts. I sample one part and find it defective. I then sample another five parts and do not find them defective. What statistical procedure would I use that combines this information to provide a confidence interval or failure rate?
Using R, I have developed three models: linear regression using lm(); decision tree using rpart(); k-nearest neighbor using kknn(). I would like to conduct leave-one-out cross-validation tests and compare these models. However, which error metric should I use for better representation? Does mean absolute percentag...
Can anybody point me to a survey paper on "Large $p$, Small $n$" results? I am interested in how this problem manifests itself in different research contexts, e.g. regression, classification, Hotelling's test, etc.
Using R plot() and plotcp() methods, we can visualize linear regression model (lm) as an equation and decision tree model (rpart) as a tree. We can develop k-nearest neighbour model using R kknn() method, but I don't know how to present this model. Please suggest me some R methods that produce nice graphs for knn model...
I was playing around with ggplot2 using the following commands to fit a line to my data: ggplot(data=datNorm, aes(x=Num, y=Val)) + geom_point() + stat_summary(fun.data = "mean_cl_boot", geom="errorbar", colour="red", width=0.8) + stat_sum_single(median) + stat_sum_single(mean, colour="blue") + geom_smooth(level = 0...
I'm given a $M\times N$ ($M$ rows, $N$ cols) matrix $X$ and a $1\times M$ column vector $y$ ($M>N$). I need to find such a vector $x$ that minimizes the value of s, where $s= \sum_{i=1}^{M}\left [(y_i - \hat{y}_i)^2 \right] $ and where $\hat{y} = X \times x$ Basicaly, this is a set of linear constraints. There is also ...
Stein's Example shows that the maximum likelihood estimate of $n$ normally distributed variables with means $\mu_1,\ldots,\mu_n$ and variances $1$ is inadmissible (under a square loss function) iff $n\ge 3$. For a neat proof, see the first chapter of Large-Scale Inference: Empirical Bayes Methods for Estimation, Testin...
Ratios (X/Y, e.g. body mass index) are variables with odd distributions. They have no means or moments (e.g. variances, skewness or kurtosis). Thus, my questions are: How to compare between (or among) 2 or more groups with ratio variables? How to use ratio variables as the independent variable or dependent variable in...
The density of my data set was plotted in R as follows. What kind of distribution would fit this data? As I am not experienced to tell by visualization, I can only guess it is not normally distributed. I shall test it with R: some guidance as a starting point is highly desirable.
How can a random forest model be published so that it also can be externally validated? Is it possible to get an average of the node split values from the ensemble?
Have you any idea about implementing 2D object recognition with MATLAB? Which characteristics of objects can feed a neural network? It's my training data-set (provided by ETH University of Switzerland) What is the start point? There are 5 view of each object, and whole objects are 66.
I have some score values that are output from a program. There are about 10 such values. The data set is a measure of the "quality" of a speech waveform received over a mobile phone and landline channel. The waveform is passed through an algorithm and a score is received of its quality relative to a "golden" waveform (...
I have data from two different sets (each with fields named Mobile and Landline). There are about 5 elements from each field in each set. They go something like so: Set A: Mobile: 45 61 78 65 71 Landline: 56 71 75 98 12 Set B: Mobile: 67 71 75 64 23 Landline: 9 34 56 21 22 I need to prove/disprove that the ...
I am trying to decide if zero inflated poisson is appropriate for my data vs. a Poisson hurdle model. In background reading between the two I've run across a statement saying that a zero inflated model attempts to distinguish between true zeros and excess zeros. I'm having a problem understanding what is the different ...
note: with no correct answers after a month, I have reposted to SO Background I have a model, $f$, where $Y=f(\textbf{X})$ $\textbf{X}$ is an $n \times m$ matrix of samples from $m$ parameters and $Y$ is the $n \times 1$ vector of model outputs. $f$ is computationally intensive, so I would like to approximate $f$ usin...
Suppose I have two time-series variables, $\{x_t\}$ and $\{y_t\}$, where $t\in[1,T]$. I would like to model the correlation $\rho(x_t,y_s)$ as some function of $t$,$s$, and the difference $t-s$. In other words, $\rho_{t,s}$ may take on a different value for any valid combination of $(t,s)$, a total of $\frac {T(T+1)}...
A bit more info; suppose that you know before hand how many variables to select and that you set the complexity penalty in the LARS procedure such as to have exactly that many variables with non 0 coefficients, computation costs are not an issue (the total number of variable is small, say 50), that all the variables (...
I have a variable called aa, it has 5 values: very satisfied, satisfied,dissatisfied,very dissatisfied,neither satisfied nor dissatisfied. I need to convert the value of "very satisfied" into "5", "satisfied" into "4", and so on. I tried this command: xtile bb=aa,nq(5) but the outcome is weird, because it only those 5...
I am trying to select the best answer from a set of samples, using two variables at different scales. In the data below, each row indicates the accuracy of a given measurement, the number of times it occurs in the sample set, and the answer that it indicates. Accuracy:0.00886982324861, Frequency:5.0, Answer:1.0 Accu...
I am currently in the process of analyzing a data set comprised of manager-subordinate dyads. Data were collected cross-sectionally and the data set contains some of the same variables collected from both members of the dyad (e.g., age, relationship tenure, interpersonal trust) as well as some unique variables for each...
When estimating the posterior via MCMC, are there guidelines on the best sampling method to use depending on the nature of the model? There are a variety of forms of MCMC - the Gibbs sampler, the Metropolis algorithm, and the Metropolis-Hastings algorithm for example. Gilks et al. (1996) has a nice discussion of the M...
I'm trying to make a min, max, average chart with horizontal lines, where the vertical axis represents years in the series, something similar to this chart at I've already created the data for the chart, i just don't know how to proceed
This is a follow-up to my previous question, how can I compute a posterior density estimate from a prior and a likelihood I am having difficulty understanding how it is possible to calculate the probability of a parameter set given its likelihood. For example, in the answer to the previous question, the likelihood is u...
In a paper I've written I model the random variables $X+Y$ and $X-Y$ rather than $X$ and $Y$ to effectively remove the problems that arise when $X$ and $Y$ are highly correlated and have equal variance (as they are in my application). The referees want me to give a reference. I could easily prove it, but being an appli...
I have a univariate time series which is an index of susceptibility to failure, and a binary variable which indicates whether a failure actually occurred in a given time window or not. I want to carry out a statistical test that would quantify the performance of the susceptibility index (e.g., compared to a null model ...
I have learnt that using vif() method of car package, we can compute the degree of multicollinearity of inputs in a model. From wikipedia, if the vif value is greater than 5 then we can consider that the input is suffering from multicollinearity problem. For example, I have developed a linear regression model using lm(...
Can anybody explain in detail: What does reject inferencing mean? How can it be used to increase accuracy of my model? I do have idea of reject inferencing in credit card application but struggling with the thought of using it to increase the accuracy of my model.
I just found out how to run a R script from the R Console under Windows. source("arrrFile.R") The problem is, this command runs "silently". How can I run the file command-by-command as I would type it in the console?
when integrating a function or in complex simulations, I have seen the Monte Carlo method is widely used. I'm asking myself why one doesn't generate a grid of points to integrate a function instead of drawing random points. Wouldn't that bring more exact results?
I'm using a beta binomial updating model for a piece of code that I am writing. The software is real time updating - meaning that data is continually being gathered and after N data points are gathered, the bayesian model is updated using the N data points. Under this logic, I am using the posterior output as my prior...
A given user can interact in multiple ways with a website. Let's simplify a bit and say say a user can: Post a message Comment a message "like" something on the website via Facebook (after that we could add, following the site on twitter, buying something on the site & so on, but for readability's sake let's stick to...
I am working with a bunch of multinomial models, and presenting the tables with all the coefficients is getting to be quite tedious, do you guys know of any ressources that show how to present such models graphically, so all the tables could be excluded, or put in an appendix?
I have a simple matrix: [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 [3,] 7 8 9 [4,] 10 11 12 I have to calculate linear regression and orthogonal regression using lm() and prcomp() respectively. (for orthogonal see: here) Assume that the first column is the the X and M the matrix I wrote...
I'm trying to draw violin plots and wondering if there is an accepted best practice for scaling them across groups. Here are three options I've tried using the R mtcars data set (Motor Trend Cars from 1973, found here). Equal Widths Seems to be what the original paper* does and what R vioplot does (example). Good for c...
Consider $m$ independent draws from each of $n$ distributions. $X_{i,j}$ the $i_{th}$ draw from cdf $F_{j}(x)$. where $1 \leq i \leq m$ and $1 \leq j \leq n$. Therefore we have $m\cdot n$ total draws from all distributions. Also, assume the ranges of the distribution overlap. Let us call $X_{\min,j}$ the minimum o...
I am new to ridge regression. When I applied linear ridge regression, I got the following results: >myridge = lm.ridge(y ~ ma + sa + lka + cb + ltb , temp, lamda = seq(0,0.1,0.001)) > select(myridge) modified HKB estimator is 0.5010689 modified L-W estimator is 0.3718668 smallest value of GCV at 0 Questions: ...
We conducted an experiment to determine if type of blood is a main effect or interact with a treatment (2 treatments). The subjects were measured on several hours (5 times). There are 3 subjects by type of blood (these are replicates). Then, we have the effects of TYPE, TREATMENT, TIME. We are not sure if Time is a cov...
I am trying to wrap my head around False Discovery Rate, and its associated q-value; I am new to this technique, but it seems quite promising for my needs. One sticking point I keep coming across and cannot seem to resolve is the following: As best as I can tell, the ordering of q-values can be different from that of p...
Is it possible to fit a data curve to another data curve? Please see this plot I do not have the model for the black data curve or I don't want to model it. But I want to see how the red data curve fits/matches with the black one. Is it possible? I am looking for a non-parametric solution or a solution that can be arr...
This is not a question about implementation: I have a GLMER model with a significant three way interaction. Neither of the two way interactions or main effects are significant. I accept this model and leave all lower order effects in the model, but want to plot this three way interaction: x, y, and then z as colour i...
I'm using heatmap.2 to cluster my data, using the centroid method for clustering and the maximum method for calculating the distance matrix: library("gplots") library("RColorBrewer") test <- matrix(c(0.96, 0.07, 0.97, 0.98, 0.50, 0.28, 0.29, 0.77, 0.08,...
I am looking at setting up some website load testing scripts and need some help in finding a formula to estimate how many concurrent users are browsing a website at peak times, based on common metrics such as visits, average page views per visit, and average visit duration. For example: Peak visitors per hour: 1,000 Av...
If a predictor in a logistic regression is not discriminating between 'goods' and 'bads' for most of the range and is discriminating only at higher or lower values (monotonic), should the variable be used as continuous or as a dummy indicating the range in which it is predictive?
Very short question. What exactly is the difference between an instrumental variable and a proxy variable when building a regression model?
In relation to the question below I have uploaded the detrended plot and the differenced plot to the following links (I tried to add the images to the post but I got a 'new user' error msg). If anybody knows a way to make a statistical connection between the two without doing regression analysis (because of the nonstat...
I'm currently working with a longitudinal dataset, the Kauffman Firm Survey. The survey tracks about 5000 firms starting from 2004 - 2009. Firms die out over the years. It has both cross-sectional weights and longitudinal weights. I've checked out Lumley's Complex Surveys using R, but the section on repeated samples ...
To run a certain activity, a population of companies use a finite set of inputs. There are 8 different inputs, but each company may not use all of them. For instance, company 1 uses inputs A, B and D, whereas company 2 uses inputs B, D, E and F I have conducted a survey to ask 30 different companies about which input...
I am looking for an equation to calculate appropriate intervals to designate values as very low, low, medium, high, very high for dynamic data. for example if my dataset ranges from 0 to 100 very low= <=20, low=21-40, medium=41-60, high=61-80, very high= >81 However, if the range is small there should be fewer interval...
This is the motivation for my question: Suppose we have $n$ tickets in a bag, and we draw $k$ of them uniformly at random without replacement. Now, repeat the same procedure independently (same $n$ tickets, draw $k$ of them UAR without replacement). I can straightforwardly show that, if $S$ is the number of overlapping...
I have several closely-related questions regarding weak learners in ensemble learning (e.g. boosting). This may sound dumb, but what are the benefits of using weak as opposed to strong learners? (e.g. why not boost with "strong" learning methods?) Is there some sort of "optimal" strength for the weak learners (e.g. wh...
I am wondering if there are any algorithms (perhaps genetic algorithms) in R for feature construction (deriving candidate predictors from existing predictors)? I am thinking of a routine to test higher order powers, interactions, ratios, and linear combinations and nonlinear functions of existing variables (sin, cos, a...
I have been using R for several years, but I have always used a GUI like Tinn-R, JGR, and most recently R-Studio. Though I like R-Studio's interface, I feel that for longer programs with few/no graphics, I could code more efficiently by taking advantage of the shortcuts offered by a more basic text editor like Emacs....
Many clinical studies are based on non-random samples. However, most standard tests (e.g. t-tests, ANOVA, linear regression, logistic regression) are based on the assumption that samples contain "random numbers". Are results valid if these non-random samples were analyzed by standard tests? Thank you.
This question is in some sense the intersection of this question and this question. I have read up on the Gibbs sampler, and am now asking for an introduction to the Gibbs sampler for mathematicians. I like plausibility arguments and simulations as much as the next guy, but would like to know more about the math behind...
I'm trying to model a weekly process of adoption (adoption events could only occur on Fridays) using the coxph function, but a large quantity of observations are missing for the first 6 years, leaving me with psuedo annual data at irregular intervals. The problem is, R's method for handling interval censoring appears t...
At the moment I'm using linear regression of 4 series with: mod <- lm(x ~ y + z + v + 0) # I need zero intercept I'm using the linear regression to calculate the coefficients of y, z and v to predict the x value. Is there something more accurate then lm? For example, I heard about orthogonal regression; could it be g...
I've been implementing the GLMNET version of elastic net for linear regression with another software than R. I compared my results with the R function glmnet in lasso mode on diabetes data. The variable selection is ok when varying the value of the parameter (lambda) but I obtain slightly different values of coefficien...
I'm working at a plant breeding company. During some spare time I recently did some exploring of our data (yield trials), mostly just out of curiosity and wanting to learn R better. I started by plotting standard deviation of means created with different number of replications (in the actual data each color would repre...
I have recently come across the mircosoft data analysis tool add-on, and I was wondering if there was something comparable that can be used with OpenOffice? However, if there is nothing for OpenOffice, is there any other software that can be used in Ubuntu-Linux that can do similar things?
I have the following table and I would like to make a representative chart. Start End Duration Implementation of project 01/05/2012 30/04/2014 24 XRD and Polymerisation 01/05/2012 01/06/2012 1 DFT 01/05/2012 01/11/2012 6 Supervision 01/...
I want to sample according to a density $$ f(a) \propto \frac{c^a d^{a-1}}{\Gamma(a)} 1_{(1,\infty)}(a) $$ where $c$ and $d$ are strictly positive. (Motivation: This could be useful for Gibbs sampling when the shape parameter of a Gamma density has a uniform prior.) Does anyone know how to sample from this density ea...
I'm in a little debate with a colleague about hypothesis testing and interpretation. Your insights, link, or edits to get us on track are really appreciated! I won't tell you which side of the debate I'm on, but here is the situation: Situation 1 Subjects are divided into 4 groups, in each group N=100. Each particip...
I work on quite a lot of statistical modelling, such as Hidden Markov Models and Gaussian Mixture Models. I see that training good models in each of these cases requires a large (> 20000 sentences for HMMs) amount of data that is taken from similar environments as the final use. My question is: Is there a concept of...
If I have values for sensitivity and specificity for a group of studies, for example like this: sensitivity specificity ----------- ----------- 66.3 74.7 87.2 65.9 56.4 76.4 79.5 94.3 How can I make an ROC curve for such values? Do I divide them by 100 f...
If $X = \{ x_1,\cdots x_n\}$ is a set of feature vectors, then the k-means algorithm tries to minimize the objective function $O = \sum_{i=1}^{k}\sum_{x \in G_i}||x -\mu_i ||^2$ in order to cluster $n$ feature vectors into $k$ clusters, namely $G_1 \cdots G_k$. Here $\mu_i$ is the centroid of cluster $G_i$. Now I rep...
Having the sensitivity and specificity values, what software do you recommend that enables drawing the ROC curve provided this data? Thanks.
I'm struggling to grasp the concept of bias in the context of linear regression analysis. What is the mathematical definition of bias? What exactly is biased and why/how? Illustrative example?
I asked this question at math.stackexchange.com first, but nobody answered. Perhaps statisticians can help me. The question is like this: I have a signal generator, which each second generates one of the letters 'a', 'b' or 'c'. I don't know anything else about this signal generator, but I suspect that there are some p...
I'm going back to university this September and I picked up a course which has some prerequisites Mathematics & Statistics (Sci): Sample space, events, conditional probability, independence of events, Bayes' Theorem. Basic combinatorial probability, random variables, discrete and continuous univariate and multiv...