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
3answers
39 views

Exploratory data analysis for a dataset with continous and categorical variables

I have a data set which has DV and around 40 IVs. I want to select best variables out of the existing ones. I can use correlation, but it requires only numeric variables. I would like to see relation ...
3
votes
1answer
26 views

why do decision tree packages convert factor variable into two binary variables

Why are decision tree packages like say, rpart slow with increasing the number of factor levels in R. I read that it basically converts each factor variable into two binary variables representing ...
3
votes
1answer
44 views

P values of coefficients in rlm robust regression

I am using rlm robust linear regression of MASS package on modified iris data set as follows: ...
0
votes
0answers
16 views

R: weighting with two variables while boostrapping

I have two variables that I'd like to analyze with a 2x2 table, which is easy enough. datatable=table(data$Q1data1, data$Q1data2) summary(datatable) However, I ...
1
vote
2answers
94 views

Regression with categorical predictors - use only some dummy variables [duplicate]

I am working on a regression and I have a factor variable "Marital Status" Marital status has 5 levels: Single, Married, Divored, Widowed, Other (don't ask me what constitutes someone being an ...
0
votes
0answers
24 views

Why small values produce undulating densities when ploting logarithm of a loguniform prior (in R)?

I am using a program that draws random values in a log-uniform distribution let say between 1 and 100. When I plot the density of the produced values with R it looks like a log-uniform distribution ...
0
votes
0answers
35 views

When converting categorical data to numeric in R is it important to use the same value to numeric mapping across columns

If I have a dataset consisting of categorical data and I want to see if there is a correlation between the values I will need to convert it to numeric in order to run corr() in R but I have a few ...
0
votes
0answers
23 views

Linear mixed model with two correlated dependent variables

I'm using the swissmunicipalities dataset in the package sampling of R. I consider two correlated dependent variables, the population between 40 and 65 (Pop4065), and the population aged 65 or more ...
0
votes
0answers
11 views

Can I perform a PCA on species count differences instead on the species counts themselves?

I'm busy with the analysis of bird community change through time on a couple of sites and want to relate it to environmental covariates. I use the R-package vegan ...
0
votes
0answers
25 views

Memory Usage of glmnet with Multiresponse Gaussian Family

I have a large multivariate response matrix that I would like to use to fit an elastic net/lasso model. My $Y$ matrix is $5500 \times 13000$ and my $X$ matrix is $5500 \times 1500$. The $Y$ matrix is ...
2
votes
1answer
63 views

What does id (cluster) mean in gee?

I wanted to use poisson glm model which would take serial correlation (AR-1) and overdispersion into account. I was directed to use gee, but ...
1
vote
0answers
43 views

“Complete” classification using decision tree

While exploring the examples from "Practical Data Science with R", I am using a decision tree to classify the spambase dataset. It works fine, but I am trying to "abuse" the model in order to have ...
2
votes
1answer
31 views

How to run Chisq independence test using monte carlo method

I've been investigating exact tests and during that I find monte carlo method very useful. I can write my own code for randomization and permutation tests but I cannot figure out how R function ...
2
votes
1answer
92 views

Using the Weibull curve to model responses from a direct mail campaign. Model isn't fitting the data very well

I'm trying to build a model to forecast direct mail marketing campaign responses. In the "response" vector are the average number of responses from a marketing campaign from day 1 to day 63 (8 weeks). ...
1
vote
0answers
15 views

truncated binomial samples with GLM

We have a binomial process that yields samples of 60 trials. To save time, once 2 failures have been observed the process is reset. So if a test series hits 2 failures early, the resultant sample ...
2
votes
0answers
26 views
+50

How do gamboostLSS and gamlss packages predict outside range of x?

The mgcv package performs a linear extrapolation when the newdat argument of the predict ...
3
votes
2answers
43 views

Comparing Categorical Variables

What is your go to method to visualize relationships between categorical variables? At work, I find myself working with a discrete outcome variables quite a bit. When exploring data, I often want to ...
1
vote
0answers
35 views

Test fixed effects for joint significance in R

Just as in this post I'm looking to test for the joint significance of the fixed effects in a model. Unlike the post I referred to, I'm looking to test each fixed effect individually. I have used a ...
1
vote
0answers
31 views

Plot the training and cross-validation deviance [closed]

I'm running the gbm model using R caret package. To tune the model I used 10-fold cross-validation. I tried to get the following plots to guide my model tuning but didn't succeed: Plot the training ...
2
votes
0answers
25 views

multiple hypothesis correction for meta-analysis with missing p-values

I would like to combine multiple p-values (e.g., using Fisher or Stouffer), where some hypotheses may have missing p-values across studies. e.g., ...
0
votes
0answers
9 views

How many data points are required for support vector regression?

I have a trivial question which I could not find the answer out there. How many historical data points are needed for support vector regression? I know having a few data points (less than 10), the ...
0
votes
0answers
6 views

Diagnostics of a GLMM model using ADMB

I've created some GLMMs in R using ADMB. I've selected this model based on the AIC value. Now I would like to see the diagnostics. Which kind of diagnostics do I have to use for a GLMM? ...
0
votes
0answers
9 views

Using Princomp() in R [migrated]

After running Principal Component Analysis in R using princomp() and running summary() on the results I got a list of ...
0
votes
0answers
9 views

Plotting a boxplot against multiple factors and overlay raw data in R with ggplot2 [migrated]

I have a boxplot like this; library(ggplot2) p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(am))) so this plots the data as ...
0
votes
2answers
66 views

When the dependent variable and random effects 'overlap' in mixed effects models

