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

Intepreting p values from R mediate() output

In the output below, the ACME p value shows that it is significant. But the p-value for Prop. Mediated Average is >10%. I thought Prop. Mediate is the proportion of the total effect mediated by the ...
0
votes
1answer
7 views

Interpreting kmeans output

I am working on a clustering model with the kmeans() function in the package stats and I have a question about the output. My data is a sample from several tech companies and AAPL._UP is a variable ...
0
votes
0answers
12 views

Please help me to do regression with stable distribution with R

I am literally new to R. Is there anyone to make a code to carry out simple AR(1) regression with error terms according on stable distribution? Say $$y(t) = c + by(t-1) + e$$ where $e$ ~ stable ...
1
vote
1answer
15 views

The results and specifics from the 'qs' function in R

I'm not entirely familiar with the results of the qs() function in R's package seasonal. But, by what I understand roughly, the ...
0
votes
0answers
6 views

NAs returned when applying r.squaredGLMM

I wish to calculate conditional and marginal R2 values for a linear mixed model. However, R keeps returning 'NAs' for each (no warning message). I have tried a number of model variations and the same ...
1
vote
1answer
21 views

How can I avoid misidentification of a exponential distribution as Gamma or Weibull?

I'm trying to write a piece of code in R that identifies a set of sample data as belonging to a specific distribution and pull the specific distribution parameters, by performing the K-S test and ...
4
votes
4answers
84 views

How can you visualize the relationship between 3 categorical variables?

I have a dataset with three categorical variables and I want to visualize the relationship between all three in one graph. Any ideas? Currently I am using the following three graphs: Each graph is ...
0
votes
0answers
8 views

Bootstrap Step-Wise Selection For GLM in R [migrated]

What I'm trying to do is the following: Resample (bootstrap) the dataset containing my predictors and outcomes, say 1000 times For each bootstrap sample fit a glm using stepwise selection and then ...
0
votes
0answers
1 view

Calculating leverage/cook's distance for a Weighted Spatial Simultaneous Autoregression Model

I am estimating a Weighted Spatial Simultaneous Autoregression Model (spdep::spautolm --> Link) in R and I would like to do some residual analysis. Unfortunately ...
0
votes
0answers
21 views

Repeated measurments with R [on hold]

I read quite a bit of answers on similar questions, but some of them are contradictory. We have several treatments with number of subjects for each one. For each subject we have measurments for ...
0
votes
0answers
9 views

How to do forward stepwise regression using adjusted R^2 in R [on hold]

As I understand, stepwise regression in R uses AIC by default. How can I do forward stepwise regression in R, using "significant improvement in adjusted R squared" as my criterion for adding ...
0
votes
0answers
8 views

XERGM R-package: GOF error with bipartite, temporal ERGM

I was able to estimate the following temporal, bipartite ERGM using the xergm package in R: ...
0
votes
0answers
22 views
0
votes
0answers
14 views

correlations between factors in r- scores or loadings?

I've conducted a factor analysis in r with three factors (function=fa {psych};rotation=promax ; method=GLS). ...
5
votes
0answers
59 views

How to test if “previous state” has influence on “subsequent state” in R

Imagine a situation: We have historical records (20 years) of three mines. Does the presence of silver increases the probability of finding gold in next year? How to test such question? Here is ...
0
votes
0answers
15 views

log-likelihood of multivariate regression

I am struggling with R to calculate log-likelihood of multivariate regression (i.e. more than one response, one or more predictors). I would like to have a function taking object of class "mlm" as an ...
3
votes
0answers
49 views

How are outliers dealt with in R after detected? [on hold]

Once outliers in time series are detected in R how exactly are they dealt with before forecasting? I dont want commands to use i would like the method. Please do not give any answers to do with ...
0
votes
0answers
27 views

How to demonstrate biased estimates of linear regression vs cox proportional hazard survival analysis in R?

I want to perform a really simple simulation of right censored data. Then I want to draw a kaplan meir survival curve and do a cox proportional hazards test. Then I also want to perform a simple ...
1
vote
1answer
37 views

How do you get the principal components of one matrix along the principal directions of another matrix?

I have a data matrix, A, on which I have performed principal component analysis (PCA) using the prcomp function in R. This gives me the ...
3
votes
1answer
21 views

How to simulate noisy respondent entry of short textual responses? [on hold]

I have a list of company name as following: ...
0
votes
1answer
21 views

Computing Issues with Kriging

I am having some issues with Kriging in R, and I was looking for some idea where I am going wrong. From what I can tell, I done a decent job removing the trend, and I believe my transformed data is ...
0
votes
0answers
9 views

R: how does caret choose default tuning range?

When using R caret to compare multiple models on the same data set, caret is smart enough to ...
0
votes
0answers
15 views

Plotting List of Words with R [on hold]

I am an R beginner in way over his head. I am starting with a list of character vectors. It starts with 25 words. Each year some of these words are pruned from the vectors. I want to plot the list of ...
0
votes
1answer
41 views

k means with binary variables

Is it OK to use kmeans with binary variables? I mean Euclidean distance? I guess the binary variables will be the ones that get the most power to determine the ...
0
votes
0answers
26 views
0
votes
1answer
15 views

assigning column name to a data frame by reading a different file [on hold]

