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

logistic regression R and Stata [on hold]

I mostly use Stata for my regression analysis. I want to conduct a logistic regression on a proportion/number of success. Because I receive errors in Stata I did not expect nor understand (if there ...
1
vote
0answers
6 views

Check hazard proportional assuption in a large coxph

I would like to check hazard proportional assuption in a large coxph. Usually I check it with cox.zph but with large coxph my p-value are very small whereas the log(-log(S(t)) curves are almost ...
0
votes
0answers
4 views

Dispersion parameter in quasi-likelihood models in glm

Dispersion parameter given by glm.summary (when quasipoisson or quasibinomial is used) is different from overdisperson calculated by Pearson residuals or residual ...
0
votes
0answers
4 views

spike slab with R

in spike slab regresson, how do we understand the beta coefficients signicant in output in R? I mean, R gets "bma" and "gnet" solutions like below, these coefficients are the significant ones? So it ...
0
votes
0answers
5 views

JAGS equivalent to R's I() (Inhibit Interpretation of Objects) function?

I'm wondering if anyone has come across the JAGS/BUGS equivalent to R's I() function. I am interested in using this in a polynomial logistic regression, i.e.: mod1 <- glm(Employment ~ Density + ...
0
votes
0answers
10 views

What is the final equation used to produce new prediction using kknn on R

I have trained my data using kknn on R and was able to predict on a new data set. However, I'd like to know what the actual final equation is so I can reproduce the prediction manually. My training ...
1
vote
2answers
53 views

Plotting simulated data points from f(X)+e using R [on hold]

Below is a chart from An Introduction to Statistical Learning by Hastie and Tibshirani. The authors use the chart to explain overfitting. In the chart, Y is the response variable and X is the ...
-1
votes
0answers
13 views

Given a set of data, how can I know which distribution those follows? [on hold]

The data contains 2000 observations. I also want to know which R package could solve this problem.
0
votes
0answers
6 views

Lavaan - testing multiple mediators [on hold]

How can I add covariates into Lavaan to test multiple mediators simultaneously while using bootstrapping?
-1
votes
0answers
15 views

How to cluster in R when multivariate data distribution are non-normal? [on hold]

For example, there are 3 different continuous variables with 2000 observations. And all variables are skew distributions. Is there any R package able to solve this? Or can all variables transform to ...
0
votes
0answers
14 views

SVD and recommendations, Using R

I am working on the Jester5k data set from the recommenderlab package in R. I have imputed missing values in the matrix as follows: impute.5 = impute.svd(Jokes, 5) #Jokes is a matrix of Jester5k ...
1
vote
0answers
20 views

propensity score matching and survival analysis

I am using the Matching R package to compute Average Treatment Effect within Propensity Score Matching (PSM). I have two groups: treatment and control. In ...
0
votes
0answers
18 views

Making R-Package: NAMESPACE [migrated]

I am creating a R-package and I am at the step where I BUILD the package. I have read the Writing R Extensions documentation about NAMESPACE (more specifically the ...
0
votes
0answers
7 views

Interpreting summary of ICC results in R package “psych”

I have a dataframe "all.st.icc", where 27 subjects have measures of social behavior for each of 8 different years. First four rows of data are as follows: ...
1
vote
3answers
31 views

finding p-value in pearson correlation in R

Is it possible to find the p-value in pearson correlation in R? To find the pearson correlation, I usually do this ...
3
votes
3answers
26 views

Hypothesis Tests for Non-linear least squares coefficients

I have a set of results that take the following form: ...
2
votes
0answers
2 views

R: Kernel discriminant analysis and how to get the kernel cumulative density estimate and prediction(package ks)

I use the R-package ks to do some kernel density estimation (the underlying kernel is the gaussian kernel and the default bin width selector is plug-in selection, ...
0
votes
0answers
16 views

Comparing r values for two groups in metafor [on hold]

I am trying to conduct a small meta analysis of 4 studies where I compare the r values of two different groups (male vs female). Ive been playing around with the syntax and have gotten: ...
1
vote
1answer
24 views

ggplot2 - geom_density(): how to change legend title and order [on hold]

i created a density diagram for a set of data, divided by the different weekdays. ggplot(template, aes(x=test, color=as.factor(Weekday))) + geom_density() Now i ...
1
vote
0answers
18 views

Text mining of machine logs to find correlation between errors in R [duplicate]

I've with me 50 MB data from a machine consisting of event logs such as device status, warning and error. I wish to perform text mining on the same to find correlation between errors i.e. one error ...
2
votes
1answer
14 views

Text mining of machine logs to find correlation between errors in R

I've with me 50 MB data from a machine consisting of event logs such as device status, warning and error. I wish to perform text mining on the same to find correlation between errors i.e. one error ...
1
vote
0answers
38 views

PCA Algorithm & Residual in R

I'm studying the PCA algorithm. But I have a problem with the residuals. I did the same as in the manual below until step 5. From step 6, I don't quite understand the idea, as the dimensions of $Y$ ...
0
votes
0answers
9 views

Quantifying importance of environmental variables in Canonical Correspondence Analysis using R? [on hold]

I currently have species abundance data for multiple lakes along with measurements of some environmental variables for each lake. I decided to do Canonical Correspondence Analysis of the data in R, as ...
5
votes
0answers
16 views

Kaplan Meier estimate for data with unequal numbers in treatments

Is it possible to estimate Kaplan-Meier medians, CIs and difference with unequal sample size in treatments or do I have to do coxph? For example, in my dataset, ...
1
vote
0answers
12 views

Specification of partially crossed longitudinal subjects in linear mixed effects model (lme4, lmer)

I am familiar with linear regression models, but I am in the process of learning about linear mixed effects models. My data consists of measurements for each month for a set of subjects over a long ...
0
votes
0answers
8 views

How to rescale “linear predictor” in drawing nomogram with “rms” package in R? [migrated]

I am trying to draw a nomogram from a logistic regression in R by using the rms package, but currently I have a problem: indeed, I can get the nomogram, but the "linear predictor" axis ranges from ...
1
vote
2answers
28 views

How to interpret decomposition plot and check for seasonality

I'm new to this and I have a question about the results that I get from checking whether my data contains seasonality or not. I have a csv file which contains date, period and year. However, R reads ...
2
votes
0answers
20 views

Monte Carlo choice of sample size

If I have $U_1,U_2,... \sim i.i.d~~ \text{Uniform}(0,1)$, and $f(x) = \sqrt{1-x^2}$. Then, by the Strong Law of Large Numbers: $$ P \left( \bigg{\lvert} \frac{1}{n}\sum_{k=1}^nf(U_k)-\int_0^1f(x)dx ...
1
vote
1answer
20 views

Interpretation of model comparison with random slopes using lmer in R

I have a large data set with repeated measurements of same blood value (co) (2 to 7 measurements per patient). Each measurement is coupled with time which is the time interval between surgical ...
2
votes
2answers
43 views

Singular value and eigen-decomposition of a square symmetric matrix should be identical, but differ in sign

As far as I know, singular value decomposition (SVD) and eigendecomposition give the same result for symmetric square matrices. But when I check the results in R, that's not what I see. Please see ...
1
vote
1answer
33 views

Interpreting the result of decomposing time series

I don't have a lot of experience working with time series data. Now I have a 3 year, monthly data for several entities (you can think about them as different stores), that I would like to do some ...
2
votes
3answers
39 views

Difference between rexp and qexp in R

I need to write a simulation that requires the use of exponential distribution. I was wondering what is the difference between the following two approaches in drawing random numbers from an ...
0
votes
0answers
19 views

Interpretation results seasonality in data R [duplicate]

I have a question about the results that I get from checking whether my data contains seasonality or not. I have a csv file which contains date, period and year. However, R reads the date as a factor ...
0
votes
0answers
22 views
0
votes
0answers
21 views

Non linear optimization in R [on hold]

I am working on a non linear optimization problem and the packages I have been trying to use are alabama Rsolnp and nloptr. But in each case I seem to be getting the same kind of error where I am ...
0
votes
0answers
24 views

Understanding lm() function in R with weights

Consider the following simplified dataset (sales and percent of color-type sales by region): ...
0
votes
0answers
20 views

Input EGARCH model (idiosyncratic volatility)

I have a time-series of historical volatility observations. I want to use an EGARCH model because I believe it is a better representation of the behaviour of these volatilities. Can I estimate an ...
0
votes
0answers
6 views

Is it possible to apply a weight against multiple attributes in Rattle?

Hi I'm trying to figure out how to apply weight to multiple attributes in Rattle. I'd basically like SVM or random forest models to give greater weighting to ...
0
votes
0answers
24 views

KS, RMSE tests in R

I have a set of yearly peak river flows and I am trying to use the KS test to conclude if the data is coming from a generalized extreme value (GEV) distribution. I am also trying to calculate a root ...
1
vote
1answer
50 views

Lme4 and lmertest: Different degrees of freedom from same dataset

I just encountered a problem while analyzing experimental data using lme4 and lmertest. In the experiment, 67 subjects gave 3 ratings for 50 stimuli shown for 3 different durations (a total of 10050 ...
0
votes
0answers
16 views

Contrast 3 is orthogonal to Contrast 1, Contrast 2

The question is using orthogonal contrast: 4 different paint (1,2,3,4) surface with 2 levels(Asphalt, concrete) for contrast 1: I would like to compare paint 1 and paint 2 for contrast 2: I would ...
2
votes
1answer
25 views

Plotting a ECDF in R and overlay CDF

I need to plot a ECDF in R and overlay a CDF. In my case I have to do this with the gamma distribution where alpha = 2, ...
0
votes
0answers
29 views

How to get the most important variables in random forests in R?

I am building a random forest in R and was wondering how to extract the most important variables. I am using a random forest to classify if a click is fraud or not, and the goal is to identify ...
0
votes
0answers
9 views

Allocation of product with ANOVA or something else (?) in R - what direction and tests to use?

Assuming a very simplified view of my data looks like this: ...
0
votes
0answers
20 views
+50

factorial analysis of 2 quantitative + 2 qualitative - inconsistent results

I have a dataset composed of 4 variables, 2 being numerical and 2 categorical (ordinal in fact). They all represent 4 types of indicators/measures of the same phenomenon . I want to analyse them in a ...
1
vote
0answers
8 views

Leave-one-out cross validation with bayesian networks - R

I have a dataset with 1000 rows and 10 columns and s/n values. The head of the data : ...
4
votes
1answer
23 views

How to find factor that is making matrix singular

I have a 300+ column data.frame, and no matter how I break it up I get this error every time: ...
4
votes
3answers
62 views

Interpreting random effect variance in glmer

I'm revising a paper on pollination, where the data are binomially distributed (fruit matures or does not). So I used glmer with one random effect (individual ...
0
votes
1answer
16 views

How to implement knn in r with missing values?

I have this data set from https://archive.ics.uci.edu/ml/machine-learning-databases/credit-screening/crx.names which gives a good summary of the attributes im using. Some of the observations are ...
1
vote
1answer
10 views

Combining text and non-text features

I am working on a binary classification problem using SVM. I am currently using ksvm in R (kernlab package). The input is a combination of text and scores. I would like to be able to use substring ...