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
0answers
9 views

Redicrecting R help message to a text file

I have R installed on Linux. To get instant help I type on the prompt as: ?read.table Is it possible to redirect this help message to a text file. For example, if I want Linux man page to be ...
0
votes
0answers
17 views

Should I delete the intercept

I'm working on a small project where I need to create a multivariate linear regression model to predict the frequency of some airline companies. I'm a bit confused as I don't know if I have to remove ...
0
votes
0answers
6 views

Predicting time to failure with time varying cofators

The Goal I am modeling Hospital Length of Stay. More specifically, I would like to predict the number of days until a patient is discharged given all of the patients clinical factors throughout ...
0
votes
0answers
12 views

Adjusting Probability for oversampling

I am developing a marketing (Churn) model that has an event rate of 0.5%. So i thought to perform oversampling. I mean making the number of events equal to number of non-events by reducing non-events ...
0
votes
0answers
9 views

Difference time series and then minus the mean of the differenced series within Arima

This question is similar to the following question in the sense I am currently doing the differencing and mean removal of the time series outside the Arima function ...
2
votes
0answers
11 views

Why does the upper prediction interval region gets larger than lower prediction interval when data are transformed?

I present here two examples one with transformed data and the other without any transformation. In the transformed data case, the upper interval gets enormous large, whereas not in the untransformed ...
0
votes
0answers
13 views

Variable selection with hand on example in R

I am looking for most suitable way to perform analysis (with statistical evaluation) where the aim is to find (select) a suit of continuous (collinear) variables that best describe other continuous ...
1
vote
1answer
16 views

Conceptual problem for binomial distribution

I'm reading this book (Implementation: How Great Expectations in Washington Are Dashed in Oakland. 1973) and they discuss how hard it is to gain agreement of actors. They set up a conceptual ...
1
vote
1answer
32 views

Predicting Sales Over Time

I'm pretty new to including time in any sort of modeling, so forgive me if any of my questions are basic. I'm trying to predict a final sales number over a certain period of days using the ...
0
votes
0answers
14 views

eliminating outliers in MARS regression

I using the regression method called MARS, in R is it called earth and is located in the ...
0
votes
0answers
8 views

A UPGMA cluster in R with NoData values [migrated]

I have a matrix of sites. I want to develop a UPGMA aglomerative cluster. I want to use R and the vegan library for that. My matrix has sites in which not all the variables were measured. Following ...
0
votes
0answers
19 views

How to constrain the variance of a linear model

Let's say I have a model y=a+bx, and I have the distributions of b (B), x0 (X0), and y0 (Y0), and I would like to compute the distribution of a, A. One way to do this is to independently sample data ...
0
votes
0answers
10 views

Time Efficient Estimation of A Single-Index Model (Klein & Spady estimator)

I am currently having an issue with time to estimation for a very large dataset using a semiparametric single index estimator (Klein & Spady). Specifically, I am attempting to estimate bandwidths ...
1
vote
0answers
19 views

Linear Mixed model with lmer in R. How to formulate the within subject factors?

I would like to know which of these formulas is better for answering my research questions (see below) and explain why, or maybe someone can suggest me another one. ...
0
votes
0answers
11 views

Linear Mixed model with lmer in R. How to formulate the within subject factors? [duplicate]

