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
187 views

Difference between weights and prior in rpart and how to use them

I have a question about the "weights" and "prior" in R's rpart function. This question has been asked before here, but the answer doesn't quite make sense. Currently I have very unbalanced data ...
0
votes
1answer
28 views

ANCOVA interpretation – inconsistency between ANOVA results and pairwise group comparisons

I have some measurements (concentration) made in 4 groups (W, X, Y, Z) and time is my covariate. I make a linear model: ...
1
vote
0answers
5 views

Linear regression polynom slope constraint in R

My problem is how to find best decreasing 3rd degree polynomial regression in R. I have data, lets say ...
0
votes
1answer
334 views

AFT model with time varying independent variables

I am a newbie in survival analysis and I would like to pose some simple questions, after reading numerous posts regarding how to perform survival analysis in R. So, what I would like to know is: Can ...
0
votes
0answers
12 views

DLM new user question [on hold]

can anyone help describe how to code in DLM to estimate parameters (with dlmMLE) $h_0,h_1,h_2,k$ in my following system? Thanks My system follows: $y_{t_i}=d_i+Hx_i+w_{t_i}$, $x_{t_i}=Fx_{t_{i-1}}+...
0
votes
0answers
6 views

Error when trying to store x2-x1 because of length [migrated]

I'm new to R; this much will be obvious. I have a column DATA$date_time (ymd_hms form, output from lubridate). I want to create another column that uses difftime to subtract x2-x1 (loop) from within ...
0
votes
1answer
263 views

Can someone look at my method for fitting a GEE to my data?

I’ve been doing some statistical analyses in R on some data. It’s for use in a manuscript I’m hoping to get published in a biological journal. Unfortunately, the tests I ended up having to run are ...
2
votes
1answer
28 views

Anova on logistic regressions linearity

I'm trying to find out if my numeric predictors have a linear relation to the logit of my logistic regression. I tried to use the lrm fit in the rms package where I have used 3 knot cubic spline on ...
0
votes
0answers
7 views

R e1071 SVM always gives me (in average) below changes cross validation accuracy with random data

I am running e1071 linear SVM on my neuroimaging data. ( by function svm() ) When I was doing permutation tests, I found, in average, the cross validation (CV) accuracies with shuffle labels were ...
-3
votes
1answer
32 views

Why does a p-value of 2.4 indicate a very small probability that rejecting H0 is incorrect?

I am working with body temperatures in R, conducting a t-test. It is widely believed that the average body temperature for healthy adults is 98.6 degrees Fahrenheit. The body temperatures of $n = ...
2
votes
0answers
19 views

Will Tukey multiple comparison be the same for different types of Sum Of Squares of ANOVA for an unbalanced design

I am working on Two-Way ANOVA for an unbalanced design. Will Tukey multiple comparison be the same for different types (I, II & III) of Sum Of Squares of ANOVA for an unbalanced design. I am ...
0
votes
0answers
11 views

Errors messages using tables package in R [on hold]

Using the tables package in R, I encounter the following error message: ...
2
votes
5answers
857 views

Learn R-Programming with Statistical Background

I am a statistician. I'm pretty good with the concepts of topics like Linear & Logistic Regression & Time Series. But in order to run data I need to learn the R language. Since, having no ...
1
vote
0answers
18 views
2
votes
1answer
25 views

Is it advisable to include variables that are not in the full model in the imputation model?

I have a dataset with several missing values. I know that the missing is MNAR. I'm trying to use MICE to impute the data; then apply a survival model on the imputed data. The MICE paper advises that ...
1
vote
0answers
24 views

Randomly generating transition probabilities for Markov chains

I'm trying to simulate a person moving through a household using a Markov chain. Each state would be a room in the house. The issue I'm running into is that I have no existing data telling me what a ...
5
votes
4answers
1k views

Bootstrapping hierarchical/multilevel data (resampling clusters)

I am producing a script for creating bootstrap samples from the cats dataset (from the -MASS- package). Following the Davidson ...
0
votes
0answers
3 views

Extracting coefficients from frailty survival model with sparse=T [migrated]

I am fitting a survival model in R with time-dependent covariates and using frailty.gaussian() for some of the variables. An example call is ...
0
votes
0answers
51 views

Finding MLE by R code [on hold]

I would like to find the maximum likelihood estimation (MLE) of the parameters of following distribution and desnity function : ...
3
votes
2answers
273 views

How to set up a Mahalanobis distance problem in R

I have two datasets: a $1*m$ matrix of "ideal" conditions for $m$ factors a $n*m$ matrix of $n$ observations (rows) for each of the $m$ factors I would like to calculate for each observation in ...
0
votes
0answers
3 views

Stacking time series data vertically [migrated]

I am struggling with manipulation of time series data. The dataset has first Column containing information about time points of data collection, 2nd column onwards contains data from different studies....
0
votes
0answers
4 views

Simulating from normal copula in R with varying correlation matrices [migrated]

I'm trying to simulate correlated normal copula realizations using the copula package in R. I have estimated the varying correlation matrices and stored them in an ...
1
vote
0answers
11 views

What to do if my -log(-log(S(t|x))) kaplan-meier survival function violates PH assumption?

I've already performed survdiff() on my survival curves to find that there is a difference in time-to-germination between my 3 treatments. As far as I'm aware, I will need to run coxph() to be able to ...
0
votes
0answers
31 views

