Use this tag for any *on-topic* question that (a) must have an `R`-based solution yet (b) is not *just* about how to program in `R`.

learn more… | top users | synonyms

1
vote
2answers
90 views

How to use the chi-squared test to determine if data follow the Poisson distribution

The figure below (Figure 1 from p. 646 of this paper) compares observed values against expected values under the Poisson distribution. It then runs a chi-squared test to see if the observed values ...
2
votes
1answer
83 views

How important is the correlation coefficient's variance in linear regression?

R doesn't return the correlation coefficient's variance (or standard error) when coding summary(linmod), linmod being a linear ...
1
vote
0answers
34 views

How to augment lpsolve R optimization solution to run on a hadoop cluster? [closed]

I asked same question on stack overflow but didn't get quite a lot replies...wondering if this forum is better.. I am using R lpsolve package to optimize my transportation model. My code runs fine ...
2
votes
1answer
37 views

The effect of ommission of relevant variable in the regression model on adjusted $R^2$

Let's say I have two regression models (I) $y_t=\beta_1+\beta_2 x_2+u_t$ (II) $y_t=\beta_1+\beta_2 x_2+\beta_3 x_3 + u_t$ How the omission of relevant variable (not irrelevant variable) affects ...
0
votes
0answers
11 views

Importing data into R from google spreadsheet [migrated]

There seems to be a change in the google spreadsheet publishing options. It is no longer possible to publish to the web as csv or tab file. Thus the usual way to use RCurl to import data into R from a ...
2
votes
0answers
20 views

local linear quantile regression using R

I am supposed to follow the paper of Yu and Jones (1998) for nonparametric estimation of conditional quantile functions. It is in particular the local linear model which they called "local linear ...
0
votes
1answer
21 views

Receiving Error while trying Habitat Modelling with dismo on R

I am trying to do habitat modelling using dismo package on R. I performed glm() as follows: ...
0
votes
0answers
8 views

Need help using subset within lineplot.CI function in R [migrated]

I am a statistics and an R novice who is learning alot about both using RStudio. I have a imported a dataframe with the data in long form for mixed effects ANOVA on a longitudinal balanced study ...
0
votes
1answer
32 views

glm inflated error…why?

I'm pretty new to stats, so this may be dumb. I've been running a bunch of models on randomly generated data to try and develop my understanding of type 1 error. I've noticed that using ...
1
vote
0answers
56 views

R-How to generate random sample of a discrete random variables? [migrated]

In R, I want to generate a random sample of a discrete random variable: $X$, where: $P(X=a)=P(X=-a)=1/2$. I have been searching for a function online but there seems no direct function doing this.
0
votes
0answers
14 views

Do I need a planned contrast or post-hoc analysis when doing LMM in R?

I am doing a LMM in R and would like to know if I need to do a planned contrast or a post-hoc analysis. From my understanding, the LMM in R already provideds me a planned contrasts and if I have ...
0
votes
0answers
5 views

Best method to fit a GEV distribution with generalised linear modelling of parameters?

I need to fit a generalised extreme value distribution to my data but I want the ability to perform generalised linear modelling of the parameters, particularly the location. Can anyone recommend the ...
0
votes
1answer
48 views

Forecasting time series regression in R using lm

I would like to predict using a linear model in R. The model that I have is of the form lm(y~ lag(x)). It seems like I should be able to predict using the predict ...
0
votes
0answers
12 views

Calculate the correlation between a principal component and a feature of the original data set in R?

I am interested in seeing the correlation between a particular principal component and a particular independent variable in my 'original' data set, that is, I'd like to calculate $\rho_{Y_{i},X_{k}} ...
0
votes
0answers
24 views

What's wrong with my jackknife procedure in R?

Well, the reason I think my jackknife procedure is wrong is that it gives me the same graph as the residuals. Here's the problem description: Use a loop to create n=50 models. In step i, make a model ...
0
votes
0answers
15 views