I would like to know which of this formulas is better for answering my research questions (see below) and explain why, or maybe someone can suggest me another one. model1 = lmer(EEG ~ Age + Gender + ...
0
votes
0answers
3 views

Group data under conditions! [migrated]

First of all, I would like to thank you for your time. I am working with R on cross-section data and having a problem when group the data under conditions. The problem can be seen clearly from a small ...
-1
votes
0answers
17 views

R -Pediction Interval of Random Forest [on hold]

I am using quantregForest package to calculate the prediction interval, but the results are disappointing. The code is: ...
1
vote
0answers
16 views

How to use formative indicators in covariance-based SEM with lavaan?

I'm trying to build a covariance-based structural equation model (SEM) using both reflective and formative specifications of latent variables. I use the sem ...
0
votes
0answers
16 views

R: multicollinearity issues using glib(), Bayesian Model Averaging (BMA-package)

I am experiencing difficulties estimating a BMA-model via glib(), due to multicollinearity issues, even though I have clearly specified which columns to use. Please find the details below. The data ...
0
votes
0answers
11 views

How to predict on a new dataset using caretEnsemble package in R? [migrated]

I am currently using caretEnsemble package in R for combining multiple models trained in caret. I have got the list of final trained models (say ...
1
vote
0answers
7 views

Gaussian shape link function for glm binomial regression?

Link functions are typically sigmoid. The idea being that the underlying data is fitted to the curve with an increase in the predictor summation gives an increase in the response. However, could one ...
2
votes
0answers
28 views

Visualising complex data with various groups + sub-groups over time period

I have a data set that looks like the following: ...
0
votes
0answers
15 views

Random Forest online/incremental learning in R

Is there a Random Forest implementation available in R, that supports online learning? My alternative approach was to use the popular randomForest package and combine Random Forests (the existing one ...
0
votes
0answers
26 views

Correlation between ordinal variables

I want to know the correlations between 3 groups of variables which are ordinal (rating of 1 to 10). I have followed the formula on wiki and computed the Kendall tau-b correlation coefficients matrix. ...
0
votes
0answers
12 views

Using mean for a function in mixed model

I am using lme4 package to apply mixed modelling approach to my data. In my data I have two treatments and three populations with four replicates each. Population is fixed effect and treatments and ...
0
votes
0answers
25 views

Embed foreign exchange variation in the financial forecast [on hold]

I have forecasted values for my accounts payable for FY14 and I also have the actuals of account payable for FY14. My vendors are all over the world and I deal with different currencies. In order to ...
0
votes
1answer
29 views

Social science panel data analysis

Currently I am working on a project where I need to find out whether financial aid (per capita) has an influence on the country's HDI. I have compiled a dataset, which you can find here: ...
0
votes
0answers
4 views

Fitting Data with Ties Using unique() Walk-Around and ks.test

I'm looking for a distribution that best fits my data. Looking at the frequency plot, seems like the distribution could follow a Gamma or Weibull distribution. With that in mind, I use the ...
0
votes
0answers
28 views

R, Pairwise comparison of random variable in mixed model

We measured temperatures of a pond repeatedly every day at each hour for a month at two different depths (i.e., top and bottom). We want to see if the temperatures at the top of the pond are ...
3
votes
2answers
72 views

Least Squares Regression Step-By-Step Linear Algebra Computation

As a prequel to a question about linear-mixed models in R, and to share as a reference for beginner/intermediate statistics aficionados, I decided to post as an independent "Q&A-style" the steps ...
2
votes
2answers
62 views

How to deal with the “sure probabilty” (p=1) in logistic regression

The model of logistic regression is that: log(p/(1-p) = ...... The most interesting case (for me) is the case that we have p=1 and p=0. But in this case, the ...
0
votes
0answers
9 views

Definition of p-value in carets confusion matrix method

In the documentation for the confusion matrix method in the caret package, the p-value is described as: a one-sided test to see if the accuracy is better than the "no information rate," which is ...
1
vote
1answer
31 views

Compare distributions (with replicates) and visualization

The experimental set-up is an almost typical control vs treatment, in which we are counting how many reads map to a particular class of genes in each condition (RNA-seq), done in triplicate. An ...
0
votes
0answers
18 views

How to use Kernel Regression to predict new data?

I have climate data for 240 predictors and precipitation flux (as the target variable) for 3000+ days. I want to use Gaussian kernel regression to predict the precipitation flux for the next 2000+ ...
0
votes
0answers
33 views

When to choose which model for time series?

What are the applications of AR and MA model? To put my question exactly, when to use AR model and when to use MA model(for example, like when it is seasonal or when there is a trend, etc). In other ...
0
votes
0answers
11 views

Problem using metric='ROC' in caret train function in R [migrated]

I have an imbalanced data set with two classes therefore I thought I could use ROC as a metric instead of Accuracy to tune my model in R using caret package (I am trying different methods such as ...
0
votes
0answers
31 views

Fitting a nonlinear function where the target and predictors are transformed by a power function [on hold]

How do you estimate the parameter $\theta$ in the following problem? We're given $Y$ and $X_1$ and $X_2$. We know that $V(Y,\theta) = V(X_1,\theta) + V(X_2,\theta)$, where $\theta$ is a constant. ...
1
vote
1answer
35 views

Which model of lm/lme to believe?

I have a data set of height values for several individuals of several species in 2 different conditions. Not all the species are found in the 2 conditions. I want to compare height values between ...
0
votes
0answers
7 views

How to loop through elements in a large list, make NA variables for holes in data, and create new variable in another dataframe in R? [migrated]

I am trying to find a way to avoid writing 78 lines of code by using some sort of loop in R. Say I have the following: ...
0
votes
0answers
25 views

Caclulating probabilty of drawing vector from multivariate normal distribution in R

given vector of mean $\mu$ and covariance matrix $\sigma$ as parameters of multivariate normal distribution, how can I calculate the probability of drawing $k$-dimensional vector from that ...
1
vote
0answers
17 views

Best practices to compute TFIDF matrix based on another TFIDF matrix in R

I'd like to compute a TFIDF matrix (tfidf_matrix_b) based on a previously computed TFIDF matrix (tfidf_matrix_a). Is there a ...
1
vote
1answer
40 views

Classification in real time without prior knowledge of the number of classes

Is there an implemented algorithm (with python/R or java in preference) that can classify incoming data from an unknown generator with absolutely no prior knowledge or assumption. For example: Let G ...
0
votes
0answers
46 views

Lmer v. lm with Dummy Variables. Where Does the Math Differ in a Simple Example?

I am trying to understand the concept of mixed effect along with the R syntax in lme4 with simple scenarios out of the dataset ...
1
vote
0answers
14 views

Single-factor random effect ANOVA and components of variance [on hold]

I've needed to learn some DOE for work and I've been going through Montgomery's book using R to help with the calculations. The fixed-effect models have been straightforward, but I have some trouble ...
0
votes
1answer
14 views

Fitted Confidence Intervals Forecast Function R

I am using the forecast function in R written by Rob Hyndman. I am trying to determine the best way to determine confidence intervals for the historical fitted values. I would like to plot how often ...
0
votes
0answers
17 views

model selection in quantile regression

I am quite new in quantile regression, and I am using it in R (quantreg). I have around 17 predictors,and I would like to select the best subset of predictors. Then, I was wondering if it would be OK, ...
0
votes
0answers
9 views

Caret - Changing tuneGrid gives different results for same parameters

I'm having an issue training a GBM model in caret. I'm quite new to all of this, but I'll try to explain things as best as possible, but please let me know if you need any further info. My code looks ...
2
votes
1answer
15 views

Filtering to avoid the Slutsky-Yule effect in a moving window average?

Can anyone suggest a generally accepted method of filtering time series data to avoid the appearance of artifactual oscillations when smoothing the data using a moving window average? Is it simply a ...
2
votes
1answer
19 views

What are some standard bimodal distributions?

I have plotted this curve using the default kernel density estimate function in R I am looking for some standard distribution which could be close to this. Is there any standard bimodal distribution ...
2
votes
2answers
22 views

What is the right way of computing baseline hazard rate

What is the right way of computing baseline hazard rate? To my understanding hazard rate at time t is simply #events / #AtRisk ...