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 program in `R`.

learn more… | top users | synonyms

0
votes
1answer
24 views

prop.test: correcting for large number of observations

This is not really a coding question but more of a statistical question. I'm doing a proportions test on multiple proportions for many subjects. For example, subject 1 will have multiple proportions ...
2
votes
1answer
39 views

VIsualizing the effect that only one predictor has on the outcome (R)

So I have performed a logistic regression on a data set with multiple predictors. I want to graphically represent the relationship between the outcome and only one of the predictors. What would be the ...
2
votes
1answer
13 views

Small number of points driving correlation

I am currently looking at trying to find high correlations in a series of data. I initially just thought I could check the correlation of the data and choose those with the highest correlation but ...
1
vote
0answers
28 views

How to test whether a distribution follows a power law?

I have the data of how many users post how many questions. For example, [UserCount, QuestionCount] [2, 100] [9, 10] [3, 80] ... ... it means each of the 2 users posts 100 ...
0
votes
1answer
15 views

Multivariate regression or PCA to reduce response variables?

I hope the title is self-explanatory, but essentially I want to know which method is better: does it make sense to use a PCA to reduce a number of response Y variables and then conduct a univariate ...
0
votes
0answers
16 views

How to calculate marginal effects for categorical covariates using mlogit in R

I am trying to use the mlogit package in R and have been following the vignette trying to figure out how to get the marginal effects for my data. The example ...
0
votes
1answer
23 views

R rpart classification tree error [on hold]

I am trying to run a classification tree in R using the rpart package in R. I keep getting the following error: ...
1
vote
1answer
47 views

Multivariate model in lme() with independent random effect, similar to MCMCglmm

I would like to specify a multivariate model with lme with a random effect for group which is independent across variables. I found this post, which explains that ...
-1
votes
0answers
38 views

Robust regression in R with robust::lmRob

I am using the lmRob function in R to do my robust regression. In the R documentation of lmRob found here you can set the ...
-1
votes
0answers
25 views

Is this the proper way to create a simple linear time series model in R

I'm trying to create a simple ols model over time from a time series. Here's what I have cagr.lm.time <- lm(cagr.xts ~ time(cagr.xts)) Where cagr.xts is the ...
1
vote
0answers
23 views

Logistic regression with multi-class features in R

I'm working with a data set like the following: X = ...
1
vote
0answers
45 views

How to deal with “not applicable” values in categorical variables

My situation: small sample size: 116 binary outcome variable long list of explanatory variables: 44 explanatory variables did not come from the top of my head; their choice was based on the ...
1
vote
0answers
37 views

methods to perform feature selection in unsupervissed learning

What are the available methods/implementation in R/Python to discard/select unimportant/important features in data? My data does not have labels (unsupervised). The data has ~100 features with mixed ...
0
votes
0answers
20 views

gbm R multinomial vs bernoulli

I am using the gbm package to fit a binary variable using several attributes, some numeric and some categorical. Since the output varible was defined as factor I initially did ...
1
vote
0answers
11 views

How to do multivariate outlier detection in mixed data with category?

I have a data table where the entries are in the following format. The first column is category, which represent the product category. I have 5 such categories. ...
1
vote
1answer
22 views

KS test - R, Minitab (and Systat)

I'm trying to figure out how Kolmogorov-Smirnov one-sample testing for normality is done in Minitab (or Systat, since the answers apparently match). If this is my data vector: ...
0
votes
0answers
7 views

Obtain resulting table to plot graphics in R [migrated]

I'm new with R in QGIS, I could write a simple script, and I want to obtain the table resulting, the table wich R uses to create the plot graphics. How can I do that? This is the script: ...
0
votes
0answers
11 views

Increase plot graphic details in R [migrated]

I'm new with R in QGIS, I could write a simple script, and I want to increase the detail of the plot. How can I do that? This is the script: ...
0
votes
0answers
16 views

Confidence intervals on 'cross plots'

I have a large set of data comprising triples of points (t, y1, y2). At each t, I have a distribution of y1 and y2 points, each of which is approximately normal. I would like to create a plot of y1 ...
1
vote
0answers
33 views

Different p-values between Wald Z and Wald Chisquare

