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

Transpose matrix [migrated]

I have a csv file with two colums transid and item. It has the following values ...
1
vote
1answer
17 views

simulating a multiple comparisons problem using R and bonferroni correction

I am actually working on an exercise for my students dealing with multiple comparisons. However, I was having trouble trying to simulate some data in R to demonstrate the problem with multiple ...
0
votes
0answers
4 views

Can the rcorrp.cens paired concordance test be done taking into account strata?

Followup to these discussions: Bootstrapping Hmisc::rcorrp.cens for paired concordance? Stratified concordance index (survival::survConcordance) Is there a way to perform a stratified paired ...
1
vote
0answers
15 views

sample size of Anderson-Darling test

Why sample size of Anderson-Darling test for normality must be greater than 7? It is designed as above way in ad.test function of some packages in R. I want to test 5 samples data in normality test, ...
0
votes
0answers
9 views

Deep Learning Predictions Seem Off

I'm doing a linear regression using the h2o deep learning interface with R. I'm comparing the predictions to the ones I'm getting from the randomForest R module. The predictions from randomForest ...
0
votes
0answers
10 views

How do you fit a group level regression for a multilevel model using the lme4 package in R?

How do you fit a multilevel regression model in R where you want to include a group-level regression? Say you have data on radon levels in houses within counties. You have a house-level predictor ...
0
votes
0answers
15 views

Obtaining adjusted proportions with lme4, using the glmer-function

I aim to estimate the annual proportion of patients (% of patients) that are smokers in a population whose age and sex must be taken into account. In other words, I want to calculate the prevalence of ...
0
votes
0answers
7 views

Manipulate data that has multiple columns and set amount of rows to one that is like a database using R [on hold]

The headers are : user_id, response, impression_id, creative_id, timestamp. for some users, there is no impression_id, creative_id, or timestamp. that is ok. For other users there are multiple ...
0
votes
0answers
43 views

Explained variation ($R^2$) from MCMC glmm - Nakagawa & Schielzeth 2013

This is a follow up to a question I asked previously, where I suggested that variance-covariance matrices could be used to derive correlations, which are then usable as estimates of how much each ...
1
vote
0answers
13 views

Predictions using time dependent covariates in survival model [migrated]

Simple question, how do you specify time dependent covariates in the data.frame supplied to newdata when looking to make predictions? In other words, I fit a model ...
0
votes
1answer
23 views

How to apply an R prediction model to very big data from SQL database in parallel.

I dont need to load the entire dataset into memory. In fact I only need 1 row at a time to apply a trained model, get the predicted response and put that response somewhere, possibly back into another ...
1
vote
1answer
17 views

Significance codes in linear model with factors

I am setting up a linear model in R and need help understanding the significance codes when one of my independent variables is a factor - i.e., dummy variable for each possible value For a scalar ...
0
votes
0answers
20 views

Mclust function of mclust package overfitting gaussians

I'm using the Mclust function of the mclust package in R to fit a mixture of gaussians model. My simulated data obviously has 3 ...
0
votes
0answers
20 views

Problem in sum of vector [migrated]

I'm trying to do this : for(i in 1:5){ O[i]=sum(y[i:i+m-1])} m is an integer in [2,12]. But, in the output, I got for each ...
0
votes
0answers
37 views

Kernel Smoothing in R [on hold]

I am trying to apply a Kernel Smooth to data in a vector format, I run the following lines of code: ...
1
vote
1answer
41 views
3
votes
2answers
22 views

Association between two proportions using p-value

I have two proportions and I need to see if they are associated somehow. The null hypothesis is that they are equal. I'm using R. So I get the pooled proportion: ...
0
votes
0answers
14 views

question about using R to find cofindence interval for the subpopulation [on hold]

I am stucking on several statistic questions. I have no idea which direction should i go. Please help! The variables are x=height of father and y = height of corresponding son. The unit is centimetre ...
0
votes
0answers
12 views

How to build the A MAtrix for a A-Model(Amat) after a REDUCED VAR in R

i have a doubt in how to build the A MAtrix(Amat) for Estimating a SVAR model in R: I estimated a reduced VAR with the GDP, interest rate and inflation variables . With the economic theory and the ...
0
votes
1answer
58 views
1
vote
0answers
21 views

Minimizing 95% Confidence interval extent for bootstrapped confidence intervals

I'm new to CrossValidated so please excuse any shortcomings in my question. Suppose I have a sample of 500, for a population of 500,000. I asked my sample of 500 what day of the week they go grocery ...
1
vote
0answers
13 views

Correct df in longitudinal linear mixed model?