What is maximum likelihood estimation in logistic regression? [duplicate]

Can you please explain in simple way. Is it so important in logistic regression?
0
votes
0answers
9 views

TF-IDF between two different datasets in R [on hold]

I have two different datasets: one containing a product id and a query(text) and another contaning a product id and a product title. I want to calculate the tf-IDF between each of the queries and the ...
0
votes
0answers
19 views
0
votes
0answers
31 views

Logistic regression Effect using R, moderation plot

So, im in a bit of trouble here. I am using R (i'm very new at this), and i'm trying to plot the probability effects of a interaction effect, using the effects package. This is what the plot shows ...
3
votes
1answer
56 views

stl() gives seasonal component, but ets() and auto.arima() choose nonseasonal models

I'm completely new to forecasting so please correct me if I'm wrong. I'm trying to forecast sales data using R. My main concern is that when I decompose the data using ...
0
votes
0answers
19 views

Identifying statistically significant categorical variables with rma.mv

I'm running a meta-regression/multi-level analysis that contains only categorical variables. The printout of the data is as follows: res.fe ...
1
vote
1answer
310 views

Logistic regression for sparse data in R

How to perform a logistic regression and/or SVM on sparse data in R? I have $ 10^6 $ observations, $ 10^4 $ TRUE/FALSE features, and the data is sparse, i.e. ...
0
votes
0answers
2 views

Randomly delete/replacing X% of the data using R (or other tool) [migrated]

I am quite new to R other statistical tools. In order to measure the performance of an imputation technique, I want to randomly delete or replacing X% of the data so I can compare it with the original ...
2
votes
2answers
215 views

How to get the most important variables in random forests in R?

I am building a random forest in R and was wondering how to extract the most important variables. I am using a random forest to classify if a click is fraud or not, and the goal is to identify ...
0
votes
0answers
6 views

Which will be better If I have 2 years data (training and testing) with a condition

Condition: I will always asks the model to predict the behavior of last 1 month data i.e I want the result on last 1 month of data. I have 2 years of data of my app, and I have to train the model and ...
0
votes
0answers
22 views

How do I find the standard error of the estimate when using S estimation?

How do I find the standard error of the estimate when using S estimation? ...
1
vote
1answer
18 views

CFA: negative factor loadings

I found that after running a CFA, positive factor loadings and negative factor loadings occurred as appropriate. (An item representing a high score and an item representing a low score on the same ...
4
votes
3answers
275 views

Estimating the ratio of cell means in ANOVA under lognormal assumption

I am conducting a two-sample test (1-way ANOVA with 2 treatments), and the goal is to estimate the ratio of cell means assuming that the data are lognormal. A simple approach is to log the response ...
5
votes
0answers
155 views

What's the fundamental difference between these two regression models?

Suppose I have a bivariate responses with significant correlation. I am trying to compare the two ways to model these outcomes. One way is to model the difference between the two outcomes: $$(y_{i2}-...
4
votes
1answer
315 views

Omega H asymptotic

In the omega function in the psych package for R, we have several outputs including Hierarchical omega, Asymptotic omega and Total omega. I was reading about the outputs, but I find nothing about ...
6
votes
2answers
2k views

Non negative lasso implementation in R

I am looking for some open source or an existing library I can use. As far as I tell the glmnet package isn't very easily extensible to cover the non negative case. I may be wrong, Any one with any ...
0
votes
2answers
28 views

Comparing huge data sets that are non-normal and different lengths in R

I'm comparing two data sets. Each set is extremely large, about 25,000 quantitative pieces of data in length. I want to find if these sets are significantly different, but the problem is that they are ...
3
votes
1answer
94 views

Interpretation of coefficients in logistic regression output

I am doing logistic regression in R on a binary dependent variable with only one independent variable. I found the odd ratio as 0.99 for an outcomes. This can be shown in following. Odds ratio is ...
0
votes
1answer
450 views

How to test for serial correlation and ARCH effect in R package tsDyn?

I recently started playing around with the tsDyn package for R and successfully used it to estimate a bunch of VEC models and print their impulse responses (IRF) and error variance decompositions (...
1
vote
0answers
24 views

Appropriate number of explanatory variables in redundancy analysis (RDA)

This question comes from a reviewer's comment on a manuscript I recently submitted. I analyzed a multivariate data set (6 response variables, 21 observations for each) using redundancy analysis (RDA) ...
4
votes
1answer
1k views

Non-parametric test for repeated measures and post-hoc single comparisons in R?

Some attribute $x$ of 17 individuals was recorded repeatedly on 6 time points using a Likert scale with 7 distractors. Which statistical test(s) can I apply to check whether the changes along the 6 ...
0
votes
0answers
20 views

Interpreting coxph output with cumulative time dependent covariate

Hoping for some help in interpreting the coxph output in R using the survival package. I am very new to R, but have successfully ...
4
votes
1answer
3k views

Interpretation of ivreg() diagnostics in R

I'm trying to wrap my head around interpreting the diagnostics of the ivreg() command in R, from the {AER} package. Running the example code provided in the help ...
1
vote
0answers
10 views

R's pglm vs Stata's xtpoisson - R returns “Inf” standard errors

I'm running a fixed-effects Poisson regression and get different results in Stata and R. Unfortunately I cannot upload and share the data due to legal restrictions. My code in R is (formula shortened ...