instruction
stringlengths
9
38.7k
Problem: Two people are to arrive at the same location some time between 3pm and 4pm. They both arrive at random times within the hour and only stay for ten minutes. Since they only go one time, what is the probability that they will meet during that hour? I have found the correct answer to this problem here (the sec...
I came up with an idea to use machine learning for automatic grading of topic-specific texts. More specifically, I will first use normal text classification techniques to sort all candidate texts into topics. Then, I want to be able to judge the quality of texts in specific topics: For instance, news articles in diffe...
For purely personal reasons, I recently tried to write a Ruby script that pulled information about various school rosters, counting the numbers of freshmen...seniors on the team and using that data to spit out some information about the teams relative youth based on the amount of eligibility left. As far as I am concer...
So I'm trying to determine a semi-efficient way to calculate the optimal (recurring) frequency of a set of data. The data only exists at random time periods, but it is assumed that the data set is complete. For example: Say that we had data recorded every time a movie was watched, for which the viewer recorded their li...
A friend of mine asked me on how to do it in excel, and after playing with it a bit (and googling it) I gave up. Does any one have a suggestion on how it might be done?
I read a paper recently where the author compared the correlation coefficients (Pearson) between household budget and the type of meat purchased by male and female shoppers. So the correlation is between household budget and meat type purchase for males versus the same for females (i.e. comparison by gender). The auth...
I want to predict a factor and also get an upper bound for my prediction. It seems that what I want is prediction interval. but prediction interval only specifies the bound for one next prediction not all. Recently I found tolerance interval definition. Can I use it like prediction interval for future samples?
Recently we discussed on SO how to update a standard linear regression summary with NeweyWest standard errors. I used coeftestfrom the sandwich package. It was told to use unclass to update my already existing summary like this: library(sandwich) library(lmtest) temp.lm <- lm(runif(100) ~ rnorm(100)) temp.summ <- summ...
Say I have 2 * 2 contingency table where one of the cells is substantially larger than all the other cells, like this: P1 P2 C1 6 11 C2 81 12201 Is it appropriate to use Fisher's exact test here and can you point me to a reference defending that choice? If not, what would be a better test for significance?
I have a problem understanding a piece of a paper. Greatly appreciate any hint or help. It says: A sensor records $Z(i)$ at intervals of 1 second and calculates background values $U(i)$ using formula: $U(i)=RU(i-1)+(1-R)Z(i)$, where R is a constant factor and $U(0)$ is computed from pre-measurement data. Now, an...
I'm using bptest function of lmtest package to use Breusch-Pagan test. I get a strange result, doing the follow: > m <- lm(prices[,1]~prices[,2]+0) > bptest(formula(mod)) studentized Breusch-Pagan test data: formula(mod) BP = 0.458, df = 0, p-value < 2.2e-16 > m <- lm(prices[,1]~prices[,2]) > bptest(formula(m)...
I remember reading that, when estimating the autocorrelation function of a univariate ARMA time series using finite samples, the estimate is biased and specifically the lag-1 ACF is negatively biased in the case of iid observations. However, I can't recall the source and I am therefore not sure this statement is true. ...
I have three groups and I'm comparing two graphs in each group using the t-test: the absolute difference between two graphs in the first group is 34 with a p=0.024. (*) The absolute difference in the second group is 28 with a p=0.04 (*) and in the third group the absolute difference is 4 but the p value is=0.010 (**) H...
Assume a network as a set of data, which are defined by their coordination $(x,y,z)$ and a weight on its edge. Now this data can be used as an input data to predict a single value. In my case, coordination of nodes are mostly fixed, and just by changing subset of node I would like to predict the output. For example, i...
I would like to better understand the limitations of the MLR in regards to multiperiod data. Lets say I am looking at financial data for 10 companies, and each of those 10 companies has 5 periods worth of data, can I treat all 100 datapoints the same, or do I need to break it down into individual years? Additionally, I...
I have a function that plots (I think) various conditions within a set of motor racing timing data using boxplot: library(RCurl) gsqAPI = function(key, query, gid=0){ return( read.csv( paste( sep="",'http://spreadsheets.google.com/tq?', 'tqx=out:csv','&tq=', curlEscape(query), '&k...
Is there any justfification for producing a standard error of a single exponentially weighted coefficient? If yes, how can we interpret the p-value? Background I use SAS ETS to estimate a single exponential smoothing model. When i select the optimize option for the estimation of the smoothing weight I get the estimate...
Lets say I want to take the usual funnel plot for meta-analysis, and add another dimension to it, visually changing the points used for each study by a covariate. While it might be easier to change the marker or color for categorical variables, for a continuous variable, this gets a little harder. Lets say we want to s...
I am creating a card game AI for an iPhone game and I'm stumped trying to come up with this statistic. The deck has 4 suits. The cards are numbered 1-14 in each suit and there is one Joker. So, the deck has 57 cards. One player will be dealt 18 cards and this person will also get to decide which suit the Joker is (so...
I am in the process of imputing data (two variables that are 3 point Likert type responses and items of both variables yield multiple subscales). While these variables are ordinal variables, given that they are summed and/or averaged to create subscales, is it appropriate to simply use the SPSS MVA to impute item score...
This all pertains to my Psychology honours thesis. I have two groups (Autism and control) and all participants completed four tasks. It is very important to my study that the groups do not differ on reaction time in each of the tasks. However, they do. The autism group responded faster than the control group. This conf...
In these days I'm working with Breusch-Pagan to test homoscedasticity. I've tested the prices of two stocks with this method. This is the result: > mod <- lm(prices[,1] ~ prices[,2]) > bp <- bptest(mod) > bp studentized Breusch-Pagan test data: prices[, 1] ~ prices[, 2] BP = 0.032, df = 1, p-value = 0.858 Read...
Let us say I would like to adjust for centre effects in the analysis of data from a multicentre clinical trial. In the fixed effects approach one simply chooses one centre as reference and includes a dummy variable for each of the remaining centres. A problem with that method is that the number of parameters increases ...
Is it sensible to convert standard error to standard deviation? And if so, is this formula appropriate? $$SE = \frac{SD}{\sqrt{N}}$$
Possible Duplicate: Meaning of probability notations $P(z;d,w)$ and $P(z|d,w)$ Can you tell me the difference between $p(x \mid \theta)$ and $p(x; \theta)$? I know $p(x \mid \theta)$ is the conditional pdf, then what about $p(x; \theta)$?
I have two datasets, A and B, of weighted (x,y) pairs. I computed the best fit lines, L_A and L_B, respectively, of these datasets, and then computed the intersection of these two lines, (x*,y*). Now, A and B are drawn from random distributions (of the form y=mx+b+e, where e is a normally distributed error term). I'd l...
I am conducting a 2x2 within-subjects design. When I plot my results it appears that there will be an interaction between my variables but unfortunately none is emerging p=0.08. I find it a shame that I can't explore this further with simple main effects. Does anyone have any suggestions?
I have data on tariff rates and a proxy for tariff evasion (that is common in the literature). The data spans a couple of years before the country I'm studying implements a tariff reform and lowers its tariffs. The data also spans many years after the implementation of this tariff reform. Now I'm looking for a suitable...
I recently read a discussion about ARIMA models where someone said (referring to d as in ARIMA (p, d, q)): Its true that d=1 takes out deterministic trends when they are present (they would appear only in the drift term.) But it does more than that. I know that's not much context, but I seem to remember reading s...
Suppose that $X$ and $Y$ are two i.i.d. uniform random variables on the interval $[0,1]$ Let $Z=X/Y$, I am finding the cdf of $Z$, i.e. $ \Pr(Z\leq z) $. Now, I came up with two ways of doing this. One produces a correct answer consistent with the pdf here: http://mathworld.wolfram.com/UniformRatioDistribution.html, t...
Beginner user of R here struggling with a repeated measures ANOVA. I have a dataset that consists of one between subjects factor with 4 levels (coded in a single variable called 'groups'), and one within subjects factor with 4 levels (coded in four separate variables 'DV1', 'DV2', 'DV3', 'DV4'). I have the following o...
I ran four programs a, b, c, d parallely on two different machines X and Y separately for 10 times. The below is a sample of the data. The running-times (milliseconds) in 10 runs of each program are given under their respective names. Machine-X: a b c d 29 40 21 18 28 43 20 18 30 49 20 28 29 50 19 19 28 51 21 19 29 4...
I have no experience in forecasting, so can anyone give me a step-by-step example or link to example-real values with ARMA forecasting method application?
Let's say that I have twenty candidates in a political race and that I want to run tests on the success of each candidate based on a variety of voting systems. Is there a software that allowed me to do this, i.e. enter the candidates, pick voting system, run user tests, get results?
I need some advice on what is a reasonable number of cases to be deleted as outliers. I have applied outlier detection methods to identify univariate and multivariate outliers from my dataset. Alltogether 30% of the data was classified as outliers. If I delete all of these outliers, my results appear to improve. Also,...
I am using Wilcoxon test to compare two paired sets of data for whether their means differ. Besides the p-value, I would also like to know the power of this test. How to compute it in R? Thank you in advance.
I am trying to ascertain if a relationship exists between hours of play and number of friends. I have two contexts for the study: "at school" and "at a place other than the school". My data set relates to the "at school" context and the correlation r=0.8766 (significant). Now the difficult part.... As I want to focus ...
I have a data which contains several columns which I later reduced using a PCA algorithms to two different components. I then applied the k-means algorithms to the data. Now, how can I verify that my data clustered well into each group? Or how do I determine misclassification rate? For instance, using R, if I check ...
On electronics.stackexchange we had a question about constructing a True Random Number Generator. Since the method relies on noise, which isn't deterministic, the only way to test the quality of the RNG seems to be empirical. Not being a statistician I suggested to test a long bit sequence for normality, but I have no ...
I'd really appreciate help using Stata to perform a manual stepwise forward logistic regression. I have 37 biologically plausible, statistically significant categorical variables linked to disease outcome. I need to end up with a final multivariable model. I've added the first variable (most significant/most plausible...
Can somebody clarify how hidden Markov models are related to expectation maximization? I have gone through many links but couldn't come up with a clear view. Thanks!
I'm interested in modeling a generative process that encourages data to be "evenly distributed" over its support, i.e. clumping of data points is penalized. For example, if I have a mixture distribution and I set all components to have equal weight, it will tend to generate points equally between all the components, ...
I have a set of 50 million text snippets and I would like to create some clusters out of them. The dimensionality might be somewhere between 60k-100k. The average text snippet length would be 16 words. As you can imagine, the frequency matrix would be pretty sparse. I am looking for a software package / libray / sdk th...
Context I have been reading about item response theory, and I find it fascinating. I believe I understand the basics, but I am left wondering how to apply statistical techniques related to the area. Below are two articles that are similar to the area I would like to apply ITR in: http://www.jstor.org/stable/4640738?se...
I'm simulating an extremely rare event (the detection of weighted photon packets in a highly absorbing material). For example, I may simulate the transmission of 1e9 photons and only detect 10 of them (and their weights vary from $0^+$ to 1). I'm calculating the mean value of this occurring (what is the mean of $\sum w...
I am trying to find an appropriate method to examine the significant interaction effect in my hierarchial multiple regression analyses. I am looking at moderation analysis but most of of the methods (macros etc) do not take into account the covariates in my regression equations. I was advised to try out the Stata pr...
I am trying to do a meta analysis, involving continuous data. I am trying to do this meta analysis in Stata using the metan command. However, this data is organized in different fashions, where I have some studies with data listed as change in means with their standard errors and other data which is listed as the raw m...
I have a simple regression with price returns: $r_{t+1} = \alpha + \beta r_t + \epsilon$ My question is: do I need to do anything if $r_{t+1}$ and $r_t$ are over different horizons? Suppose the x-variable is a one month return but the y-variable is a 1-day return: do I need to adjust the variables to account for the d...
Using R or Excel, what is the easiest way to convert a frequency table into a vector of values? E.g., How would you convert the following frequency table Value Frequency 1. 2 2. 1 3. 4 4. 2 5. 1 into the following vector? 1, 1, 2, 3, 3, 3, 3, 4, 4, 5
I'm trying to run a zero-inflated regression for a continuous response variable in R. I'm aware of a gamlss implementation, but I'd really like to try out this algorithm by Dale McLerran that is conceptually a bit more straightforward. Unfortunately, the code is in SAS and I'm not sure how to re-write it for something ...
I need to sample starting positions in a DNA sequence of given length L. These starting positions represent starting points of functional domains in DNA sequences. They have a length of d. The starting positions should be distributed uniformly and must have a minimal distance of d between them (functional domains shou...
I am trying to explain a time series with the help of other related series. I really get nice fits using a standard LM approach with NeweyWest VC matrix. The fit even increases drastically when I replace some of the explanatories by higher lags (lag 10) of these explanatories (quarterly series) to the mix. Is it ok, ...
Context I have a dataset of 8 categorical variables. And I want to apply Categorical Principal Component Analysis (CatPCA). Before doing that, I have been advised to look at the transformation plots of all these variables after transforming them into nominal variables. This shows that some variables should be transform...
I have a large dataset which is made up of responses from 600 shoppers on 15 variables. When I tally the responses, it comes to 603. I know there were 600 respondents, so I must have recorded the responses of three people twice. Instead of checking each questionnaire against the dataset, can I run a test in Excel that ...
I am conducting an experiment on comparing the training effects on young and older adults (meaning it will be 2 independent groups). This also means it will be a repeated measure (within groups) because I will test the score before and after training. I think I should use mixed 2 way ANOVA. (Am I right?) However I will...
I have performed 61 Pearson correlation analyses between Variable A (buying ice cream) and Variable B (buying yoghurt) in my dataset (n=550). Each correlation is based on a different subset of the data (e.g., separate correlations for males and females; separate correlations for different age groups). Fortunately (or u...
I am developing automated trading systems for the stock market. The big challenge has been overfitting. Can your recommend some resources describing methods for measuring and avoiding overfitting? I started with training/validation sets, but the validation set always gets tainted. Also, the time series data is always c...
I am conducting an analysis into offending in relation to a time-dependent exposure - onset of heroin use, over a persons life. I am using poisson GEE with offending aggregate to a persons age-year. Many people have experienced time in prison, which means they can't experience the outcome, but are still experiencing th...
I tried to search info regarding this fact but I don't really understand why most of the standard goodness of fit tests (e.g. Kolmogorov-Smirnov, Anderson-Darling, a part of the Chi-square test, perhaps!) work only with continuous distributions. Can someone help me? Thank You.
I need a bit help for interpreting this results... I did a correlation analysis with R with the assocstats function. The result is: $summary Call: xtabs(formula = ~MH[, i] + MH[, j], data = MH) Number of cases in table: 2306 Number of factors: 2 Test for independence of all factors: Chisq = 2806.6, df = 3318, p-...
If I run Pearson correlation between Variable A (buyer/nonbuyer of ice-cream) and Variable B (buyer/nonbuyer of yoghurt) and have: Ho as "There is no relationship between...." Ha as "There is a strong relationship..." then what would "strong" mean in this context? Is the meaning of "strong" dependent on the context...
I conducted a study in which I collected the height, width, and weight of individuals from 9 different races (i.e I collected 10 to about 30 samples per race). How can I can display the distribution of the data for each group for a given variable (e.g., height)? I have thought of using histogram but then how do I hand...
As my previous questions I'm trying to solve a problem with my stocks tests. I tried Breusch-Pagan test for heteroscedasticity but some residuals still pass these tests. My procedure is: Get two stocks prices (I have a matrix with two columns that represent the price lists) I do a linear regression, like: lm(prices[,1...
Is it 'normal' to have two Pearson correlation coefficients which are statistically significant on their own but not when compared with each other. Example r=.9083 (n=45) for females who buy ice-cream and yoghurt r=.8382 (n=60) for males who buy ice-crean and yoghurt (The above correlation is between buying ice-crea...
I'm reviewing a paper where the authors compare the survival of an insect fed on three different diets. Following the survival analysis (using Surv) they perform multiple comparisons of the mean survival among the treatments using the contrasts procedure from Crawley's The R book. They present their results a la a Tuke...
Possible Duplicate: Heteroscedastic test does not solve the problem I have two list with around 700 daily prices(each) I would use a garch (1,1) model and check if the variance is constant during all the period, how could I do? Thanks
I am trying to update my lm() based model to get correct standard errors and tests. I am really confused which VC matrix to use. The sandwich package offers vcovHC , vcovHAC and NeweyWest. While the former only accounts for heteroskedasticity the latter two account for both serial correlation and heteroskedasticity. Ye...
I recognize that there are many types of averages. That said, does "x per y" (e.g. visits per day) always refer specifically to the arithmetic mean? For some context, I saw this recently where someone claimed the cited figure was actually in reference to a median. While I think it might have been OK to use the median...
I have a 2(truthfulness) x 2 (immediate test) study where I am looking to compare 2 logistic regression models. Both are classifying the same outcome variable: truthfulness (truthful versus deceptive -- an experimental manipulation where they were told to tell the truth or lie). The independent variable in both is a s...
Possible Duplicate: Is there any reason to prefer the AIC or BIC over the other? Can anyone please interpret each term in AIC, BIC and KIC. And the difference between the three. Thanks in advance,
I am completely new to R, just downloaded and installed it today. I am familiar with SAS and Stata; I am using R because I have found out that in survey regression analysis, R is capable of using data that have stratum with one PSU. However, I cannot figure out how to write the code at all. Here is what I have done so ...
I know I can subdivide a dataset by socio-demographic factors such as gender, age, income level etc. and analyse the responses for each set separately and then compare the results. For example, I am testing the relationship between Variable A (hours of study) and Variable B (exam marks), and I have a dataset made up of...
I was reading in "A Guide to Econometrics" that given $Y = X \beta + \epsilon$, the variance covariance matrix of $\beta^\text{OLS}$ is given by $\sigma^2 (X' X)^{-1}$ where $\sigma^2$ is the variance of the error term... it then says that in the case of a single regressor $y = \beta_1 + \beta_2 x$, that this simplifie...
I would like to know if there are any rules to determine if Pearson's r correlation values are similar to Spearman's rho? For example, if r = -.207 and rho = -.282, are these similar enough to just report r?
I'm looking to cluster a small data set (64 observations of 4 interval variables and a single three-factor categorical variable). Now, I'm quite new to cluster analysis, but I am aware that there has been considerable progress since the days when hierarchical clustering or k-means were the only available options. In ...
For example I have vectX and vectY, and I want to know: Which is the better model fitting for my data -- it can be linear, exponential, or parabolic. If my result is significant. I am doing it like this: #response exponentiel expFct2 = function (x, a, b,c) { a*(1-exp(-x/b)) + c } #response parabola expFct3 <- ...
Anyone knows any R package/function to run a reaction norms model for the analysis of genotype × environment interactions? I don't know if shuch models could be performed using the lme4 or the MCMCglmm packages.
Libre Office has an easy way to calculate and show trade line in a graphic (i.e. right-click on data series and insert trend line). Formatting the graphic this way however is not really easy because the linear regression cannot be shown without the data series and drawing the linear regression only is precisely what I ...
what is the most appropriate software for building an ARMA forecasting model? EViews, Minitab,...? Best, Milos
I have a dataset with library document holdings per publicationyear, which I can query for the frequency of terms, subjects, etc. That allows me to construct times-series of the "popularity" of certain academic terms in the overall library corpus. However, there are various effects at play, at least a growth in overall...
My dataset comprises of 400 respondents. They are shoppers from different sociodemographic backgrounds. I asked each of them (among other things) how likely or unlikely they are to purchased ice-cream. Similarly, I asked them how likely or unlikely they are to purchase yogurt. They responded on a five point Likert sca...
I used a least squares method on my data set, using the lsqr Matlab function. I know that the norm of residuals is a measure of the goodness of fit, but how can I assess whether the value of the norm of residuals is "good"? Which is the range of this measure?
I am used to make my data plots with R and to save the results to static files but now I have a data set with far too many data points and I need to explore it. Due to this I need a recommendation for an interactive tool for plotting (2D) data. It should be able to interactively filter and search points by additional f...
Possible Duplicate: Working with correlation coefficients If I do Pearson correlation on Variable A (e.g. study hours) and Variable B (e.g. exam marks) for male students and female students, and I want to compare males with females, do I do a t-test or simply compare the correlation coefficients. Which is the better...
I'll eliminate all the biological details and experiments and quote just the problem at hand and what I have done statistically. I would like to know if its right, and if not, how to proceed. If the data (or my explanation) isn't clear enough, I'll try to explain better by editing. Suppose I have two groups/observation...
I have tried several times to "go it on my own" - but with limited success. I am a casual SPSS user and have some SAS experience. Would appreciate a pointer or two from someone who has similar background and now uses R.
I'm working at a company developing web applications and due to the load on our testing team that can execute and analyze A/B or multi-variate tests, we're being asked to run "before and after" tests--also called "launch and learn" tests. With these before and after tests, if we make a change to a web page, we're being...
I didn't quite get the Wikipedia explanation here: http://en.wikipedia.org/wiki/Paired_difference_test#Use_in_reducing_variance I agree that both the unpaired and paired means are the same...then I see how $\text{var}(\bar{Y_2} - \bar{Y_1})$ will include a covariance term..but what is the alternative variance? Take th...
In my research, I'm summing a bunch of non-independent, not identically distributed random (0,1)-variables $X_1,X_2,\ldots,X_n$ with corresponding probabilities $\pi_1,\pi_2,\ldots,\pi_n$. The resulting distribution is multimodal, and I want to show that the multimodality is caused by the dependence. In an attempt to ...
I am attempting to evaluate and compare the profit factor of different "test runs" of a FOREX trading strategy. My problem is that, despite an average time between orders of 2hr+, some of these runs can have 20+ orders in a row, every 5 minutes, in the same direction. I need some way to normalize these clusters that oc...
Are there any good books that explain important concepts of probability theory like probability distribution functions and cumulative distribution functions? Please, avoid referring books like "Mathematical Statistics and Data Analysis" by John Rice which start with simple permutation concepts and then, suddenly (in 2...
I'm pretty new to statistics and I need your help. I have a small sample, as follows: H4U 0.269 0.357 0.2 0.221 0.275 0.277 0.253 0.127 0.246 I ran the Shapiro-Wilk test using R: shapiro.test(precisionH4U$H4U) and I got the following result: W = 0.9502, p-va...
Disclaimer: I am a software developer and I like stats but I'm not a professional statistician, I already experienced that my wording is not always the correct jargon. Please keep in mind. I would like your opinion on how to build a concrete statistical model: The Goal Why am I doing this: I need to assess the reliabil...
Maybe someone can help me or at least give me some clues. I have 1057 patients all with different types of prostheses. One of them seems to have a higher revision rate than the others. total numbers: prosthesisA 662 prosthesisB 162 prosthesisC 151 other 82 revision rate: prosthesisA 9 1,36% prosthesisB 11 ...
I can calculate Sidak correction of the p value in Excel but is there a quick way to do it by hand? I am looking for something similar to calculating the margin of error by hand, i.e. dividing 1 with the square root of the sample size.
I was reading the short intro to nonlinear regression in R by John Fox (Link) and was wondering where the formula for the variance of the coefficients come from (page 1). The formula for the variance-covariance matrix looks like linear regression but the predictor matrix X in that typical formulation is replaced by the...
Possible Duplicate: Calculating required sample size, precision of variance estimate? I would like to present some measure of how variable a particular phenomenon is. This phenomenon appears to be normally distributed, so a reasonable measure of variability might be variance. I've seen people report variances before...
I am attempting to run an OLS regression: DV: Change in weight over a year (initial weight - end weight) IV: Whether or not you exercise. However, it seems reasonable that heavier people will lose more weight per unit of exercise than thinner people. Thus, I wanted to include a control variable: CV: Initial starting...
Does anyone know which is the best bayesian network program for mac that has a graphical interface and is free?
I'm a newbie to statistics and R and I have a trouble with using Levene function (I would like to check the equality of variance of two samples). The documentation says that I should run: levene.test(y, group) But I have no idea what I should put as y and group? I have two different samples which of I would like to ...