I have used lme4 for mixed effects models of reaction times and accuracy rates. I could not use lmerTest because the type of model I was using are not yet implemented there (problem with predictors ...
2
votes
2answers
117 views

R: Fitting a model with periodic, nonlinear and categorical components

Can anyone give me some advice on how to fit a model with linear (some categorical), non-linear and time series components in R? I don't want to use a non-parametric model like a Loess smooth or ...
-1
votes
0answers
21 views

Extract data from pivot table to data frame (i.e. “reverse the pivot”) [migrated]

I have the following data showing some numbers, broken down by year and month (the more recent happens to be first, but that's not a problem). Is there (in R) a way to easily "reverse the pivot ...
0
votes
1answer
27 views

k-means in R generates same number of clusters but different cluster label

Hi there I am running a k-means code in R with the same data and with the same number of clusters, in this case 3, but each time that I run the code, the cluster label changes, for example. In the ...
0
votes
0answers
12 views

Advanced R Programming Questions. Variable Names in Environments [migrated]

I wrote 2 functions to archive objects from R (with their names - that's really important for me) and, if an object is of class lm, to archive data used to conduct ...
4
votes
1answer
99 views

chi square test or Z test?

SO I have an outcome from a biological experiment, where I have counted the number of dead cells upon a mutation. For example, in once case - out of 120 cells we saw 16% of the dead cells, but our ...
1
vote
1answer
38 views

Cross-correlation in R – dealing with missing values

I have two time series. One is an environmental variable (n = 108) organized by year and month. The other is a biological variable, also organized by year and month, but I have no data for some months ...
0
votes
1answer
30 views

MAPE is high for daily sale prediction

I have daily sales data from 2011 to 2013. I have to do prediction for 2014.I have used arima and exponential method to predict the daily sale, but it is not giving the better result. MAPE is around ...
0
votes
1answer
17 views

Getting expected value of future value with time varying data (credit card revolving and fee data) . Customer lifetime value

I have a credit card data and that contains monthly amount of revolving and amount of fee for each customer. As a bank perspective, I want to get the expected value of future revolving amount and fee ...
2
votes
0answers
51 views

In R, what does anova(f1, f2, f3) compare?

I'm trying to understand the reason why anova(f1, f2, f3) and anova(f1, f2) gives me different result while anova(f1, f2, f3) and anova(f2, f3) gives me the same. Here's the code: ...
3
votes
1answer
66 views

comparing OLS, ridge and lasso

I am trying to compare OLR, ridge and lasso in my situation. I could calculate SE for OLR and lasso but not for ridge. The following is Prostrate data from ...
2
votes
1answer
66 views

how to calculate effective degrees of freedom in ridge regression in R

Here is example to workout: ...
1
vote
1answer
40 views

Compute mode of a quadratic regression with confidence intervals

I have a quadratic regression y against x and I'm interested in the value x where y is the maximum (ymax->x). I can compute x(ymax) but I'm also interested in the standard error or confidence ...
0
votes
1answer
45 views

How to do multivariate regression in R?

I need to preform a multivariate normal regression in R. The question is: Let $Y_1$, $Y_2$, and $Y_3$ follows multivariate normal distribution. What is the conditional of $Y_3$ given ...
0
votes
0answers
13 views

How to bin x,y,z vectors into matrix (R) [migrated]

This is probably a basic question, but I haven't been able to Google anything helpful after trying for days. I have an R dataframe with x,y,z tuples, where z is a response to x and y and can be ...
0
votes
0answers
46 views

Calculate the average of hourly data of three sensors

I am trying to calculate the average of hourly data of three sensors but the hourly timestamps of all three sensors are different. How is it possible to measure the average of hourly data of all three ...
0
votes
0answers
9 views

Estimating Pearson III density using R's lmomco package

I am trying to estimate parameters for a Pearson III distribution using package "lmomco" (session information given at the end). I have 40 precipitation values in vector "val.x". I estimate P3 ...
11
votes
2answers
138 views

Bayesian lasso vs ordinary lasso

Different implementation software are available for lasso. I know a lot discussed about bayesian approach vs frequentist approach in different forums. My question is very specific to lasso - What are ...
1
vote
1answer
58 views

Why do ANOVA p and F values change?

I am currently conducting a two-way ANOVA on a dataset and have noticed how significance and F values change dependent on the type of ANOVA I use in R. Why is this? For instance, if I run a two-way ...
3
votes
0answers
46 views

Mixed effects modelling; what to do when model is over-specified?

I'm trying to use mixed-effects modelling to analyse some data. There are a number of variables that I need to specify within the model, two of which are between-participants (...
1
vote
4answers
243 views

How to perform proper data mining on time-series data?

I have some daily data from city A, B, C. Values from city A are highly correlated with values from other cities for lag -1,-2,-3 and -4. I want to use Random Forest, SVM and ANN to predict values ...
0
votes
0answers
13 views

Cross-sectional SUR in R

Is there a package in R that can estimate panel data with cross-sectional seemingly unrelated regression generalized least squares weights (like in EViews)?
0
votes
0answers
12 views

How to identify contributors in groups of people

I have a set of 120,000 people. These people are assigned to 10 million groups. Each of these groups have a target variable indicating the kind of output it made (A, B, C or D). I'd like to identify ...
4
votes
1answer
48 views

Hyper-volume of the $\alpha$ contour of a multivariate Gaussian

I'm looking for the assymptotic ($n\rightarrow \infty$) value of (the log of the determinant of) the covariance of the $\alpha$% of observations with smallest Eucledian distance to the origin in a ...
0
votes
0answers
29 views

How to separate distributions from weighted dataset?

I’m trying to separate two component distributions of an apparent finite mixture from a weighted dataset (determined by a weighted.histogram). I've a set of data and weights only for a part of the ...
3
votes
3answers
184 views

ARIMA Intervention Transfer Function - How to Visualize the Effect

I have a monthly time series with an intervention and I would like to quantify the effect of this intervention on the outcome. I realize the series is rather short and the effect is not yet concluded. ...
2
votes
1answer
46 views

LASSO in the data with large number of variables (p) with lower number of samples (n)

I would like to fit LASSO in the following type of data where there are large number of variables (p > n). My y variable is y ...
1
vote
0answers
27 views

code assistance - how to bootstrap and plot paths with a mixed model

I created an Arima (3,1,1) model using the steps below. I was able to create a nonparametric model, but now I would like bootstrap for the created model (model 3). Also I'd like to plot the paths of ...
2
votes
0answers
28 views

R GLM verifying performance statistics for validation

I do not want to say my AUC is 0.77 and find out I am overlooking a lot. Below is my code and a two question at the bottom: ...
0
votes
1answer
41 views

test validation versus k-fold cross validation

I am attempting to use a neural network, after using other machine learning algorithms. I am using the RSNNS package (I am willing to use / evaluate other packages) that's part of R. I would like to ...
2
votes
1answer
47 views

How to get percentiles from empirical density in R?

The density() function in R allows me to enter observations and get an empirical density that I can plot x and y values. I like ...