Including squared predictors in model matrix [migrated]

I have the following code x <- c(1, 2, 3) y <- c(2, 3, 4) z <- c(3, 4, 5) df <- data.frame(x, y, z) model.matrix(x ~ .^4, df) This gives me a model ...
0
votes
0answers
22 views

Method of Composition to sample from a t density

I got stuck with this, I will appreciate a lot any help. I need to make an R program in order to run this algorithm (in the photo below), with simulated data. The question is to use the method of ...
0
votes
0answers
42 views

ANCOVA in R and setting contrasts

Using the following data, I need to determine if, independent of mass, the observed response is associated with sex, location, and/or age ...
1
vote
1answer
34 views

Poisson GLM vs Quasi Poisson GLM

I have a Poisson GLM in R that is over dispersed, so I fit a quasipoisson GLM, however the residual deviance nor the degree of freedom change. Can that happen? What does it mean in that case? Thank ...
2
votes
2answers
59 views

Same dataset analysed with four different linear models

I've analysed the same dataset (diamonds from ggplot2) in R with four linear models. Each model has a different error structure. ...
0
votes
0answers
17 views

How to predict logistic model by accounting for the error distribution?

Suppose I have a logistic model such that: ...
1
vote
2answers
65 views

Clear steps to calculate coherence between two time series

I originally posted this on stackoverflow.com and then deleted it and moved it here My question is similar to Similarity of two discrete fourier tranforms (specifically the selected answer). I've ...
0
votes
0answers
18 views

Please provide an example of when bootstrap has less bias than classically approximated estimates?

The recent question "Why does my bootstrap interval have terrible coverage?" has got me wondering if anybody has some really good examples of distributions in which bootstrapping standard errors ...
0
votes
1answer
22 views

Residual structure in Linear Mixed Models with Random effects

You can further improve a linear mixed model with random intercept and slope by specifying a structure in the residuals (for example AR(1)). In SAS it is possible, but I hope this is also already ...
0
votes
0answers
38 views

How to interpret output from nparcomp in R

I have skewed data requiring non-parametric tests. Following Kruskal Wallis tests, I want to carry out post-hoc analysis. I have chosen nparcomp within R because of ...
4
votes
1answer
238 views

Testing large dataset for normality - how and is it reliable?

I'm examining a part of my dataset containing 46840 double values ranging from 1 to 1690 grouped in two groups. In order to analyze the differences between these groups I started by examining the ...
1
vote
0answers
11 views

Analysis of rates and post hoc test with offset variable using glmer.nb

I am investigating variation in pollinator visitation rate (number of visits per inflorescence) with treatment and time category as fixed factors. Block is a random factor. Following Zuur et al. ...
2
votes
0answers
17 views

3D plot of the residual sum of squares in linear regression [migrated]

I'm trying to reproduce Figure 3.2 from the book Introduction to Statistical Learning. Figure describes 3D plot of the residual sum of squares (RSS) on the Advertising data, using ...
1
vote
1answer
23 views

R - How to smooth a conversion of weekly sales into daily sales?

I have weekly sales figures, and would like to convert them into daily sales figures, making a simple hypothesis that there are 7 days with equal sales "power". Let's imagine that I have: ...
1
vote
0answers
16 views

Clustering Techniques

I'm a little new to data mining and would definitely appreciate some tips. I'm using clustering algorithms looking for possible grouping in some variables described below. I've been using the Excel ...
2
votes
1answer
75 views

Relative importance of a set of predictors in a random forests classification in R

I'd like to determine the relative importance of sets of variables toward a randomForest classification model in R. The ...
2
votes
0answers
34 views

Multilevel data with correlation within subjects

I have a dataset with 1206 deputies from two different chambers (1998 and 2002, respectively). In addition, there are 18 parties, and some deputies are in both chambers (the ones who were reelected). ...
1
vote
0answers
9 views

Creating a table with individual trials from a frequency table in R (inverse of table function) [migrated]