I have created a data frame from a pre given data set which does not have column name.so by default the col names are V1, V2.......V42. Now I have one more file (.txt) which has one column with 41 ...
0
votes
0answers
6 views

adding two transition columns to a dataframe [on hold]

Hello I have a dataframe with 1/0 variable, call it remission I also have another column of patient id's i also have another column of recorded times(not time to achieve remission) just time i want ...
0
votes
0answers
16 views

Interpretation of linear and quadratic interactions

I'm working on building and interpreting multilevel models. In one, I'm predicting binge episodes over time and using a linear time by baseline characteristic interaction as well as a quadratic time ...
2
votes
1answer
49 views

How can a univariate seasonal time series be made normally distrubuted by Box-Cox transformation?

I'm trying to fit a sarima model on the univariate data with 180 points (periodicity=12). I use the auto.arima function in R. After fitting a model to the data, the only problem is the violation of ...
0
votes
0answers
8 views

Error in predict function when training set and test set have different columns [on hold]

I have a dataset which I split into a Test and a Train . On the Train dataset I have done a few preprocessing steps such as Imputing missing values, dummyfying variables, and also added a few extra ...
1
vote
0answers
10 views

Monte-Carlo: R script not returning anything [migrated]

My R script is mcnorm.R <- function(M,N) { library("mvtnorm", lib.loc="~/R/win-library/3.2") R <- as.matrix(read.csv("Data.csv", header=FALSE)) mu <- colMeans(R) ...
1
vote
0answers
15 views

F-Test for Equality of Variances with Weighted Survey Data

I would like to use an F-Test for Equality of Variances on a variable to compare two groups. Normally, this would be done with an sdtest command in Stata or a ...
0
votes
1answer
34 views

Best ways to model 'big data' given limited computing resources

Suppose I have a large data set(10 GB), with a response variable and multiple independent variables. What is the best way to utilize the data to build a model on? If the full data set includes 10 ...
0
votes
0answers
24 views

Standard deviation error bars and kruskal.test in R

I need to test if there is a significant difference between two groups of data, each with three replicates. (Multiple groups) I used the following approach: ...
0
votes
1answer
27 views

Histogram in R from two vectors [on hold]

how can I create a histogram in R from known values and counts? Thing is, I need to change manually h\$counts in my data set, so I have no data for that new histogram with changed values in h\$counts. ...
0
votes
0answers
13 views

Variable selection via mutual information

I am building a SVM model and was wondering whether filtering variables based on mutual information between response variable(binary 0/1 variable)is a good approach? Also, would the condinformation ...
0
votes
1answer
15 views

How to return all a particular column in a data frame

Suppose I have a data frame mysample. When I try to access only the second column using mysample[,2] I get a single element. How do I return the second column of the data frame?
-1
votes
0answers
17 views

How do you do a log-linear analysis in r? [on hold]

I can't seem to find anything on log-linear analysis. Does anybody know how to do them in r? I have two variables: one a dependant one (yes or no recoded as 1 or 0) and an independant one with 5 ...
0
votes
0answers
9 views

JAGS dmstate markov specification

Does any one have experience in running multi state models in jags? I am trying to run a msm on my dataframe with activity being 1/0 time from diag being times observation of the activity and patient ...
0
votes
1answer
36 views

How to randomize order by sets in r? [on hold]

I need to randomize a list of words by sets. I have a list of 5 pairs of words and in each pair there are two words: one word in position 1 (1w1) and another word in position 2 (1w2). These pairs are ...
1
vote
1answer
39 views

Method for fitting censored data in R

I have 320 data points - each has a redshift and a turnover-frequency, and I want to fit a correlation between them (a linear fit). However, 120 of the turnover-frequency values are upper limits. As ...
0
votes
0answers
16 views

Any R packages for mixed logit or probit? [on hold]

I have choice data sets and choice is decided within pairs (Choice A or B). If I have 100 pairs and each pair has each decision values but each pair has different situation, I would need to use mixed ...
0
votes
0answers
9 views

remove factor level if factor level has outlier in any of other columns in R dataframe

Hello I have a dataframe with one column a factor of patient id's, other columns of continous variables. I want to remove patients from the dataframe if they have an outlier observation in any of the ...
3
votes
1answer
19 views

What is a paired observation or paired variable?

The question kind of asks itself, can anyone explain what a paired observation or paired variable is in basic terms? My data consist of the number of words learnt in a week for 19 different ...
0
votes
0answers
22 views

What type of statistical analysis would be best to use?

I'm awful at statistics so could really use some help regarding statistical analysis and which approach to use. Here is what I know - I need to determine, based on stats I have been given, whether ...
1
vote
0answers
33 views

Logarithm of incomplete Beta function for large alpha,beta [on hold]

R's function pbeta is supposed to calculate the incomplete regularized Beta function. If the flag log=TRUE is passed as an ...
0
votes
0answers
10 views

Using predictive algorithms for descriptive purposes? Correct? Any resources?

Newbie here. I've been learning lots of predictive modeling with R/python using the well-known algorithms: decision trees, random forests, SVM, logistic/linear regression, k-Means, k-NN. But I'm new ...
0
votes
0answers
11 views

How to fit an logistical autoregression in R?

I modeled the relationship of $X$ and $Y$ by the logistic function. The residual plot displays autocorrelation which I'd like to rid. I want to try adding trend component to $X$, thus the model ...