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

8
votes
3answers
765 views

Modelling for soccer scores

In Dixon, Coles (1997), they have used the maximum likelihood estimation for the two modified independent Poisson models in (4.3) to model the scores in soccer. I am trying to use R in order to ...
7
votes
2answers
2k views

Convert SAS NLMIXED code for zero-inflated gamma regression to R

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 ...
0
votes
0answers
6 views

Get LaTex table from R package glmmML

Does anyone know how to generate Latex table from glmmML R package output? I tried texreg, xtable and stargazer, and it seems like none of them work. Really appreciate your help, this can save me ...
0
votes
1answer
28 views

A question on cosine similarity & k-means

I used the following code to perform clustering of a dataset in R. distMatrix1 <- dist(sample2, method="cosine") km<-kmeans(distMatrix1,3) I have got some ...
1
vote
2answers
4k views

Fitting t-distribution in R: scaling parameter

How do I fit the parameters of a t-distribution, i.e. the parameters corresponding to the 'mean' and 'standard deviation' of a normal distribution. I assume they are called 'mean' and 'scaling/degrees ...
0
votes
0answers
7 views

Optimal methods for bandwidth selection in kernel density estimation

I am looking for help in choosing a suitable method for bandwidth selection in kernel density estimation. I have six data sets with 50 to 200 observations each and aim to fit a continuous univariate ...
0
votes
3answers
114 views

Relationship between price and quantity in R

I tried to figure out how I can analyze this project. To find out how to analyze relationships between prices and quantities. I think with only two variables you can't build models. For example, one ...
0
votes
0answers
6 views

Test for identifying structural breaks in daily financial time series data

I have daily data of Nifty from 2002 Jan 08 to 2014 March 31. I am trying to identify structural breaks in my data. I shall be very thankful if anyone can guide me as to what test shall I apply to ...
0
votes
1answer
72 views

R: glm.nb and when to consider using an offset or including a covariate

I'm using glm.nb to test for differences in the likelihood of accumulating overtime hours among employees across multiple departments. Department is the only information I have on which to base a ...
1
vote
0answers
15 views

Transformation of data with zero and R squared

I have a conceptual concern about data tranformation and R^2. Often we transform data to respect the assumption of the linear model. Therefore, we can use multiple type of transformation such as log ...
0
votes
0answers
15 views

How to interpret LDA discriminants, and state if variable x=123, then this means y

I am trying to understand how to interpret the results I get from LDA. Running from the iris dataset in r, I can see the discriminant coefficients are in the model and then I can plot the model to ...
0
votes
0answers
10 views

Seasonal Time Series Modeling in SPSS Modeler (or R) & ARIMA

I've got a question regarding ARIMA modeling. I am having a hard time to make to model out the seasonalities of my time series. The pictures below shows my tries in modeling. The topic is to ...
5
votes
0answers
69 views

Probability of failure in a finite population

I regularly inspect finite populations for failures (we make custom products in batches of ~500-800). Currently, we inspect every product for failure, which is quite a bit of work. I want to reduce ...
0
votes
1answer
28 views

Metafor package in R: meta regression and scatter plot

I am doing a meta-regression with metafor package in R. The mixed-effect model for proportion is used to assess the linearity between study performed year and medication prevalence. Here below is my ...
0
votes
0answers
23 views

Minimum Spanning Tree in R (vegan): managing identical values

In R the package "vegan" contains the function spantree. It takes a matrix of distances among terms and it creates a tree with all the points... unless two or more rows (ex: A, B, C) are identical. ...
0
votes
0answers
7 views

Not complete repeated measurement for linear mixed effect model in R using na.omit

I have measured the effect of different stimulation types in a group of subjects and I am using linear mixed effect models in R to check the effect of each stimulation type. Let's say I have ...
0
votes
0answers
13 views

loop and bootstrap in glm [on hold]

I have an example data (datasim) with binary outcome, Y and independent variables X1 till X10. ...
0
votes
0answers
5 views

