instruction
stringlengths
35
38.7k
I am using the epitools in R for calculating the confidence interval of relative risk. http://bm2.genes.nig.ac.jp/RGM2/R_current/library/epitools/man/riskratio.html There are three methods inside for calculations: namely Wald, Small and Boot. I want to find some article describing the three methods, but I can't find an...
I'm curious to know if anyone has a specific reference (text or journal article) to support the common practice in the medical literature of performing sample size calculation using methods that are parametric (i.e. assuming a normal distribution and a certain variance of measurements) when the analysis of the primary ...
How do you tell if the correlations at different lags obtained from the cross-correlation (ccf function) of two time series are significant.
I've been studying hierachial reinforcement learning problems, and while a lot of papers propose algorithms for learning a policy, they all seem to assume they know in advance a graph structure describing the hierarchy of the actions in the domain. For example, The MAXQ Method for Hierarchial Reinforcement Learning by ...
I have 2 classifiers with different scales. How can I adjust one classifier to the scale of the other without loss of quality? On the scatter plot we have 2 solutions plotted (x1, x2) against each other. I believe using linear combination as a link function is not appropriate in this particular case. Help is much appr...
I would like to know the formula or method of calculating this. For example, I want to know how many numbers I must pick in order to have 95% confidence that I will be within 2% of the average. I'm also interested in doing a similiar analysis for the median as well. Update: Numbers are not put back in the pool. I think...
Suppose we have a set A and a subset B. If we know |A|, then we can calculate |B| by finding the probability p that an element chosen uniformly at random from A belongs to B. Specifically |A|p=|B|. Suppose we generate n elements of A uniformly at random and use this data to estimate p (number of elements in B divided...
I have a data set with following structure: a word | number of occurrence of a word in a document | a document id How can I perform a test for normal distribution in R? Probably it is an easy question but I am a R newbie.
I am currently working on matlab and I am new to it. I would like to know how do i average the results from the folds (or otherwise combined) to produce a single estimation. My dataset has 2 class labels +1 and -1. and k=5. I use the knnclassify() method in matlab in order to perform cross validation. Kindly help!
I'm quite new to R and I have a following problem: I have a simple 2-factor linear model: # factor1 has 8 categorical values, factor2 has 6 categories Rate ~ factor1 + factor2 model1 <- lm(Rate~factor1+factor2, data=myData) And want to put constraints SUM of factor1 coefficients = 0, the same for factor2. None of the...
I have developed two differing methods in MATLAB which aim to analyse a pop song and then automatically create a 30 second audio thumbnail (a preview clip) containing part of the chorus section. Both methods have varying results: The first method can create a thumbnail for each track, managing to find a chorus section...
My mean is 3.454992884900722e+008, and my confidence intervals from three distributions (when compared to the given mean) are: CI for dist. 1: 1.0e+008 * [4.084733001497999 4.097677503988565] CI for dist. 2: 1.0e+008 * [5.424396063219890 5.586301025525149] CI for dist. 3: 1.0e+008 * [2.429145282593182 2.838897116739...
Does this type of chart have a name? More importantly, is there any visualization library I can use to produce it? http://www.nytimes.com/interactive/2007/12/15/us/politics/DEBATE.html
Let's say we created a plot, with labels: plot(1, xlab = "text", ylab = "text times three") # text too small In this plot there is still a lot of free region to enlarge the text. We could do so by using cex.lab, like this: par(cex.lab = 2) plot(1, xlab = "text", ylab = "text times three") Questions: Is there a way ...
I have to incorporate a number of line plots in a Latex document and I want to get a very high quality. Are there any website that show some templates or default plots styles that I can use. Myself I am not good in designing this kind of plot style, so I am searching some good basic settings for the tool I want to use....
We have data from random polling within a group of people, sampled over a long period of time. As the pool is relatively small and anonymity is crucial there is a high likelihood that we have duplicate samples (though we can't tell for certain because we'd expect responses to vary over time). Does this somehow invalida...
There are occasions where I would like to fit log-linear models where the independence assumption between observations is violated. It is the normal case that I have multiple observations from each subject. Is there a mixed-effects extension to log-linear models like there are for linear and generalized linear models? ...
I have a data which is 100x1 vector. How can I display its empirical pdf in Matlab? Also, if I want to compare the pdf of three vectors on the same graph, then how to do that? Right now I am using pdfplot.m file to plot my empirical pdf, however when I want to compare the 3 distributions by using 'hold on', then firstl...
Imagine 2 models: 1 for production, 1 for revenue, have cross-section and time dummies. Is it permissable to use CS in one and time in the other? How do I justify this? F-test for fixed effects is indicating this and also dummies I want to omit in each case are not really significant.
I'm working on a project that involves 14 variables and 345,000 observations for housing data (things like year built, square footage, price sold, county of residence, etc). I'm concerned with trying to find good graphical techniques and R libraries that contain nice plotting techniques. I'm already seeing what in ggp...
I was recently consulting a researcher in the following situation. Context: data were collected over four years at around 50 participants per year (participants had a specific diagnosed clinical psychology disorder and were difficult to obtain in large numbers); participants were only measured once (i.e., it's not a ...
If you think back, to when you first started with time series analysis. What tools, R packages and internet resources do you wish you had known about? What I'm trying to ask is, where should one start? Specifically, are there any resources for R that really boil it down for one who is "new" to time series analysis with...
Hello data analyst community. I have the following problem: Given a set of n units and a timeline in days. A unit may be active at a certain day to a certain degree (in range from 0.0 to 1.0). A desirable outcome is that if a unit is active, it should be active for a series of consecutive days (or at maximum with one d...
How can I test the fairness of a twenty sided die (d20)? Obviously I would be comparing the distribution of values against a uniform distribution. I vaguely remember using a Chi-square test in college. How can I apply this to see if a die is fair?
I have a 2 dim matrix, and I want to know e.g. all the higher values are in the upper left corner. I can't just project it into R^3 and use a standard clustering algorithm because I don't want to consider the value as a dimension by itself. Is there an algorithm I can use for this? EDIT: To reformulate it, suppose it ...
Lets assume you are a social science researcher/econometrician trying to find relevant predictors of demand for a service. You have 2 outcome/dependent variables describing the demand (using the service yes/no, and the number of occasions). You have 10 predictor/independent variables that could theoretically explain th...
I have a database containing a large number of experts in a field. For each of those experts i have a variety of attributes/data points like: number of years of experience. licenses num of reviews textual content of those reviews The 5 star rating on each of those reviews, for a number of factors like speed, quality e...
I previously asked this question about the validity of my solutions for for $SE$ given $n$, $\bar{X_i}$ and summary statistics from post-hoc multiple comparisons such as Fisher's $LSD$ and Tukey's $HSD$, but I would like a general approach that can be applied to other post-hoc tests as well as other statistics. My hope...
I was wondering what are the differences between Mode, Class and Type of R objects? Type of a R object can be obtained by typeof() function, mode by mode(), and class by class(). Also any other similar functions and concepts that I missed? Thanks and regards!
In my animal experiments, I do survival studies, which generate Kaplan-Meier survival curves for each group, which I then compare with an appropriate log rank test. My question is: If I have run a survival experiment with identical variables, say, five times, and the final outcome (in very layman's terms) happens to be...
Addition, subtraction, multiplication and division of normal random variables are well defined, but what about trigonometric operations? For instance, let us suppose that I'm trying to find the angle of a triangular wedge (modelled as a right-angle triangle) with the two catheti having dimensions $d_1$ and $d_2$, both...
I was wondering how to create a vector with equivalent spacing between its consecutive elements in R? In Matlab, I can do [start:step:end]. Also if I want to plot a function with analytical form, do I have to evaluate the function on some sample points in its domain and plot these pair of points? Is there a R function ...
My office is going to implement a bundle of infection control measures in hospital and see if it can effectively reduce the infection rate of some pathogen. The unit of measurement will be "case per thousand patient bed days". We have chosen 4 wards for implementing the control measures for 12 months, and do the measur...
I would like to measure the time that it takes to repeat the running of a function. Are replicate() and using for-loops equivalent? For example: system.time(replicate(1000, f())); system.time(for(i in 1:1000){f()}); Which is the prefered method. In the output of system.time(), is sys+user the actual CPU time for run...
I have a set of time series data. Each series covers the same period, although the actual dates in each time series may not all 'line up' exactly. That is to say, if the Time series were to be read into a 2D matrix, it would look something like this: date T1 T2 T3 .... TN 1/1/01 100 59 42 N/A 2/1/01 ...
I have some data to which I am trying to fit a trendline. I believe the data to follow a power law, and so have plotted the data on log-log axes looking for a straight line. This has resulted in an (almost) straight line and so in Excel I have added a trendline for a power law. Being a stats newb, my question is, wh...
I know most of you probably feel that Google Docs is still a primitive tool. It is no Matlab or R and not even Excel. Yet, I am baffled at the power of this web based software that just uses the operating capability of a browser (and is compatible with many browsers that work very differently). Mike Lawrence, active ...
I want to forecast retail items (by week) using exponential smoothing. I'm stuck right now in how to calculate, store, and apply the sesonality indexes. The problem is that all examples I've found deal with a sort of simple seasonality. In my case I have the following problems: 1. Seasons don't occur on the same w...
Exploratory data analysis (EDA) often leads to explore other "tracks" that do not necessarily belong to the initial set of hypotheses. I face such a situation in the case of studies with a limited sample size and a lot of data gathered through different questionnaires (socio-demographics data, neuropsychological or med...
This question is about estimating cut-off scores on a multi-dimensional screening questionnaire to predict a binary endpoint, in the presence of correlated scales. I was asked about the interest of controlling for associated subscores when devising cut-off scores on each dimension of a measurement scale (personality t...
I have a few (5-6) data sets, each is a function of time, with the time span the same between datasets. These datasets are all statistics of various perspectives of something (the partitions of a graph), and I am trying to find points in time which show interesting changes across the different datasets. Normally thes...
Suppose you had a method for estimating the population covariance of a vector-valued random variable given observations of that random variable, say $f(Z) \rightarrow C$, where the rows of $Z$ are observations of the random variable. Can one abuse this process to perform a least squares regression $y = x^T\beta + \epsi...
I am about to help teach statistics to medical students this semester. I've heard many horror stories about the fear of these students from learning statistics. Can anyone suggest what to do with this fear? (Either links to people who are discussing this, or offer suggestions from your own experience)
I have around ten groups (of companies). Each group is connected with each other group. The data I have is representing the strength of the connection. Imagine it's the number of times someone from group A sent an email to group B. The strength of a connection can be 0. There are two connections between two groups, A-B...
I've been searching the internet far and wide... I have yet to find a really good overview of how to interpret 2D correspondence analysis plots. Could someone offer some advice on interpreting the distances between points? Perhaps an example would help, here is a plot that's found on many of the websites I've seen tha...
I have seen a few queries on clustering in time series and specifically on clustering, but I don't think they answer my question. Background: I want to cluster genes in a time course experiment in yeast. There are four time points say: t1 t2 t3 and t4 and total number of genes G. I have the data in form a matrix M i...
Let's say I'm playing 10 "games". For each game, I know the probability of winning, the probability of tying, and the probability of losing. From these values, I can calculate the probability of winning X games, the probability of losing X games, and the probability of tying X games (for X = 0 to 10). I'm just trying ...
Suppose I have some i.i.d. data $x_1, \ldots, x_n \sim N(\mu, \sigma^2)$, where $\sigma^2$ is fixed and $\mu$ is unknown, and I want to estimate $\mu$. Instead of simply giving the MLE of $\mu = \bar{x}$, one could estimate (1) $\mu = \lambda \mu_0 + (1 - \lambda) \bar{x},$ for some "prior best guess" $\mu_0$. This als...
I am looking for books / textbooks on statistics based on fractal mathematics. I know it is not a very well known area and it is rather difficult to find good literature. Any suggestions are welcome (books, textbooks, online materials).
I'm not a statistician, but I sometimes need to play around with data. I have two data sets, lists of values in the unit interval. I've plotted them as histograms, so I have an intuitive idea of how "far apart" they are. But I want to do something a little more formal. My first thought was to just sum the differences o...
I'd like to ensure that I understand the process correctly. This is a follow-up question to Interpreting 2D correspondence analysis plots library(reshape) library(ca) df <- read.csv(file="http://www.bertelsen.ca/R/smokers.csv") colnames(df)[7] <- "value" ## make reshape smart df <- cast(df, SMOKER ~ GEO) ## reshape...
a recent posting on math.stackexchange reminds me of a somewhat less ambitious$^1$ question i have been meaning to ask. suppose 3 people each have a deck of $M$ cards numbered from 1 to $M$, in random order. together, they turn over one card at a time. on any such trial, a match occurs if at least 2 cards show the sam...
Suppose you had $200 US to build a (very) small library of statistics books. What would your choices be? You may assume free shipping from Amazon, and any freely available texts from the internet are fair game, but assume a 5 cent charge per page to print. (I was inspired by a mailing from Dover books, but most of thei...
I am looking for resources (tutorials, textbooks, webcast, etc) to learn about Markov Chain and HMMs. My background is as a biologist, and I'm currently involved in a bioinformatics-related project. Also, what are the necessary mathematical background I need to have a sufficient understanding of Markov models & HMMs? ...
I have a pretty large data set (~300 cases with ~40 continuous attributes, binary labeled) which I used to create several alternative predictive models. To do this, the set was divided to training and validation subsets (~60:40%, respectively). I have noticed that there are several samples (both in the training and the...
I am looking for a fractal-based statistical measure which could be used as alternative to correlation between two variables (I know that hurst exponent can be used for auto-correlation). Is anyone aware of such measures?
For example: k <- 100 R <- 10000 max.g <- numeric(R) for(i in 1:R) max.g [i] <- max(rnorm(k)) hist(max.g) # We can see it's right tailed... I remember once encountering that there is a name for this type of distributions, but the name alludes me.
I have a S-Plus library which I'd like to convert to R. I am a programmer, but I don't know anything about S-Plus or R. From my research it seems that they are highly compatibile. Is that true? The code I want to convert only uses core S-Plus libraries. I have attached a picture of the library as seen in the S-Plus 8.0...
Supposing one has a time series from which one can take various measurements such as period, maximum, minimum, average etc. and then use these to create a model sine wave with the same attributes, are there any statistical approaches one can use that could quantify how closely the actual data fit the assumed model? The...
I am looking to rank data that, in some cases, the larger value has the rank of 1. I am relatively new to R, but I don't see how I can adjust this setting in the rank function. x <- c(23,45,12,67,34,89) rank(x) generates: [1] 2 4 1 5 3 6 when I want it to be: [1] 5 3 6 2 4 1 I assume this is very basic, but any he...
I have inherited some data analysis code that, not being an econometrician, I am struggling to understand. One model runs an instrumental variables regression with the following Stata command ivreg my_dv var1 var2 var3 (L.my_dv = D2.my_dv D3.my_dv D4.my_dv) This dataset is a panel with multiple sequential observations...
Question: With a 10 dimensional MCMC chain, let's say I'm prepared to hand you a matrix of the draws: 100,000 iterations (rows) by 10 parameters (columns), how best can I identify the posterior modes? I'm especially concerned with multiple modes. Background: I consider myself a computationally savvy statistician, but...
I have sales data for a series of outlets, and want to categorise them based on the shape of their curves over time. The data looks roughly like this (but obviously isn't random, and has some missing data): n.quarters <- 100 n.stores <- 20 if (exists("test.data")){ rm(test.data) } for (i in 1:n.stores){ interval <...
I asked a question earlier on here. Essentially, I am trying to evaluate a warning system that consists of a light bulb (of a specific color) being switched on, to indicate a predicted warning threat level. Srikant came up with a simple solution which involved calculating the posterior probabilities of the warning syst...
After reading one of the "Research tips" of R.J. Hyndman about cross-validation and time series, I came back to an old question of mine that I'll try to formulate here. The idea is that in classification or regression problems, the ordering of the data is not important, and hence k-fold cross-validation can be used. On...
I'm using a genetic algorithm to generate a string that produces certain results I map into a line/bar graph. I'm trying to rate how closely the results produced by the genetic string compares to a graph I have produce manually by hand. Currently I am comparing the graphs be finding the area of difference between the t...
I have some data that I've built histograms out of in R. Now I want to play around with the data, but first I want to summarise it in the same way the histogram does. That is, I want to take my data vector, and count how many points fall in each bin interval in the same way that R's hist function does. I was about to d...
If $X$ is a categorical variable, and I am interested in the posterior distributions of $\beta_1$, where $\beta_1$ is a vector of coefficients, one for each level of X, are these equivalent models? Model 1: $$Y \sim ( \beta_0 + \beta_1X_1,\sigma^2)$$ $$\beta_1 \sim N(0,\tau)$$ Model 2: $$Y \sim(\beta_1X_1,\sigma^2)$$ $...
I am looking at trigger efficiencies, meaning that I have some device that fires on $k$ out of $n$ events. In the end I am interested in some estimate of the efficiency $\epsilon$ which is the probability to fire on a randomly given event. Using a Bayesian approach with a uniform prior over $[0,1]$ I can model the prob...
I'd like to assess the impact of an upcoming policy implementation, as measured by changes in questionnaire response to a Likert-scale question. I understand I could use a difference-in-difference approach. However, in my situation there is no single obvious comparison, non-treated population. I think I'd like to u...
I have conducted an IRT analysis using package ltm in R 2.10. fit1 <- grm(data) When producing plots of item response characteristic curves (ICCs), plot(fit1) the text "Item response characteristic curves - Item:NAME" is printed as the main title of each plot. NAME is substituted with the actual name of the items i...
Suppose I have three time series with the same length and the same temporal interval. If I upsample each of the three time series through interpolation, that will cause aliasing. However, if I'm interested in the information embedded in the average of the three time series, is such an upsampling justified? In other wor...
Possible Duplicate: What are the differences between Factor Analysis and Principal Component Analysis I am trying to understand the difference between PCA and FA. Through google research, I have come to understand that PCA accounts for all variance, while FA accounts for only common variance and ignores unique varia...
I must clarify immediately that I am a practicing software developer, not a statistician, and that my college stats class was a very long time ago… That said, I would like to know if there is a method for accumulating a set of descriptive statistics that could then be used to produce a boxplot, that does not entail sto...
I have a little problem that is making me freaking out. I have to write procedure for an online acquisition process of a multivariate time series. At every time interval (for example 1 second), I get a new sample, which is basically a floating point vector of size N. The operation I need to do is a little bit tricky: ...
I work with amino acid sequences and I want to use a self-made model to tell me something about it, lets call it $f(\text{seq})$. Now i want to know the contribution of every position in the sequence onto the model, i.e. my question is what is the importance/effect of amino acid $A$ occuring at position $I$ in the sequ...
Say I make histograms H1, H2, H4 ...of the same set of data with bins 1, 2, 4 ... wide. Then the bins containing a given $x$ have counts and averages n1 av1 in H1, n2 av2 in H2, n4 av4 in H4 ... How should one weight these to estimate data(x) ? One possibility would be $\Sigma w_j \text{av}_j / \Sigma w_j$ with $w_j =...
This sounds like an easy setup, and I'm absolutely sure it's not too complicated to do, but somehow I can't figure out how to approach this. The setting is as follows : There are 6 treatments with 16 subjects in each treatment. Weight is measured for every subject before and after treatment. The hypothesis to be tested...
I have to do binary logistic regression with a lot of independent variables. Most of them are binary, but a few of the categorical variables have more than two levels. What is the best way to deal with such variables? For example, for a variable with three possible values, I suppose that two dummy variables have to be ...
The Cornish-Fisher Expansion provides a way to estimate the quantiles of a distribution based on moments. (In this sense, I see it as a complement to the Edgeworth Expansion, which gives an estimate of the cumulative distribution based on moments.) I would like to know in which situations would one prefer the Cornish-F...
It seems that lots of people (including me) like to do exploratory data analysis in Excel. Some limitations, such as the number of rows allowed in a spreadsheet, are a pain but in most cases don't make it impossible to use Excel to play around with data. A paper by McCullough and Heiser, however, practically screams th...
I am currently working on a model which takes two parameters and produces a measurement statistic. Think of it as Z = f(X,Y). Z is a matrix of my statistics and I am creating a surface plot of it in matlab. Basically, I am looking for a mathematical/analytical way of determining if the surface is smooth, or if it is j...
Question: From the standpoint of statistician (or a practitioner), can one infer causality using propensity scores with an observational study (not an experiment)? Please, do not want to start a flame war or a fanatical debate. Background: Within our stat PhD program, we've only touched on causal inference through work...
I'm a newbie at stats, so if I make any mistaken assumptions here please tell me. There's a population N of people. (For example N can be 1,000,000.) Some of the people are redheads. I take a sample n of people (say 10,) and find that j of them are redheads. What can I say about the general proportion of redheads in th...
I am building an android application that records accelerometer data during sleep, so as to analyze sleep trends and optionally wake the user near a desired time during light sleep. I have already built the component that collects and stores data, as well as the alarm. I still need to tackle the beast of displaying and...
I have an experiment that I'll try to abstract here. Imagine I toss three white stones in front of you and ask you to make a judgment about their position. I record a variety of properties of the stones and your response. I do this over a number of subjects. I generate two models. One is that the nearest stone to...
I am looking for the Hurst exponent calculation methodology. Please suggest online materials / methodology papers.
There are umpteen million research papers regarding relationships between various patient attributes (e.g. how does gene x affect condition y?). What I am interested in though is a distance metric between patients in toto. Sort of like if I were constructing a dating site, I'd want to know how similar two people are. (...
I'm working on a web app, and I'm creating some data viz tools for it. For one particular series, I've got an extremely wide variance in data values (0 to millions). We're using a column chart to view the data now, which of course results in some columns that are a pixel high or smaller. We already have some ways to sl...
I am not sure how this should be termed, so please correct me if you know a better term. I've got two lists. One of 55 items (e.g: a vector of strings), the other of 92. The item names are similar but not identical. I wish to find the best candidates in the 92 list to the items in the 55 list (I will then go through ...
See this Wikipedia page: Binomial proportion confidence interval. To get the Agresti-Coull Interval, one needs to calculate a percentile of the normal distribution, called $z$. How do I calculate the percentile? Is there a ready-made function that does this in Wolfram Mathematica and/or Python/NumPy/SciPy?
I have the following data, which is the output from the MS Hudson software. segsites: 6 positions: 0.1256 0.3122 0.3218 0.4970 0.5951 0.7943 001010 110101 010100 001010 010100 I want to make an R function to calculate the R-Squared across pairs separated by <10% (the difference between positions of SNPs must b...
I've been looking at some of the packages from the High perf task view dealing with GPU computations, and given that most GPU seem to be an order of magnitude stronger at performing single precision arithmetics than DP ones, I was wondering: why none of the packages gives more control to the user on the type of precis...
I am looking for an alternative to Classification Trees which might yield better predictive power. The data I am dealing with has factors for both the explanatory and the explained variables. I remember coming across random forests and neural networks in this context, although never tried them before, are there another...
For some of us, refereeing papers is part of the job. When refereeing statistical methodology papers, I think advice from other subject areas is fairly useful, i.e. computer science and Maths. This question concerns reviewing more applied statistical papers. By this I mean, the paper is submitted to a non-statistical/m...
I have two time series S, and T. they have the same frequency and the same length. I would like to calculate (using R), the correlation between this pair (i.e. S and T), and also be able to calculate the significance of the correlation), so I can determine whether the correlation is due to chance or not. I would like t...
Imagine the following common design: 100 participants are randomly allocated to either a treatment or a control group the dependent variable is numeric and measured pre- and post- treatment Three obvious options for analysing such data are: Test the group by time interaction effect in mixed ANOVA Do an ANCOVA with c...
Is it possible to load an S-PLUS Linux workspace in Windows? If I try it I get this error: "Problem in exists(name, where = db): This directory has both Unix style __nonfile and Windows style __nonfi" The __nonfi file is created when I first try to load that Linux workspace in Windows. Is there any way to convert it to...
As the title says, I'm looking for the marginal densities of $$f (x,y) = c \sqrt{1 - x^2 - y^2}, x^2 + y^2 \leq 1.$$ So far I have found $c$ to be $\frac{3}{2 \pi}$. I figured that out through converting $f(x,y)$ into polar coordinates and integrating over $drd\theta$, which is why I'm stuck on the marginal densities ...
Python matplotlib has a boxplot command. Normally, all the parts of the graph are numerically ticked. How can I change the ticks to names instead of positions? For illustration, I mean the Mon Tue Wed labels like in this boxplot: