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
1answer
2 views

Using Uniform Distribution to Generate Correlated Random Samples in R

[On recent questions I was looking into generating random vectors in R, and I wanted to share that "research" as an independent Q&A on a specific point.] Generating random data with correlation ...
2
votes
2answers
6 views

ANCOVA intercepts - does R center data?

I have 2 fixed effects and 2 continuous predictors. Nothing interacts so I believe I want a model of the form: $$Y_{ij} = \mu + \tau_i + \beta_j + \gamma_1(X_{1ij}-\bar{X_1}) + ...
0
votes
0answers
5 views

I keep getting the error “iteration limit reached” when using LME

I'm trying to model the effect of island size and island isolation on species richness using a LME. However I'm getting this error message "iteration limit reached". ...
0
votes
0answers
4 views

How to interpret the results of geweke.diag() function present in Coda package of R?

I am using geweke.diag() to check the convergence of an MCMC chain, I am using following R-Code for the purpose ...
-1
votes
0answers
10 views

problems in round [on hold]

I have noted that the function of round in R is not consistent. for example: round(12.5) [1] 12 ( Round down) round(13.5) [1] 14 (Round up) How I can always get 0.5 down or up?
0
votes
0answers
7 views

predictions with caret and logistic with restricted cubic splines

I am fitting a logistic regression using RMS's R package restricted cubic splines and within the caret package infrastructure. I fit the model well, but when I ask the model to predict new samples it ...
0
votes
0answers
3 views

Bnlearn: Predicting multiple node values

I'm using an r-package "bnlearn" to work with a bayes net I have constructed: ...
1
vote
0answers
12 views

Adding point and lines to 3D scatter plot in R [migrated]

I want to visualize concentration ellipsoids in 3d scatter plot in respect of principal components (principal components as axes of these ellipsoids). I used function scatter3d with option ellipsoid = ...
0
votes
0answers
9 views

Regression model and Social Network Analysis

I want to study the internal Italian migration using the network analysis. My nodes are the Italian cities, the edges are people who move from a city to another. I built my edge list in SPSS. I have ...
1
vote
2answers
56 views

Interpreting results of KPSS test in R

I've been trying to create an ARIMA model however, I'm not sure how to determine if the data is stationary or not. I preformed a KPSS test in R using kpss.test from ...
0
votes
0answers
12 views

R anova (aov) repeated measures gives same effect in different error sources

I have a repeated measures design, where A and B are within-subjects factors. I tried m1 <- aov(y ~ A * B + Error(subject/(A*B))) summary(m1) But the results ...
1
vote
1answer
15 views

Bootstrapped Regression Residuals

This relates to using bootstrapping of residuals in regression. I do not understand the point of this procedure, i.e. bootstrapping the errors and then adding the residual back to the predicted ...
0
votes
0answers
12 views

R packages install from local drive [on hold]

I don't have access to internet. Hence, i downloaded sqldf package from other system and then transfer it to this system. The sqldf_0.4-10.tar file is saved in "C:\Users\Riya\Documents\R" and also ...
0
votes
0answers
4 views

How do I interpret lagsarlm output from R's spdep?

I've run lagsarlm on my dataset, using a mixed model and using a row-standardized adjacency matrix. I have results that I think are good, but would am not sure how ...
2
votes
1answer
31 views

Interpreting the spread-level plot from R

I created a spreadlevel plot on my simple linear regression model in R. Here is my code, spreadLevelPlot(ols_reg) where ...
0
votes
0answers
23 views

How to deal with highly unbalanced data

I want to build a CART on data where the response variable is a binary variable, but it is highly imbalanced(i.e. 100,000 0's and 4000 1's). Are there any R packages that allow you to build CART ...
-1
votes
1answer
20 views

rbinom() produces NA values. What's wrong?

I have to generate RV from a binomial distribution with R . I have a vector for $n$ and a vector for $p$ and for each component I have to generate a random variable. My idea was the following for ...
0
votes
0answers
18 views

Interpretting arima xreg output in R

I have an interrupted time series consisting of 200 observations that I've cleaved into two subseries: a sub-series of 150 pre-interrupted observations, and a sub-series of 50 post-interrupted ...
0
votes
0answers
23 views

R - Intepretation of rpois(1,lambda=c(1,2,3,4)) [on hold]

From what distribution does R generate a random observation from if I were to run the code rpois(1,lambda=c(1,2,3,4))? I think I understand what ...
3
votes
0answers
21 views

How to check variables changeable dependency in R?

I would be very thankful if somebody could help me and explain the answer in simple terms. I have y, x, z variables. They are countinuous, no missing values. y is dependent variable, x and z ...
1
vote
0answers
14 views

entropy-calculation in R [on hold]

Is there anyone to have used the package "entropy" ? How can I create a vector of counts if my sample is large (2000 points)? I tried creating a vector of counts using table(), is there a more ...
2
votes
0answers
23 views

Automatic keyword extraction: using cosine similarities as features

I've got a document-term matrix M, and now I would like to extract keywords for each documents with a supervised learning method (SVM, Naive Bayes, ...). In this model, I already use Tf-idf, Pos tag, ...
2
votes
1answer
40 views

Residuals Interpretation:Time Series Data

I am trying to use multiple regression for a time series dataset. I have values corresponding to a variable measured by 24 hrs for 4 months. Since there was a pattern which repeated every 24 hours I ...
2
votes
3answers
36 views

Generating and Working with Random Vectors in R

I've been trying to understand random vectors and generate them in R to reproduce properties. Recently, I asked a similar question, and it was rightfully placed on-hold for being too general. Thanks ...
1
vote
1answer
42 views

Random forest and model predictions

I have a working random forest model (classification tree) in R that I made with a training dataset. I used the predict function with a verification dataset: ...
3
votes
1answer
43 views

regression with circular response variable

I am analyzing some data where the variables of interests are circular (angles). I use R and the circular package. In my dataset, every observation consists in a ...
0
votes
0answers
15 views

RMSE and Decision Trees

I'm running a series of regressions using decision trees and am getting good results, but I've got a question. In the pacakge rpart, you can run cpplot to get a graphical representation of where to ...
0
votes
0answers
18 views

Meaning of the prior and loss parameters in rpart in R

Could someone please explain to me what specifying priors and/or loss parameters in R's rpart actually do? I found R's documentation completely unhelpful. For example, let's suppose I have a highly ...
0
votes
0answers
9 views

Regression case in R (additive model)

