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

1
vote
1answer
11 views

Predictions using time dependent covariates in survival model

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
15 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
16 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
13 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
35 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: ...
0
votes
1answer
31 views

$2\times2$ confusion matrix for clustering in R

After using the k-means cluster algorithm in R I want to generate a 2$\times$2 confusion matrix of the results that compares true/false labels from the original dataset with true/false labels from the ...
2
votes
1answer
14 views

Association between two proportions using p-value

I have this two proportions that I need to see if they are associated somehow. Null hypothesis is that they are equal. I'm using R. So I get the pooled proportion ...
0
votes
0answers
11 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
9 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
51 views
1
vote
0answers
20 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
27 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
18 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
35 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
12 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
46 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
16 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
11 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
26 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
42 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
60 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 ...
2
votes
2answers
82 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$ ...
-1
votes
0answers
9 views

R - Is there any package in R which can calculate the implied volatility of a stock? [on hold]

does anyone know any package in R to calculate the implied volatility of a stock? Any reply is appreciated! Thanks in advance!
0
votes
0answers
7 views

Error in creation of JAGS model in R: non-conformable arguments [on hold]

I am currently practicing creating JAGS models in R. I'm using this set of Exercises (http://bendixcarstensen.com/Bayes/Cph-2012/pracs.pdf, specifically pages 18-19). However, one of the practice ...
4
votes
2answers
146 views

Do you see trends in my residual plots?

Do you see trends in my residual plots? These residuals plot show the standardized residuals against fitted values, origin period, calendar period, and development period. The patterns in any ...
1
vote
0answers
33 views

Difference between calculated inclusion probability and what is returned by sampling function?

I have a (small) population from which I wish to sample. I assign probabilities proportional to $y$. I enumerate the possible samples and then determine the probability of each sample occurring based ...
-1
votes
1answer
25 views

Prediction on multiple regression - Python

I have 3 list of value and 1 ground truth data. They all belongs to the same time series. My purpose is with 3 list try to forecast the ground truth data. For example : ...
1
vote
0answers
9 views

Multiple Imputation in R on data with repeated measurements

I am working with an occupation cohort exposed to radiation and have a dataset containing a number of variables on each worker, including their job title, year of birth, radiation exposure level, and ...
1
vote
0answers
28 views

How to compare and cluster sets of daily time series?

I have multiple dataframes each representing traffic speed for each day of the year (366 dataframes for 366 days of the year). The raws of the dataframe are timestamp from 00:00 to 23:55 at 5 minute ...
1
vote
1answer
59 views

Using correlation for “explained variation” or $R^2_{GLMM}$

I present using dummy data for an example, see below for R code to replicate data. Imagine that I have collected data on how much mail 500 people receive. In my survey there are 250 men and 250 ...
0
votes
0answers
5 views

Extract predicted values for latent variables in sem [closed]

I have used the 'sem' package to create a structural equation model with the aim of better understanding the formation and measurement of structural complexity in natural habitats. The objective was ...