Combine multiple independent variables into one variable in a GLM/GAM/GAMLSS model

In the R package gamlss there is a function centiles that according to the documentation is ...
3
votes
1answer
44 views
+50

When does pam (partition around medoids) fails to find the optimal solution? (counter example?!)

If I understand correctly, the pam algorithm is a greedy search for a set of medoids such that no other set offers a lower cost (i.e.: the sum of distances of points to their nearest medoid). ...
1
vote
0answers
18 views

Setting column classes and defining any factor levels, without using loops in R [migrated]

I have been grappling with the following problem for a while, as I need to load in, manipulate, and produce scores from new datasets as quickly as possible. I have defined a data dictionary ...
0
votes
3answers
101 views

How to determine the critical values of ACF?

I have a sample of 1000 data points and I used it as the training sample to forecast with Timeseries. My lecture suggested me comparing the ACF with its critical values (upper and lower) numerically ...
0
votes
0answers
19 views

Error message in a nested Mixed Model in lme4

I'm trying to model the effect of a biomarker, Pentraxin3 on another biomarker, IL6 in a mixed model to account for correlations between the repeated measures and for correlations between the ...
0
votes
1answer
42 views

Model selection for and forecasting of arctic oscillation (a seasonal time series)

I'm having a doubt with a time series. I have to find the best model for it and use it to do some forecast. The data are about the arctic oscillation (AO) from 1950 to 2015. The series is clearly ...
0
votes
0answers
7 views

High survival probabilities for un-censored test observations when using RandomForestSRC

The survival probabilities when using the RandomForestSRC package are consistently very high for near-term time intervals. I would have assumed that the survival probability at least for those ...
3
votes
1answer
2k views

Predicting and calculating test mse using cforest R

I'm new to the cforest package and am trying to create a cforest model to predict a new test set and calculate the model test MSE. My data is split into d.train ...
0
votes
1answer
299 views

correct use of Negative Binomial with a Geometric distribution in a mixed model (glmmPQL)

I am trying to fit a NB GLMM with a gemoetric distribution. I have come across very little information on this form of regression. And would like some pointers/reasurance. some literature is ...
0
votes
0answers
20 views

Rejection Sampling Not Giving Correct Distribution

I hope someone can check through all my steps to see where I made a mistake: I wish to create a sample with the density $\ f(x)=\frac{1-x}{(π-2)(x + 1)√x}$ using the [1,0] uniform distribution U, and ...
2
votes
1answer
766 views

How to validate and compare models predicting a binary variable?

I have a question about determining which models are "better" and how to assess that info. Let's say I have three models, each which predicts our bid on won ping. Our bid is a continuous variable and ...
0
votes
0answers
3 views

Dividing lsmeans$constrasts output [migrated]

I'm trying to merge from Sigmaplot to R, and I'm getting some progress in reaching the same outputs. In Sigmaplot I use the Holm-Sidak correction, and that is the one which I am trying to achieve in R ...
1
vote
0answers
22 views

Splitting between train/test for customer churn survival models

I am a bit confused on how data can be split between train/test and "live" data for predicting churn using survival models such as the one in RandomForestSRC package. Goal of the model is to predict ...
3
votes
3answers
798 views

Textbook for teaching introductory statistics and econometrics in R to undergraduates

I am looking for a good book for teaching introductory statistics and econometrics in R at an undergraduate level. Is there a commonly recommended text?
0
votes
0answers
11 views

R darch : deep neural net pre-training

I'm trying to train a (not even deep) network on iris using the darch package. It works well as a standard backprop-net, but becomes bad as soon as I add a little pre-training: ...
0
votes
2answers
183 views

Cluster Analysis for large data in R

I am trying to perform a clustering analysis for a csv file with 50k+ rows, 10 columns. I tried k-mean, hierarchical and model based clustering methods. Only k-mean works because of the large data ...
0
votes
1answer
29 views

Alternative to beta regression

