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

0
votes
0answers
17 views

Multiple Imputation and prediction

hopefully someone has an idea regarding the following problem: I did a multiple imputation using the mice package - now just one step is left: I want to generate final and "valid" imputations for my ...
2
votes
1answer
96 views

Detecting heteroscedasticity - Can I use Breusch-Pagan Test on binary logistic regression?

I'm currently testing a (binary) logistic regression model, which seems to have at least some issues with multicollinearity. Now I don't really trust the data anymore and would like to also test it on ...
0
votes
0answers
26 views

Predicted values for fixed effect quantile regression

I'm currently working with the method proposed by Koenker (2004) and Lamarche(2010) on fixed effects for quantile regression, for this I'm using the RQPD code in R. I would like to get the predicted ...
0
votes
1answer
54 views

Extracting the model p-value for a multiple regression in R

When fitting multiple variables to one outcome via the lm() function in R, summary(lm) gives me the p-values for individual ...
0
votes
0answers
17 views

Repeated Measures Anova in R

If I have multiple entries for a certain subject-treatment combination, will the aov() function correctly handle these entries when running a repeated measures ANOVA? For example, suppose the table ...
0
votes
0answers
24 views

How to interpret log-likelihood outputs from MASS::fitdistr (R)

AIM: Fit the best distribution to columns in a dataset (30k records) so that I can to go on to produce test data that is in a similar distribution. WHAT I'VE DONE SO FAR: Using R, I have found and ...
0
votes
0answers
24 views

R forward stepwise regression [migrated]

In R stepwise forward regression, I specify a minimal model and a set of variables to add (or not to add): ...
0
votes
0answers
6 views

Cannot link gfortran and R on Mac mountain lion when creating shared objects? [migrated]

I am using MAC OSX Mountain Lion 10.8.5 with Xcode 5.1. I have installed command line tools in Xcode. I tried the gfortran-4.2 found here. It worked OK on my Mac if I ran complete fortran programs, ...
0
votes
0answers
15 views

Creating folds for k-fold CV in R using Caret [migrated]

I'm trying to make a k-fold CV for several classification methods/hiperparameters using the data available at ...
3
votes
1answer
55 views

Simulate the distribution of the median

I have done part(a); now I need to do part(b): I want to simulate the distribution of the median $M$ using R. I don't know how to work it out. And for part(c), do I need to use R as well? This is ...
1
vote
0answers
79 views

Monte Carlo integration

I am calculating a simple integral $\int^1_{-2} \exp{x^2}(x+1)dx $ with Monte Carlo method using a linear density function $p_\xi (x) = \frac{4}{9} + \frac{2}{9} x $. Let say I have a a sample which ...
0
votes
0answers
12 views

How to convert the wilcox.test W value output for two independent groups to U in R? [duplicate]

I need the U values of Mann-Whitney test, but the wilcox.test in R outputs only W values. I do not think they are identical, so here is my question - how to convert W to U?
0
votes
3answers
70 views

Multi-peak Gaussian fit in R

I have a large data set composed of several "independent" data frames like this one ...
1
vote
1answer
66 views

Forecasting with holiday dummy variables

I have an example of call center data for 2013. There are 261 days of data (excluding weekends). For 2013, I have included a holiday dummy variable (holiday) for ...
0
votes
0answers
15 views

Interpretation of three-way interaction in an output of lmer

I am using lme4 to run a three-way interaction model. I have three independent variables: animal (rat, lion, dog), color (red, green, blue) and sex (male, female). The baselines are as follows: ...
3
votes
1answer
76 views

Using glmer to estimate treatment interactions

In my data, I have two treatment conditions with repeated measures for each subject. I would like to run a mixed logistic regression separately for each of my two conditions where my binary outcome DV ...
0
votes
0answers
18 views

How to select a model in quasi-poisson GLM with interactions using drop1 command?

I want to evaluate the effect of three factors (one categorical, and the other two continuous) on the response variable, which is a count data. I have performed 7 candidate GLM models with ...
1
vote
2answers
46 views

Should statsmodels's GLM produce the same results as R's lm?

Should Python's statsmodels.api.GLM(train_y, train_X, family=sm.families.Binomial()).fit().predict(test_X) always produce the same results as R's ...
2
votes
1answer
54 views

Multidimensional Scaling “eurodist”

I have a question regarding Multidimensional Scaling. I used the dataset eurodist from the package datasets to generate a 2 ...
2
votes
0answers
31 views

Neural Network Error Plot Odd Effect

I'm using R to fit a neural network to data generated by the formula $y = x^2 + \epsilon / 2$ where $x \sim \mathcal{U}(0, 2)$ and $\epsilon \sim N(0, 1)$ (very simple, right?). The following plot ...
0
votes
0answers
18 views

Statistical analysis website postgresql

I'm currently working with postgresql on an amazon server ec2 and was wondering what is a good language to represent statistical analysis? I've been told that R is the best but heard from one ...
2
votes
2answers
69 views

A good source to understand interaction in LMM?

I would like to know more about interaction in LMM using lmer. Can you recommend me any books, articles, websites?
1
vote
1answer
40 views

Parametrization of Gamma and Negative Binomial in R

I have some Poisson data {${y_1,...,y_n}$} and a Gamma prior, and I wish to construct a predictive posterior distribution. As I understand, if my Gamma hyperparameters are $\alpha$ (the prior number ...
1
vote
2answers
92 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
87 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
42 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
23 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
24 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
10 views

Standard error of mean vs. standard error of coefficient in Gaussian glm

I'm having trouble understanding why calculating the standard error of the mean: $$ \widehat{SE} = \frac{\widehat{SD}}{\sqrt{n}} $$ gives me a different SE estimate than the SE estimate of a ...
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
35 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
6 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
52 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
28 views

What's wrong with my jackknife procedure in R? [on hold]

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
36 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
61 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
76 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
20 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
41 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 ...