Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

learn more… | top users | synonyms

0
votes
1answer
725 views

Change and outliers detection by means ARIMA (Tsay procedure)

I have a question about automatic on-line outliers and change point detection in time series data. Now I read the paper: "Outliers, Level Shifts, and Variance Changes in Time Series" Ruey S.Tsay It's ...
2
votes
1answer
254 views

Adding decays to time series in R

Working with my time series data I need to add decays to a certain variables. That is, when the variable consists of a series of impulses, I need to prolong these effects of these in order to better ...
0
votes
1answer
70 views

Simulated single value based on multiple chains in RJAGS

I am using RJAGS to simulate the posterior distribution of event that a certain candidate will win the presidential election. I need to find the actual percentage that one of the candidates will have. ...
0
votes
1answer
48 views

Explain the distribution of these random variables?

Suppose I have 3 eggs, with independent hatching times (in minutes) following an $\text{Exp}(0.05)$ distribution, and A is defined as the earliest hatching time. If I were to plot A, how would I ...
1
vote
0answers
640 views

Matching results completely different in R and Stata

I am trying to match treatment with the control using the R Matching package for the data set nuclearplants (which is available in ...
3
votes
1answer
2k views

LOESS and MA normalization in R?

Attempting to do loess on two variables x and y in R using MA normalization(see MA-plot; see also Bland-Altman or Tukey mean-...
4
votes
1answer
3k views

VIF values and interactions in multiple regression

I am running a multiple regression of the form y~a+b+c+ab+ac+bc I have checked the VIF values for the direct effects - should I check them for the interactions? I am assuming not as that would ...
2
votes
0answers
271 views

Modeling spatial correlations with multilevel data

I have ~5M records of spatial polar coordinates (r and theta). These 5M records are from 400 different 'locations' that I have ~150 variables for (no NAs). I also have 1 binary variable used to flag ...
1
vote
1answer
101 views

TBATS requires positive data after differencing - forecast package R

I need to difference the series once to get a stationary series but then cannot run the tbats function because my differenced series has negative values. Does anyone know of any way of handling with ...
13
votes
1answer
8k views

What is an acceptable value of the Calinski & Harabasz (CH) criterion?

I have done a data analysis trying to cluster longitudinal data using R and the kml package. My data contains of around 400 individual trajectories (as it is called in the paper). You can see my ...
1
vote
1answer
1k views

How to interpret statistics (Emax, D, U, Q, B, etc.) of bootstrap validation of logistic regression

I'm only a linguist, so my knowledge of statistics is very basic. I fitted a logistic regression model with R (with lrm(formula, y=T, x=T)), and when I use the ...
0
votes
1answer
762 views

R: Density estimation vs Histogram Estimation

To draw random samples from a custom distribution, I recall reading that KDE's are better than histograms. (See hadley's comment here.) When I experimented in R, I am finding that the KDE method ...
1
vote
2answers
173 views

Sparse hyperspace clustering

I have a dataset of M elements where every item is represented by a feature vector of length N where N is very large and only a small subset of N is bigger then zero for every item. So I have a sparse ...
0
votes
1answer
142 views

Alternatives to svychisq() in survey

A time ago I posted this question. Now I have a 'little' continuation: I'm having some difficult with a few questions, getting this error message: ...
4
votes
1answer
990 views

A Poisson EM clustering algorithm in R?

I've been looking for a Poisson expectation-maximization clustering implemented in R. Does anyone know if there is one available or can point me in the right direction? thanks! and please let me ...
1
vote
1answer
195 views

Backfilling ARIMA data with exogenous variable

I have time series data for a set of cities that goes back for about 10 years. I also have the data at the state level for almost 30 years. There was an event that occurred about 20 years ago, that is ...
4
votes
1answer
611 views

Fitting t distribtution to financial data

The data I am using can be found here: http://uploadeasy.net/upload/nwv0.rar The variable is called "alvsloss". I want to fit a distribution to my financial data. First of all, I started with a ...
1
vote
1answer
448 views

Relative density plots in R

I have a dataset with two classes, A and B, and an independent variable x. Class B is a minority class with only 1% of the observations, which tend to occur with small values of x. I am interested in ...
0
votes
0answers
349 views

Fitting Weibull regression with ancillary shape parameter in R

I am trying to replicate a Weibull model for political leaders' survival in R. The model uses the Weibull distribution with the hazard rate h(t)=lambda*pt^(p-1). ...
0
votes
1answer
3k views

Post Hoc test for between subject factor in a repeated measures ANOVA in R

I have done an experiment of how different animal species affect nutrient fluxes in sediments. I had a number of experimental units (sediment boxes) to which different animal species were added. I ...
2
votes
0answers
86 views

What tasks should I do when performing a model validation?

I have a mixed model built using Data A below, and now I want to validate the model using Data B. What should I do to actually "validate" the model? ...
8
votes
1answer
4k views

Unable to fit negative binomial regression in R (attempting to replicate published results)

Attempting to replicate the results from the recently published article, Aghion, Philippe, John Van Reenen, and Luigi Zingales. 2013. "Innovation and Institutional Ownership." American Economic ...
3
votes
2answers
4k views

Standardized residuals in R's lm output

I have a quick question: if I plot the diagnostic plots to an R regression, a couple of them have "Standardized Residuals" as their y-axis such as in this plot: My question is this: what are the ...
2
votes
0answers
58 views

Zero to one proportion data, with quadratic term?

I have a data set with the following: N = 60; x = developmental stage (range 25 to 44); y = proportion of 10 minute trial performing a behavior (range 0 to 0.81; 30 zeros) A scatterplot produces a ...
4
votes
2answers
436 views

Summary of residuals in R

Disregarding "Deviance" in the image, the output of multiple regression analysis in R looks pretty much like this. As far as I understand, residuals are errors. Do the 5 value summary refer to ...
0
votes
1answer
167 views

How to compute df for ARIMA models?

Running this example from Hyndman's textbook in Chapter 9.1: ...
3
votes
1answer
462 views

What are the assumptions for checking the stationarity of a time series?

I am checking stationarity or non-stationarity of a time series with R and I am using adf.test and kpss.test in ...
1
vote
1answer
1k views

How are the p-values of the GLM in R calculated?

I have been running some binomial logistic regressions in R on a data set and I realised that the p-values of the estimated coefficients are not computed based upon a Normal distribution. For e.g. I ...
2
votes
1answer
4k views

ARIMA double seasonality with dummy in R error xreg

I'm playing with hourly univariate data and try to fit an arima model with more than one seasonality (daily, weekly) using a dummy for the weekly seasonality. I found a very good post explaining a ...
0
votes
1answer
249 views

Negative value in shape parameter of gev.fit

I got negative value for shape parameter by using gev.fit in ismev package of R. What does it indicate? Does it mean that it ...
2
votes
1answer
644 views

How to perform step() when n < p in R?

I am trying to perform stepwise regression for variable selection in R. In matlab, the stepwisefit function is able to work in ...
5
votes
2answers
2k views

IRT in R: Does anyone know of an IRT item calibration function that can cope with NA's?

I have a dataset that looks like this. ...
2
votes
2answers
745 views

Should a mixed effects model be used?

This post provides an excellent example of the inner workings of a mixed effects model: http://emhart.github.com/blog/2012/11/16/making-sense-of-random-effects/ In a hypothetical study, I have ...
2
votes
1answer
3k views

How does one define own intercept in regression model in R?

My case is that I have one continuous DV variable and two categorical IVs containing 11 and 12 different levels (YEAR & MONTH) form 1998 to 2008. Until now I have experimented a lot with ...
2
votes
1answer
115 views

Explanation of a step in derivation of residuals for R lm diagnostic?

I'm reading Faraway's book (http://cran.r-project.org/doc/contrib/Faraway-PRA.pdf) to try to understand R's lm diagnostic plots. On page 72 of the book is this: I have been trying to understand a ...
3
votes
1answer
671 views
1
vote
1answer
292 views

Poisson regression - dealing with widely different population sizes

I have a dataset of counts (responses to a marketing campaign), collected at the zipcode level. I am trying to use a poisson regression to determine underlying response rate of each zipcode. How do ...
2
votes
2answers
1k views

Sampling from the normal-gamma distribution in R

Does anyone know of a way to sample from the normal-gamma bivariate distribution or the normal-inverse-gamma bivariate distribution in R? I could create the distribution myself as a function, but ...
1
vote
0answers
682 views

Providing the actual measured error instead of weights to the lm function in R (or similar linear fit function)

Is there any way to use the linear fit function or R with my own errors instead of the value weights? That is, I have a physical experiment in which we know the errors for each point, for instance: <...
0
votes
1answer
158 views

Random geometric graph connectivity

Given N random points uniformly distributed in the unit square, and a distance d, i can generate a matrix in the following format: ...
2
votes
1answer
288 views

Unbalanced Haar Wavelets and R package unbalhaar

I have found the article by Fryzlewicz (2007) and his R package unbalhaar. I do not understand well the outputs of his functions and in particular of the ...
0
votes
1answer
1k views

Checking confidence intervals on user defined contrast (one-way ANOVA)

Hi is anyone able to help - I am doing this all in R Code: I have run one way analysis on some data and set up 2 contrasts (Liberarts-Finearts and also Engineering-science). I now need to calculate ...
24
votes
5answers
85k views

R - QQPlot: how to see whether data are normally distributed

I have plotted this after I did a Shapiro-Wilk normality test. The test showed that it is likely that the population is normally distributed. However, how to see this "behaviour" on this plot? ...
1
vote
1answer
264 views

How do I fit a constrained regression in R?

I have a formal model from which I'm deriving some parameters that I would like to estimate. I haven't done this kind of thing before, and I'd like to have some help to solve this issue in R. I ...
1
vote
2answers
8k views

R linear regression test hypothesis for zero slope

I'm working with some data and I used R to the a linear regression model Y = aX + b. The code I used was summary(lm(Y~X)) What I ...
4
votes
1answer
2k views

How to specify a contrast matrix (in R) for the difference between one level and an average of the others?

I have a regression model that looks like this: $$Y = \beta_0+\beta_1X_1 + \beta_2X_2 + \beta_3X_3 +\beta_{12}X_1X_2+\beta_{13}X_1X_3+\beta_{123}X_1X_2X_3$$ ...or in R notation: ...
5
votes
2answers
3k views

How does cross validation work in R's gbm package?

Can someone provide a work flow about this? For instance, suppose I am doing binary classification, For each iteration of the algorithm: Randomly sample k*N rows,...
2
votes
1answer
2k views

How to interpret cumulative periodogram?

I use cpgram function in R to produce a cumulative periodogram of a monthly time series. Its horizental axis is a number between 0 and 6 labeled as frequency: what ...
5
votes
3answers
1k views

What's the difference between a component and a factor in parallel analysis?

The psych package in R has a fa.parallel function to help determine the number of factors or components. From the documentation: ...
4
votes
3answers
2k views

Binomial GLM and different sample sizes

I have a data set which consists of binomial proportions, let's say the success rate of converting a customer depending on the advertisement, the customer age, and various other factors. For some ...