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
0answers
7 views

Generate NBINGARCH in R

Could someone help me show or suggest how to generate data from negative binomial Garch (NBINGARCH(1,1)) model and how to write find the parameters using MLE ? Thank you so much
0
votes
0answers
11 views

Growth mixture modeling with latent variables in R with lcmm

I am trying to replicate the analysis that was used to make this figure: I have measured the depression levels (a quantitative variable) in my subjects at the following time points (in months): ...
1
vote
1answer
23 views

Simulating Random Vector X in R to Confirm with Example that cov(AX) = A cov(X) A'

As has been answered previously, the proof of cov(AX) = A cov(X) A' with X being a random vector and ...
1
vote
0answers
33 views

Interpreting regression results

I computed the following regression using R. ...
0
votes
0answers
16 views

Clustering data with one feature

Is there any built in method to cluster data with one categorical dimension in R? Basically, I have a data set including week of the year and if an event happened in that week. I wanted to use ...
0
votes
0answers
11 views

Estimating Mutual Information using R

I am trying to estimate the mutual information between vit level (values vary from 4 to 70, all of which are whole numbers) and a binary variable that indicates the presence of polyps. I am not sure ...
0
votes
0answers
10 views

How to report the group means and TukeyHSD for an ANOVA without intercept in R? [on hold]

I would like to run a Two-Way ANOVA without the intercept, and be able to report the grand and group means, and run TukeyHSD. However, I would receive this error. ...
0
votes
1answer
7 views

Computing the predicted value from a panel data model with the plm R package

I am estimating the following panel data twoways fixed effect model: y = alfa*y.lag + beta1*z + beta2*z^2 + theta*id + gamma*t (1) where ...
0
votes
0answers
8 views

How to test the significance of the Hurst parameter?

I am trying to fit a FARIMA model and I am using rsFit function in R to estimate the Hurst parameter (H). This function provides ...
0
votes
0answers
15 views

out-of-sample variance calculation using rolling window in R

My objective is to calculate out-of-sample variance of various portfolios. I am currently working on the comparison of the constructed portfolios using ...
1
vote
0answers
23 views

Neural Network-Fitted values [on hold]

I need to train a Neural network on a set of data. I used several different packages in R, like 'nnet', 'neuralnet', 'elmNN'. I'm looking for a way to do it in R so that I can access all the weights ...
0
votes
0answers
25 views

Predict out of sample values for support vector machine

I wonder how I can use the results for svm() in R for out of sample predictions. Assume that we split the dataset into train and test sets and use ...
0
votes
1answer
18 views

Copula for multivariate distributions

Is anyone know how to join two multivariate distributions using copulas in r. For example let $X=f(x_1,x_2, \ldots,x_n)$, $Y=f(y_1,y_2,\ldots,y_n)$ I need to find a copula for joining $X$ and $Y$ ...
0
votes
0answers
15 views
1
vote
1answer
61 views

Probability help needed

I have a R data frame (>2000 obs) ...
1
vote
1answer
123 views

R Time Series Analysis forecast result always remains same

I am trying to do time series analysis in R. I have data time series data set like this. ...
0
votes
0answers
8 views

Including class probabilities might skew a model in caret?

I've been training SVMs over some particular data for some time. I was quite happy with the Kappa and Accuracy measures caret gives, but adding some other metrics was not a bad idea at all. The thing ...
1
vote
0answers
25 views

How to simulate data in R given mean, median, and range?

I would like to simulate n numbers (all within the range between a and b, n being an even number) using R, and the mean (u) and median (m) is given. If I use runif then the standard deviation is ...
0
votes
0answers
7 views

Indicator species analysis in R (labdsv package) [migrated]

I am trying to do indicator species analysis in R using the labdsv package. I was able to get it to work on previous sequencing data set but now it has thrown ...
0
votes
0answers
19 views

Specification of mixed model structure in glmmLasso

I am having difficulties specifying the appropriate structure for nested/random effects in a mixed model that I am trying to pass through the 'Lasso' shrinkage algorithm. I am using the package ...
0
votes
0answers
8 views

R: dichotomous time interaction in a Cox model

I am using the Cox proportional hazards model to estimate adjusted hazards ratios for survival data. My main effect violates the proportional hazards assumption. I understand there are several ...
1
vote
0answers
7 views

Data frame manoeuvre [migrated]

Suppose I have the following dataframe: ...
0
votes
0answers
15 views

H2O's deep learning on R has a confusion matrix problem…?

I am testing H2O's deep learning in comparison with random forest in R. When I used (1) IRIS dataset [150 observations/samples by 4 predictors/features; the last column shows the class labels (iris ...
0
votes
0answers
9 views

How to calculate linearized rate of postoperative complications in % patient/year in r [on hold]

Linearized rate is a method summarise constant hazard function in a very simple way and defined as: total number of observed events divided by total patients-year (person-year). These rates should be ...
1
vote
0answers
32 views

Fit and evaluate a second order transition matrix (Markov Process) in R?

I already built 1 first order discrete state Markov Chain model. It was built with R using the function 'markovchainFit()' in ...
0
votes
0answers
19 views

Phi correlation for multiple cells

I have this table for chi-square in R: x <- matrix(c(23,22,10,14,11,12),ncol=3) phi(x) this is a 3 by 2 table and thus phi correlation won't work here, can ...
0
votes
0answers
20 views

Modelling proportional hazards in Cox Model using coxph in R

Assume I have a heterogeneous sample with two categorical variables A and B, each with 2 levels. Now I want to measure the effect of these on the survival function. So we assume proportional hazard, ...
1
vote
0answers
21 views