I have a frequency table of data in a data.frame in R listing factor levels and counts of successes and failures. I would like to turn it from frequency table into ...
1
vote
1answer
56 views

What is the meaning of the beta-coefficient for an interaction term in a crossover study?

I have asked a similar question here: stackoverflow I am puzzled by the interpretation for an interaction term. In my data my Y is an interval variable with the health outcome of an experiment. I have ...
1
vote
0answers
15 views

Method for analysing effect of model input

I work with a mechanistic model that uses climate data to simulate some specific output for different time steps and spatial locations. Now I want to investigate the effect of different climate data ...
0
votes
1answer
43 views

Good way to plot a variable between conditions with multiple measurements

I've a frame containing Participant----Condition----Duration Participant1,One,2000 Participant1,One,2780 Participant1,One,200 Participant2,Two,2000 Participant2,Two,2340 ...
0
votes
0answers
13 views

SMOTE implementation in R

I am working on an imbalanced classification problem (about 90 thousand records total, of which 2% are target = Y and remaining are target = N). My dataset has been prepared in SAS Enterprise Guide ...
0
votes
0answers
47 views

How do I get coefficients of a random forest model?

I am using randomForest to generate a model, and at the end I don't know how I can get the final coefficients that the model is fitting. I know that for linear ...
2
votes
2answers
106 views

Special method for forecasting on time-series clusters in R?

I'm doing a project related to identifying sales dynamics. My database contains 26 weeks after launching the product (so 26 time-series observations equally spaced in time). I used two methods ...
4
votes
0answers
49 views

Compute and graph the LDA decision boundary

I saw an LDA plot with decision boundaries from The Elements of Statistical Learning: I understand that data are projected onto a lower-dimensional subspace. However, I would like to know how we get ...
0
votes
0answers
6 views

Ideas to re-write looping regression with 'for' loops [migrated]

I'm having a brain freeze, and hoping one of you can point me in the right direction. My end goal is the output of various regression coefficients (mainly interested in price elasticity), which I ...
1
vote
0answers
32 views

R: What do I see in partial dependence plots of gbm and RandomForest?

Actually, I thought I had understood what one can show a with partial dependence plot, but using a very simple hypothetical example, I got rather puzzled. In the following chunk of code I generate ...
1
vote
0answers
15 views

Johanson test conditions and Breusch-Godfrey LM test

I am a student from Belgium and I am making a thesis about the relationship between credit aggregates and property prices. I examine the Granger causality between the two variables and I also do some ...
0
votes
0answers
10 views

Multiple comparisons with Dunnetts t3 or Dunnetts c

I have a dataset with un-even variance and un-equal class sizes (This was a random sample of land cover classes). After using ANOVA to determine significant differences exist among classes, I ran ...
1
vote
0answers
32 views

Comparison between normal glm and glm.nb regression with quadratic term?

Let's say I have a function to simulate data for negative binomial regression: ...
0
votes
0answers
26 views

How to interpret the LDA output in R?

Basically, I have following LDA output (below). My question is how do I actually interpret it ? I could not find much resources on the web. Especially, what does "Group Means" really mean here ? I was ...
1
vote
0answers
30 views

R package kernlab probabilities seem not to match decision

For a classification problem I am giving the R package kernlab a shot – not the least because it offers to calculate class probabilities instead of only a plain decision. However, comparing results ...
0
votes
0answers
22 views

How do the ROC cutoffs relate to predictors?

Apologies for this rather simple question, but I haven't been able to find a definition online. What does the ROC cutoffs represent for the AUC package? Specifically, how does it relate to the ...
1
vote
0answers
29 views

I want to study the effect of the normality assumption on intervals like t-confidence interval and $\chi^2$ interval.. by using R

I want to study the effect of the normality assumption on intervals like t-confidence interval and $\chi^2$ interval.. (1) Generate 1000 random samples from a normal population $N$($\mu$,$\sigma$). ...