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

When to use K mean clustering and hierarchical clustering algorithm?

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 ...
0
votes
2answers
15 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
5 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
14 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
16 views

Estimation of a system

Suppose we have a system that essentially evolves as follows: ...
1
vote
0answers
21 views

VaR with ARMA and GARCH in R

I have a time series of 1255 daily observations (01/01/2008 to 31/12/2012) of a stock log returns, I would like to compute the 1 day ahead VaR for the every single day (meaning for every Day I want ...
1
vote
1answer
13 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
5 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
16 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
21 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
47 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 ...
1
vote
1answer
16 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
0answers
17 views

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
8 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 [migrated]

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
138 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
23 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
22 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
8 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
26 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
33 views

Using correlations for “explained variation”

I have measured lifetime offspring production in an insect by taking measurements of offspring production at intervals (once per week for 9 weeks). Total lifetime reproductive success is then the ...
0
votes
0answers
5 views

Extract predicted values for latent variables in sem [on hold]

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 ...
1
vote
1answer
25 views

Why are the beta values provided in lmer() different than simple group means of observations?

In a 2-level mixed-effect model, the equation for level-1 is $$Y_{ij} = \beta_{0j} + r_{ij}$$ where $\beta_{0j}$ is the mean outcome for the $j$-th group. I ran the following model: ...
1
vote
0answers
13 views

what is the weight.matrix from the GenMatch (Matching package) in R

So when using the GenMatch function to generate optimal weight coefficients for use in the Match() function. What do these ...
1
vote
0answers
18 views

Forecasting Revenue with Layered Regression

Our business rents products to customers using a variety of payment plans.. ranging from 3-month (high \$ per month) to a continuous rental (low \$ per month). I've created a spreadsheet that shows ...
0
votes
0answers
20 views

What is the difference between two implementations of a random forest? [on hold]

Question 1: What is the difference between these two implementations of a random forest? Both models RF1 and RF2 use repeated cross validation. The only difference I see is that the number of trees is ...
1
vote
0answers
18 views
1
vote
1answer
54 views

R-Metafor: Meta-analysis and mixed effect model

This is an example of my dataset ...
0
votes
0answers
24 views

Itemfit to IRT model with missing data

I have matrix of dichotomus correct/false answers with many random missing data. (The data comes from an ability test where questions were randomly drawn from an item bank.) I am trying to find out ...
-1
votes
0answers
15 views

Linear Regression on multiple categorical variable [on hold]

Can anyone explain How I can interpret my result from the below model : I am trying to build the linear regression model for finding the transaction behavior of the customer in bank accounts. I have ...
0
votes
0answers
9 views

lag length selection in Vector Error Correction Models

I am doing a VECM analysis in R using vars R package. My problem is to find the lag length of the VECM model to be specified. I a previous post I was suggested to use the VARSelect function. However I ...
-1
votes
0answers
19 views

Data Extraction - Historical Weather dataset [on hold]

I want to get worldwide weather dataset from the year 2008 to 2014!... Where do I'll find this data? Can anyone suggest me the best website to extract the data or any other ways to obtain this ...
0
votes
0answers
22 views

Can anyone explain this error message in R? [duplicate]

I am running a mixed effect logistic regression, with two categorical predictors each of which are dichotomous. This is my formula, with variable names changed: ...
0
votes
1answer
41 views

Estimating R^2 when some coefficients are forced (i.e., restricted coefficients)

I am running a regression in R, and wanted to find the right way to calculate the R^2. I have an identity that I am empirically testing with data that is y = x1 - x2 + x3 (unfortunately dont have an ...
0
votes
0answers
4 views

Find the probability of a new data point using “density” function in R [migrated]

I am trying to find the best PDF of a data that has Gaussian distribution, using the "density" function in R. Now, given a new data point, I want to find the probability of this data point based on ...
1
vote
0answers
15 views

lme4 (v1.7) fails at fitting an “animal model” (LMM) compare to rrBLUP

I would like to fit a basic "animal model" (a kind of linear mixed model, see below) using the latest version of lme4 on CRAN (v1.7). To check the results, I am fitting it on simulated data, and ...
-1
votes
0answers
12 views

How to compute a really large correlation matrix in R using WGCNA library? [on hold]

How to compute a really large correlation matrix in R using WGCNA library? ...
1
vote
0answers
11 views

How to do contrasts with weighted observations in R's linear model function lm()

As part of a simple simulation study, I have the following lines of code in R: ...
1
vote
0answers
31 views

Comparing two vectors with the same numbers in different positions [on hold]

I have two vectors of the same size representing one score for different sites (x and y coordinates) under distinct situations (each vector is one situation). At each vector the scores only change ...
0
votes
0answers
21 views

Annotation of FDR vs. pvalue plot

I have calculated spearman correlation for gene pairs in 2 microarray datasets . Then, I have used FDR adjustment for p-values. Plotting FDR vs. -log10(pvalue) is surprising. Is the result realistic ...
0
votes
0answers
26 views

Mixed-effects models: autocorrelation for data with gaps in R

I wonder if there is a way of modelling of an autocorrelation for data with gaps in mixed-effects models in R? In addition, I would like to model heteroschedasticity. Thanks!
1
vote
0answers
10 views

Propensity scores with multiple treatments, and a multinomial outcome in R

I am using mnsp function to estimate propensity scores for multiple treatments. Then, I generate weights using the survey package, but I cannot use svyglm to estimate my treatment effects because my ...
3
votes
1answer
53 views

What does the k-value stand for in a KNN model?

What is the k-value in a KNN classification model? Is K the number of Clusters?
1
vote
0answers
7 views

Difference between recentred and scaled eigenvalues and the Tracy Widom distribution

I have been generating correlation matrices from independent normal data simulated using the MASS package. I do this k times and extract the eigenvalues of the matrices. I was interested in comparing ...
5
votes
2answers
124 views

How to simulate effectiveness of treatment in R?

Let's say I want to write a simulation for the table below to decide if Xylitol treatment and ear infections are independent. How would I go about doing this?
0
votes
1answer
15 views

Extract training data predictions from rpart

I'm wondering if there is any method to extract the class assignment of each sample in an rpart model from the training data? E.g. in R using random forest to get the predicted class of each sample ...