How do I plot an abline() when I don't have any data points (in R) [migrated]

I have to plot a few different simple linear models on a chart, the main point being to comment on them. I have no data for the models. I can't get R to create a plot with appropriate axes, i.e. I ...
3
votes
1answer
40 views

Introductory data trend analysis with R [on hold]

I am new to the data analysis world and am struggling to find relevant articles / examples related to what I'm trying to do. I have a data set that is like this, for example how many apples are sold ...
2
votes
1answer
39 views

Best way to deal with heteroscedasticity in R?

Originally posted on stackexchange but I was told that it fits better here. I have a plot of residual values of a linear model in function of the fitted values where the heteroscedasticity is very ...
1
vote
0answers
19 views

Best way to deal with heteroscedasticity in R?

I have a plot of residual values of a linear model in function of the fitted values where the heteroscedasticity is very clear. However I'm not sure how I should proceed now because as far as I ...
2
votes
1answer
39 views

R Own Implementation of Cross Correlation using Convolution

I try to implement my own cross correlation function in R by translating it as a convolution problem. Part I: So I have two arrays, e.g. two identical arrays, and I want to get the cross correlation ...
1
vote
0answers
95 views

^ symbol in lm() in R [migrated]

I asked this question in Stack Overflow: http://stackoverflow.com/questions/29710525/symbol-in-r-lm I feel like here would be a better place to get an answer. What exactly does the ^ symbol do to the ...
0
votes
0answers
13 views

How to allocate questions to factors using R output?

I have the R output below, but don't know how to allocate questions to the factors. Any advice? ...
0
votes
0answers
10 views

Frequency analysis from time dependent data in R

I've got a time dependent data from animal recording. My data has two groups (TR and UT) each group has 20 replicate. Tiempo (time) variable goes from 282 sec to 318 sec. I have a turning point at 300 ...
0
votes
1answer
30 views

What is the baseline level in a factor-by-factor interaction?

What is the baseline level for a factor-by-factor interaction term in multiple regression? Consider this example from Fox 2003. In the regression below, these two variables are categorical: ...
0
votes
0answers
21 views

Anova (missing F statistics), Ancova and mixed modelling on nested dataset

I am performing an analysis in R and wonder how to do it since different methods return very different results. My dataset contains Samples and SubSamples as nested random effects and Type, Dose and ...
1
vote
0answers
12 views

Variance matrix for model errors

I am having trouble with understanding how can I write out the variance matrix for model residuals. I have a very simple data with 6 observations: ...
0
votes
1answer
28 views

R: how to separate date-time data types [on hold]

My data set is "weather": I need to calculate the average time and date. First I tried to separate the date and time into to different columns by: ...
1
vote
0answers
29 views

What are the best packages for Image Processing in R? [on hold]

I just have started working on an image processing and classification problem. I am familiar with both R and Python. But I am not much experienced in scikit-learn and scikit-image libraries in Python. ...
1
vote
2answers
37 views

R: how many equal letters between two strings [on hold]

I have 2 strings: "aaaabbC" and "adgfccc" I want to know how many letters appear both in the first and second string (and not how many times a letter apears) in my example, the answer will be: 2 ...
1
vote
1answer
20 views

beta-binomial distribution with R

I am studying an experiment of the kind: Let $n_{ij}$ be the number of fetuses, $X_{ij}$ the number of responses i.e. the number of fetuses with a malformation in the jth litter of the ith dose level ...
1
vote
1answer
18 views

Smoothing Kernel Preventing Simulation of Semi-Circle Law of Random Matrices

In trying to understand the properties of random matrices in the book "Plane Answers to Complex Questions" by R.Christensen, I came across the Semi-Circle Law, and tried to reproduce it with ...
0
votes
1answer
15 views

Blocks in a given numeric vector [on hold]

Given a sequence of integers: 1,1,2,3,1,3,4,5,6,2,2,2,7. It is required to report the no. of occurrences of each integer {1,2,3,4,5,6,7} but block-wise. Block-wise means an integer occurring in the ...
-1
votes
0answers
19 views

how to divide my categorical data into three clusters [on hold]

I have some data of 10 attributes, all of which are categorical attributes (factors in R). I would like to divide this data into three homogeneous sets(clusters). I went about doing 3-means ...
0
votes
0answers
19 views

R - replace TRUE with actual value [on hold]

My goal is to mark the values in plot if the value of jj is less than min_threshold and greater than ...
1
vote
1answer
21 views

Algorithm and R code for dealing with ties in Wilcoxon rank-sum test

1) I think one of the algorithms used to handle ties for the Wilcoxon rank-sum test (a.k.a. Mann-Whitney U test) is Streitberg / Rohmel. I could not find a good source which explains the algorithm/ ...
0
votes
0answers
4 views

Model diagnostic tests for local linear regression

What are some of the model diagnostic tests which are used/ would be suitable to use for a local linear regression model? Note that this is not the least squares linear model, but rather a special ...
0
votes
0answers
11 views

How to interpret a multilevel model that repeats variables for fixed and random effects (like in MCMhregress)?

I came across a specification of a multilevel model that I'd never seen before. It looks like the R function MCMChregress (see: ...
1
vote
0answers
16 views

Binomial data: Null Hypothesis $p = 0$ when all Sample Values are 0 - testing and power analysis

I am trying to investigate if the proportion of successes in my population can be shown to be larger than zero. Thus, $H_0: p = 0$ and $H_A: p>0$. Since $p=0$, the prop.test in R does not work, ...