In the data that I am working on, my response is a proportion ranging between 0 and 1. I learnt that beta regression is probably the best choice to model such data, but is there a suitable alternative ...
0
votes
0answers
18 views

Rolling estimate of Andrews.Chen, median unbiased estimator of an AR model in R? [migrated]

Given an AR(4) process, this can be rewritten in an ADF form as In order to estimate $\rho$, that in this case represents the sum of the autoregressive parameters, there is a procedure proposed by ...
2
votes
1answer
57 views

Computing Cross-Validation Errors for Subset Selection: error in standard code in the literature?

I am currently trying to understand how to use cross-validation in order to choose among the "best" subsets of different sizes returned by the R function regsubsets (regsubsets returns the "best" ...
0
votes
2answers
157 views

Confidence intervals with gamlss package

My question regards the use of the gamlss package. I am using gamlss package to fit a dataset to a logistic function. There is ...
0
votes
0answers
10 views

Comparison between different models: hierarchical models and model with dummy

I have these three models: M0<-glm(y=="yes"~x+z+b+c+r+as.factor(w),family="binomial") 'logLik' -1147.734 (df=65) ...
0
votes
0answers
7 views

Add a legend on package darts [on hold]

I'm a student of statistic master degree of Padua. I'm finishing my thesi on models of darts. I've a speed question, Who Can help me? With this package you estimate the variance of dart's throw for ...
0
votes
0answers
9 views

Improve ctr for recommender system

I work in internet advertising company and the task is to increase ctr. I have different variables, such as amounts of clicks, user location, browser, os, his previous history etc. What are possible ...
0
votes
1answer
141 views

Imputation in R: How to impute univariate data in R?

I am trying classification(2 classes) using Random Forest. Classes are - Red, Green. My dataset contains 1 numeric attributes(called X), and 51 binary attributes to classify a document into red and ...
0
votes
0answers
16 views

Difference in randomForestSRC and randomForest package / increasing OOB-Error curve

Probably this is related to randomForest vs randomForestSRC discrepancies. When training this dataset it seems, that concerning the mean missclassification error less trees are better than more in ...
2
votes
2answers
61 views

Meta analysis across studies with multiple response measures

I'm trying to do a meta analysis across a bunch of bird playback studies. Thanks to help on a previous post here I'm fairly certain I need to use inverse variance weighting (maybe with the 'meta' ...
2
votes
0answers
25 views

One to one exact matching in R [on hold]

I'm attempting one-to-one exact matching in R. That is, I have 60,000 treatment observations and 200,000 control observations but I only want 60,000 control observations and I want those to be matched ...
1
vote
1answer
14 views

Interpreting the residuals vs. fitted values plot for logit GLMM?

What I have is a generalized linear mixed model of the log OR of a rater (random effect) giving a response above a certain level on an ordinal scale, given a specification of what the rater was ...
1
vote
1answer
282 views

Reporting an ANOVA with a continuous predictor (multiple regression)

I have a design involving 1 between-subjects categorical factor, 1 between-subjects continuous factor and 2 within-subjects categorical factors. This is theoretically a case of multiple regression, ...
0
votes
0answers
26 views

Conflict answers between SPSS and R Software [on hold]

I used R software (auto.arima function) in getting the best ARIMA model for my data. Then I used SPSS in getting the parameter estimates since there is no p-value ...
0
votes
0answers
38 views

Boruta feature selection with R

I have a concern :/, I used Boruta algorithm in R on a data set of ~600 attributes and with a sample of 50K (the original size is 300K). Using the following parametres: pValue = 0.05 getImp = ...
0
votes
1answer
20 views

What does the error “pre.period must span at least 3 time points” in the CausalImpact R package mean?

I've been encountering the error "pre.period must span at least 3 time points" when using the package. Can someone help me understand why the package requires me to have at least 3 time points and ...
2
votes
1answer
196 views

What is the difference between the M5 regression model tree and the Cubist method for regression?

I am aware of how the M5 regression model trees work. I know that they fit linear regression models at every leaf of the regression tree and that every parent in the node is also associated with a ...