I have a response variable y which takes values in [-1,1], and I have some explanatory dummy variables (only take values 0 or 1) x1, x2, x3. How can I create an additive regression model (with a ...
0
votes
1answer
53 views

How to test two lines from the same model are parallel

If I have two sets of data each with 5 entries for X&Y, I built a model to incorporate this using a dummy/indicator variable for when X is in Set B, so obviously I get two parallel lines; ...
0
votes
0answers
19 views

Error running a ridge regression in glmnet [on hold]

I'm trying to determine via cross-validation what lambda to use for a Ridge regression to create a model predicting crime per capita using the Boston data. Here's ...
0
votes
0answers
29 views

What quantile method is ideal for a moderate sample size of data?

I have several samples ranging $n =$ 15 to 40 coming from a population with a presumed non-normal distribution. I'm trying to calculate the 25th and 75th percentile but find differences between the ...
0
votes
0answers
13 views

Error in Gradient Descent Calculation [on hold]

I tried to write a function to calculate gradient descent for a linear regression model. However the answers I was getting does not match the answers I get using the normal equation method. My ...
0
votes
0answers
13 views

negative values for frequencies, in package entropy in R [migrated]

Using the package "entropy" in R, I have a vector y with decimal points and positive and negative values. Calculating the frequencies, I get positive and negative values corresponding to the ...
0
votes
0answers
5 views

R: lrtest for systemfit on specific equations [on hold]

In R I did two SUR regressions with systemfit, like: ...
2
votes
0answers
27 views

Are SAS certifications worth it? [on hold]

I am currently getting my masters in statistics. I was wondering if certificates such as the SAS certification program are worth pursuing. I was also wondering if there are any similar programs for ...
0
votes
0answers
19 views

Checking for significant differences in two independent correlations

I have measurements for DNA methylation and gene expression from different cancers. I want to carry out hypothesis testing to see if the correlations between methylation and gene expression in one ...
2
votes
1answer
27 views

So many significant explanatory variables and so small auc

Have you ever seen a model with almost every significant variable and such small auc (area under the ROC curve) ? What might be the cause of it? When I saw summary of a model I thought this model will ...
2
votes
2answers
16 views

How much missing data is too much? Multiple Imputation (MICE) & R

Currently I am working on a large data set with well over 200 variables (238 to be exact) and 290 observations for each variable (in theory). This data set is missing quite a lot of values, with ...
0
votes
1answer
37 views

Censored regression in R

I have a Tobit model of the form $$ Y^*_i = X_i\beta + \epsilon_i $$ and $$ Y_i = Max(Y^*_i,0). $$ The regressors are one continuous variable and 30 factors (modelling seasonal effects during the ...
0
votes
0answers
26 views

MLE of Poisson Regression in R

Given the following Poisson Regression Model: $$ Y_1,...Y_n \sim^{indep} Poi (\lambda_i)\\ log(\lambda_i)=\beta_0+\beta_1 x_i + \beta_2 x_i^2\\ \text{for }i = 1,...n $$ I am trying to find the log ...
0
votes
0answers
6 views

How to validate a model/hypothesis with multi-level model, in which one latent variable is connected to latent variables and no observed variables

I am using SEM library of R. Below is the model that I wish to test. How can I define this model to push into SEM ? Thanks.
0
votes
1answer
19 views

How to choose contrasts for nominal categorical Independent variable so that it results in uncorrelated dummies

I have a nominal categorical predictor and a continuous dependent variable..I want to perform linear regression using lm in R. If the contrasts are such that the resulting dummy variables are ...
0
votes
0answers
17 views

Entropy shrinkage in R [on hold]

I use the package entropy in R and I have two vectors, y1 and y2. I want to calculate their entropy and mutual information, using the shrinkage estimator, by Hausser and Strimmer. The problem is that ...
1
vote
1answer
22 views

Questions on multiple imputation with MICE for a multigroup-SEM-analysis? (including survey weights)

I am planning to do a multigroup SEM analysis. I gathered survey data and calculated a survey weight. Some of my variables have item nonresponse (mostly around 5% missings). I´ve decided to use ...
0
votes
0answers
29 views

How does left truncation affect the calculation of the logrank statistic for comparing two survival curves?

I'm currently doing survival analysis in R with left truncated data and am having trouble understanding how truncation affects the shape of a survival curve, and the results of a logrank test which ...
0
votes
0answers
14 views

how to ensemble the results of different classifier by adaboost in R [on hold]

I trained and tested my data on different classifier including SVM, Random forest, NN. Now i have predicted labels for each classifier and actual label. my predicted data includes 4000 data for each. ...
0
votes
0answers
24 views

Which package for creating tables via R? [on hold]

when it comes to generating tables via R, there are several packages aviable: stargazer, apsrtable, xtable, memisc, texreg, outreg. Which one do you prefer (please offer a rationale, not only a ...
0
votes
0answers
6 views

clogit in R: original variable or demeaned?

Conditional logistic regression is a fixed effects model. If you're modeling the dependent variable $y$, a glm fixed effect model doesn't actually model $y$. Instead, the glm fixed effect models ...
0
votes
0answers
20 views

Is there a relationship between confidence intervals and change point detection criteria?

I'm trying to use both forecasting and change point detection on a regression model, i.e. I want to see the forecasts of the regression model (package forecast) and run an "online" change point ...