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

Reference for manually fitting regression in R [on hold]

Anyone know a book, website, notes, course or anything that can use as a starting point to learn about fitting regressions manually in R? OK, the linear regression of the logistic regression might be ...
0
votes
1answer
13 views

Multivariate logit

I'm looking for a statistic model and a package in R to do it. I have n individuals with k possible financial products where they can put a % of their incomes. Is there a way to model concurrently ...
0
votes
0answers
9 views

Power analysis for binomial data when sample sizes are different

I'm running an A/B test where I want to compare two different layout of a button and want to see if one layout lead to a higher Click-Through Rate with a certain statistical power. I want to use a ...
1
vote
0answers
16 views

Where can I find resources to learn about change-point analysis ?

Where can I find resources to learn about change-point analysis ? Hopefully, someone can advise me a textbook to read and it will cover both univariate change-point analysis and multivariate ...
1
vote
1answer
21 views

Model Formulae. correct model?

I'm trying to build the following model in R, however I'm quite confused about the model formulae to use to include an interaction (x1 and x2) $Y_{}=a+b*x_1+cx_2+d(x_1*x_2)$ this intuitive formula ...
0
votes
1answer
24 views

Generate data from a bivariate power-law distribution in R

I need to generate data from a random vector that follows a bivariate power-law: $$ f_{X,Y}(x,y) = \frac{C}{XY} \left(\frac{X}{X_0} \right)^{-\alpha} \left(\frac{Y}{Y_0} \right)^{-\beta} , $$ where ...
-1
votes
0answers
17 views

Visualize process data

I am having a dataset of order processing with 8 millions rows with following column HistoryId - Identity column of the records ItemId - Id of the item tracked Previous status - status of Item ...
-2
votes
0answers
11 views

Error in eval(expr, envir, enclos) : object 'Case' not found in train( method=rpart) in caret package of R [on hold]

I am trying to fit my training data for Coursera Practical Machine Learning Quiz 2. ...
1
vote
1answer
27 views

How to plot a comparison of read counts in R

I have a bunch of genetic read counts for different several genes. Each gene is divided into two groups (0 and 1). What I want to do is make a vertical plot side by side of the 0 group and the 1 ...
0
votes
0answers
16 views

Arima model - multi step forecast

The following code shows a forecast of the next 24 hours of my electricity prices with two exogenous variables. My problem is, that I don't know how to build a forecast for the next 3 days or more ...
1
vote
1answer
38 views

Should a Poisson regression be carried out with only 3 data points?

I'm trying to test the relationship between the number of adults counted and the percentage heather cover over 3 areas. The data looks like this: ...
0
votes
0answers
27 views

Significance of varibles after stepwise regression

I did stepwise regression with my multiple regression model and using AIC as a measure of fit with the step function in R. Afterwards some variables that the ...
1
vote
0answers
17 views

Partition of sums of squares (ANOVA)

Can anyone explain the theory (or the formula) about computing Sum Sq (bold highligh below) related to regression items? The Wikipedia link gives an introduction on how to calculate the total, model, ...
0
votes
1answer
17 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
31 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 ...
1
vote
1answer
12 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
19 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
0answers
10 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
0answers
15 views

R rpart classification tree error

I am trying to run a classification tree in R using the rpart package in R. I keep getting the following error: ...
1
vote
0answers
30 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 ...
0
votes
0answers
24 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
22 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
20 views

Logistic regression with multi-class features in R

I'm working with a data set like the following: X = ...
1
vote
0answers
28 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
33 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 ...
1
vote
0answers
10 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
0answers
34 views

Help with fitting a non-linear model in R using nlsList

I've done a lot of research so far on fitting a non-linear model in R, but I'm having trouble with it. I'm working with creating a ticket sales model that looks like: ...
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: ...
1
vote
0answers
25 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 ...
0
votes
0answers
27 views
+50

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
25 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
97 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
29 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 ...
-1
votes
0answers
17 views

Using for loop to find a string in a varying coefficient AR [on hold]

I am trying to output the following text: s(a[i,j,k], by=data[,c(2)])+s(a[i,j,k], by=data[,c(3)]) + s(a[i,j,k], by=data[,c(4)])+s(a[i,j,k], by=data[,c(5)]) My ...
0
votes
1answer
21 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
16 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
45 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
60 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
57 views

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

Here is example to workout: ...
1
vote
1answer
35 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
43 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
26 views

Homogeneity Test [on hold]

Has anybody used R for data homogeneity testing. I want to use the SNHT (standard normal homogeneity test $^{[1]}$), Pettitt$^{[2]}$, Buishand$^{[3]}$ and Von Neumann$^{[4]}$ tests for the ...
0
votes
0answers
37 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
35 views

How to plot more than 6 shapes on ggplot in R? [on hold]

I have data that I would like to plot and use shapes to symbolise the data . In total I have 20 potential different pieces of data to be represented by shapes. e.g they are labeled such as R/Hand ...
0
votes
0answers
7 views

FNN package for R - possible to use manhattan or other distance metrics? [on hold]

It is possible to change the algorithm, but I am stuck trying to change the distance metric. I know it usually makes little difference, but in this case I need it!
5
votes
0answers
68 views
+50

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 ...