I have added a new example here for clarity, see original question below Eg. I have 10 schools in 5 countries, ten students from each school is sampled. Prediction variables: student test marks for ...
6
votes
3answers
135 views

ETS() function, how to avoid forecast not in line with historical data?

I am working on an alogorithm in R to automatize a monthly forecast calculation. I am using, among others, the ets() function from the forecast package to calculate forecast. It is working very well. ...
1
vote
1answer
23 views

Generate a random variable with a defined correlation to multiple existing variables

this question is strongly related to: Generate a random variable with a defined correlation to an existing variable. However I'm struggling to implement it in a more complex matter: Given X, a ...
1
vote
0answers
13 views

Lambda's from glmnet (R) used in online SGD [migrated]

I'm using cv.glmnet from glmnet package (in R). In the outcome I get a vector of ...
0
votes
0answers
9 views

Converting to JSON (key,value) pair using R [migrated]

My data frame contains the data as follows ...
0
votes
0answers
20 views

Canonical correlation analysis: taking into account the negatieve correlations?

I've got two data sets on the same observations: one with 4000 variables, one with 5000 variables. I've calculated the first 30 canonical correlations between these two data sets and I look at which ...
0
votes
0answers
18 views

A good Multi-variate Regression solution in R

I have a dataframe with one continuous response variable and hundreds of predictor variables (hundreds of additional columns in my dataframe). I'd like to run a regression for the single Response ...
0
votes
0answers
9 views

weighted regression using plm

My data frame looks like something as follows: ...
1
vote
1answer
31 views

How does R package 'quantmod' receive (almost) real-time data? [closed]

I'm interested in quantmod R package's data extraction methods/algorithms.
4
votes
1answer
78 views

Interpreting linear regression residual plots using R

I'm investigating whether there is a relationship between the day of the week and an outcome value using linear regression in R, and would like to understand how to ...
3
votes
1answer
105 views

Significance of intercept (as portrayed via an R formula)

I'm new to statistics in general (but a very seasoned developer). I'm trying to grasp why it seems like there's a lot of consideration given to intercepts, at least where it comes to models. For ...
0
votes
0answers
19 views

fitdistr among Cauchy / Student-T / Normal distributions in R

I am posting this, hoping that it will also be useful to others. see also Fitting t-distribution in R: scaling parameter . my data series x is fat-tailed, 1063 obs. it seems straightforward to ...
0
votes
0answers
9 views

Comparing models in plm, where sample size differs

I've been using the 'plm' package to fit models in R, usually with some kind of dynamic specification--either in ECM (a differenced dependent variable, and differences of the IVs and levels of DV/IVs ...
0
votes
0answers
12 views

interpreting multcompTs from multcompView in R

This graph was created using multcompBoxplot (from multcompView), and I'm having a difficult time interpreting what the mulcompTs of this graph are telling me in terms of differences between my ...
1
vote
0answers
24 views

Co-convexity of Splines

I wrote a Schumaker Shape-Preserving Spline in R. I am confident that I got the coding right because I get the same results as another person in matlab. This was written based on Judd (1998, ...
3
votes
1answer
88 views

What kind of Logistic Regression?

I am not an expert in regression, but I have a problem that I believe should be solved by logistic regression. The problem is rather specific, so I try to describe it using a more tangible example. ...
1
vote
0answers
39 views

Should I perform linear regression multiple times to train my dataset?

I am working on Boston data set from MASS library. I separated the training and test data (70 / 30) In order to train my data, should I run linear regression multiple times on training data? Is this ...
0
votes
1answer
51 views

Multiple Linear Regression coefficents

I'm doing a linear regression, in R. The values are like this - ...
0
votes
0answers
32 views

Fitting a model

I have a problem with fitting a model in lmer. My DV is reaction time to picture naming which is a continuous variable. I have three IV which are categorical. The first factor is TMS condition: either ...
0
votes
0answers
20 views

Fitting an asymmetric Gaussian

I've got some spectral data that I'm processing, but there is a clear skew in the data. What I need is to quantify how asymmetric the data is, and to plot a skewed Gaussian in order to obtain the ...
3
votes
0answers
50 views

How to fit an exponential equation of the form $Y = A + Be^{CX}$ to data

I need some assistance with a nonlinear adjust. I am trying to make a mathematical model that describes the rate of silicic acid escaping from an underwater sediment. For theoretical reasons, the ...
3
votes
0answers
41 views

Strucchange R package: correcting heteroskedasticity and autocorrelation [closed]

I’ve got a question concerning the R package strucchange that I use for testing and dating structural breaks in my PhD thesis. To be specific, I use the generalized fluctuation test framework with ...
1
vote
2answers
43 views

Does this regression diagnostic plot mean my data is invalid, and if so how should I go about fixing it?

I am doing a project on cloud cover and cosmic rays and have undertaken a regression model in R. Above is the regression diagnostic plot and from the QQ plot I can see that the tails are skewed, ...
0
votes
0answers
20 views

Panel data logistic regression with clustered robust errors in R [migrated]

I am trying to estimate a cluster-robust logistic regression from panel data in R. I have observations from companies over several time periods and a discrete (0,1) dependent variable. ...
1
vote
0answers
21 views

Why R linear ksvm don't use all support vectors

I was playing with svm and I made this data: x y | type ----------- 1 1 | 1 2 2 | 1 2 0 | 1 0 0 | -1 0 1 | -1 1 0 | -1 and using this setting ...
2
votes
2answers
90 views

Why do I get linear model when I tried to fit exponential model?

I was wondering why do I get linear model when I'm using exponential model, y = a * exp(-b*-x), to fit my data. Here is my code: ...