I am having trouble understanding how to correctly apply a linear mixed model to my data to measure the effect of wifi exposure. 4 beehives contained sensors collecting data on temperature (DHT22_t, ...
1
vote
0answers
9 views

Relationship between Gumbel and Weibull distribution, accelerated failure time models, and Survreg using R

I have three questions concerning accelerated failure time models (AFT), one statistical, one regarding how to implement these models in R, and one related to finding out information about what R is ...
1
vote
1answer
16 views

Elements of first list in Kendall must be ordered?

Two ways to execute a Kendall tau test (in R): ...
0
votes
1answer
28 views

Time series with multiple subjects and multiple variables in R

I'm having trouble finding a time series technique to deal with a data set I am working on. It contains multiple subjects and multiple variables, not all of which will likely be part of the time ...
0
votes
0answers
12 views

Forecast Error Variance Decomposition with restricted VAR model

For conducting Forecast Error Variance Decomposition (FEVD) on a restricted VAR model I use the fevd method in the package vars ...
0
votes
0answers
19 views

Obtaining adjusted proportions with logistic regression

Can I obtain adjusted proportions of a binary variable by using logistic regression? I have a binary variable (normal/abnormal), which I'd like to obtain adjusted prevalence for (i.e the proportion ...
1
vote
0answers
36 views

How to present multiple distributions with R?

I have a stochastic simulation on NetLogo in which my agents accumulate "wealth". Of course, every run gives me different outputs but with pretty much the same distribution. I use histograms to keep ...
0
votes
2answers
38 views

fitting a cubic polynomial to a trend component of time series

I have 295 observations of two variables, of which here are a few: ...
1
vote
1answer
27 views

using training data in final model output

I have customer data for around 400,000 customers where 270,000 of them are current customers and 130,000 of them are past customers who churned, what I am doing is classifying them as 0 (non-churn) ...
0
votes
0answers
6 views

More comprehensive summary() function in R? [migrated]

I was wondering if there was a more comprehensive summary() function in R that perhaps includes more model metrics such as confidence intervals around the estimates maybe log-likelihood, AIC, BIC ...
0
votes
0answers
17 views

Kolmogorov-Smirnov using R [migrated]

Long story short, I want to manually write the code for the Kolmogorov-Smirnov one-sample statistic instead of using ks.test() in R. From what I understand, the K-S test can be broken down into a ...
0
votes
1answer
41 views

pruning Neural Network

Since a feedforward NN with a logistic function as activation function is not linear, does it make sense to reduce variables first with principal components or discriminant analysis? Because ...
0
votes
1answer
14 views

biased random guess classification

I try to get used to some classification methods in R (kNN, Decision Trees, SVM) and I am just wondering: Is there a way to do a biased random guess classification to see the real performance of the ...
-1
votes
0answers
35 views

When to use K mean clustering and hierarchical clustering algorithm? [on hold]

Can you please tell me when to use the K-mean clustering and hierarchical clustering algorithm and what is the different between them... Regards, Rahul
0
votes
0answers
4 views

Adding a trend line to a scatterplot using R [migrated]

I have a data set with number of people at a certain age (ranging from 0-105+), recorded in the period 1846-2014, and I am making a scatterplot of the summed amount of people by year; there's one data ...
1
vote
2answers
47 views

How can I model a binary outcomes in time series using logistic regression?

My data has a binary outcome (attack or not attack), day (20 day in repeated measured design) and some covariates (nestling’s movement). The objectives of my experiment are testing the effect of time ...
0
votes
0answers
6 views

troubleshooting R BayesFactor package - error in regressionBF [on hold]

I want to use regressionBF to run all subsets regression. Here is my code: fitness.bf = regressionBF(VO2 ~ ., data=fitnessdata) and here is the error it spits out when I try and run the code: Error ...
0
votes
0answers
17 views

Correlated topic models in the lda R package

Can someone either explain to me or link to documentation which explains how to use correlated topic models in the lda package for R, the official documentation ...
1
vote
1answer
21 views

Estimation of a system

Suppose we have a system that essentially evolves as follows: ...
1
vote
1answer
19 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 {AER} package. Running the example code provided in the help page: ...
0
votes
0answers
13 views

Outlier detection with data (which has categorical and numeric variables) with R

Scenario I have a project about fraud detection where i need to find outliers by kmeans. I have a dataset about bank credits length of 1000. There are 21 columns (14 categorical, 7 numeric ...
0
votes
0answers
16 views

Joint distribution R [migrated]

I have a list of 10 stocks, with each having a time series of log returns (AIG, JPM,...). I have calculated the log returns for each of the stocks as follows: ...
3
votes
1answer
27 views

Metafor package in R: Ranktest for multivariate meta analysis

I have done a multivariate meta analysis with R, with support from metafor package. I am using rma.mv-method which gives an R object of class c("rma.mv","rma"). My question is about looking for funnel ...
1
vote
0answers
43 views

How to do a mixed (between- and within-subjects factors) ANOVA with Greenhouse-Geisser correction with {car}Anova in R?

I often have to do repeated-measures ANOVA with Greenhouse-Geisser or Huynh-Feldt corrections, so I use Anova (as described in ...
0
votes
0answers
9 views

extracting t value out of pairwise.t.test [migrated]

I would like to know if I could extract t values out of the pairwise.t.test function since it is only reporting the p values. I used the pairwise.t.test() for multiple comparisons after running a ...
0
votes
0answers
16 views

How to add supplementary variables after PCA using principal function (psych package) in R? [on hold]

Is there a way to add supplementary variables to a PCA plot when the PCA was conducted using the principal function from the psych package in R? I know that the PCA from the FactoMiner package has ...
0
votes
2answers
61 views

how many factors (new to factor analysis)

I'm using R (factanal) to analyze some data. I know from reading that there are various ways of picking how many factors to use in the analysis. I don't know which to choose, or how to do any of ...
2
votes
1answer
24 views

understanding proposal distribution sequential importance sampling in R

From the article of wikipedia http://en.wikipedia.org/wiki/Particle_filter I see that one generate samples from the proposal $\pi(x_k^{(L)}\vert x_{o:k-1}^{(L)},y_{1:k})$, however, the role of ...
3
votes
2answers
94 views
+50

What deviance is glmnet using to compare values of $\lambda$?

One criterion for selecting the optimal value of $\lambda$ with an elastic net or similar penalized regression is to examine a plot of the deviance against the range of $\lambda$ and select $\lambda$ ...