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

correct for temporal autocorrelation in mantel tests

Hej, I want to compare the community composition of a bacterial assemblage with it's resource use ability. therefore I calculate a distance matrix based on the community composition and a distance ...
1
vote
0answers
12 views

Simple importance sampling example: What am I doing wrong?

I am learning about importance sampling and trying undertake importance sampling on a trivial example, but failing to get the right answer. I have read various PDFs online, and the relevant section of ...
0
votes
1answer
17 views

What kind of data types are best to work with prediction algorithms of R

Assuming the data is tidy and it has a mix of columns of type numeric, character and Factor. What is the data type that would give best results when using different prediction techniques in R? I am ...
1
vote
0answers
16 views

Best SQL package for R [on hold]

I am starting programing in R and I am struggling with data manipulation. I am quite fluent in SQL so it would be easier if I could work with a SQL package. Which package would you advice? And why? ...
0
votes
0answers
11 views

Multivariate polynomial regression including standard deviations (R)

I'm wondering if there is a way to take into account initial standard deviations when looking for a polynomial regression. I mean, I want to fit a polynomial like (in R): ...
0
votes
0answers
34 views

Marketing Data with many zeros

I am working on a marketing data which is a time series data with marketing spend done through different channels and revenue generated. The data looks like this : My data contains too many zeros ...
0
votes
0answers
13 views

What is a good test for comparing frequency counts between two groups?

I am looking for statistical methods used to compare frequency of observations between two groups. I have two geographical locations with data on different soil types present. for example, my data ...
0
votes
0answers
11 views

R and MATLAB: Line Plot with Layered Categorical Variables [on hold]

I'd like to reproduce the graph in the attached figure in R and MATLAB. Note that the x-axis contains categorical variables (hour and day). There could be multiple lines in the y-axis (e.g., the ...
1
vote
0answers
22 views

Spearman's rank correlation has p-value zero?

It looks like R's cor.test returns p-values of exactly zero if the real p-value is very low. For example: ...
0
votes
0answers
13 views

Prediction in mlogit [on hold]

I'm trying to use mlogit and predict the choices for my data. My data is: ...
0
votes
0answers
11 views

Permutation to test SNP interactions

sampleID case/ctrl var1 var2 var3 var4 var5... sample1 0 1 0 0 1 0 1... sample2 1 0 0 0 0 1 0... sample3 0 1 1 1 0 0 0... sample4 1 0 0 0 0 1 0... ... case/ctrl status is binary, variant status is ...
0
votes
0answers
19 views

R - Outlier detection multivariate in R [duplicate]

I'm looking for few R packages to detect outliers from a multivariate data frame. In the following Dropbox link you can find an example of data. Columns 1 to 5 are the variables and the 6th the label. ...
0
votes
0answers
2 views

Similarity measurement akin to SMAPE

I have two questions: A) Is there an official name for average of the smaller number over the larger number? B) Why have SMAPE range from 0 to 2? Isn't a range from 0 to 1 superior for understanding? ...
1
vote
0answers
6 views

Propensity score matching for “large” datasets - smarter solution than nearest neighbour?

The following question has some programming / software package as well as some numerical aspects, but I would consider it a statistical question at heart - I hope you agree. I am trying to do 1:1 ...
1
vote
2answers
38 views

Linear correlation between two sets of data

I have various data sets that correspond to values (in percentage) at given time points (hours, up to 10 hours). The total number of data sets of values at given time points is 8. My question is ...
0
votes
0answers
18 views

Getting an error message “Error in if(reached.threshold < min.reached.threshold)…” while training network using neuralnet package

I'm using R to create train and test a neural network on a time series (the annual sales of a company over a large period of time). As using the package's default learning algorithm (resilient ...
0
votes
0answers
15 views

Transforming independent variables in R [duplicate]

Is there a way through which we can determine how can we transform our independent variables to increase linearity. I am aware of boxcoz function but it provides information on transforming dependent ...
0
votes
0answers
28 views

R: Time series forecasting alternatives to ARIMA [on hold]

I was using WEKA to perform time series forecasting based on lagged variables and machine learning algorithms: Time Series Analysis and Forecasting with Weka I am trying now to do something similar ...
0
votes
0answers
5 views

Decimal delimiter using write.table [migrated]

I'm trying to output data in R using the following command: ...
0
votes
1answer
17 views

3way between subjects Anova with Unbalanced samples

I would like to perform robust 3-way ANOVA using the WRS package in R. The very first requirement is to cast the data into wide format. Hence, I have wide format data frame with unbalanced rows in ...
0
votes
0answers
14 views

Forecasting with Dynamic values using R [migrated]

I have a Json object : {"tcDetails":[{"project_nm":"abc","id":"1","n_tc":"32","TC": [{"29/06/2015":50,"30/06/2015":45,.....}] {"level":[{80,85,90,95}]}]} ...
1
vote
0answers
8 views

effect estimate without constant variance (r sandwich vcovHC)

For the sandwich package in R, when using vcovHC(model) where model <- lm(Y~X), what gives the effect estimate regarding the ...
0
votes
1answer
27 views

Clustering using gower distance in R

I have a dataframe which has categorical and numeric variables. I want to cluster this data using gower distance and get cluster values as a vector as in kmeans function. How can i achieve that?
0
votes
0answers
13 views

Not able to make daily time series analysis in R [on hold]

The following is my data, ...
4
votes
2answers
71 views

How to simulate censored data

I'm wondering how can I simulate a sample of n Weibull distribution lifetimes that include Type I right-censored observations. For instance lets have the n = 3, shape = 3, scale = 1 and the censoring ...
0
votes
0answers
15 views

CausalImpact - Is pre-processing of covariates required?

I'm using the CausalImpact to evaluate the effect of a programme. My covariates are seasonal and I wonder whether I need to deseasonalise/ detrend the regressors before using the R package? Hal ...
0
votes
0answers
36 views

Set zero axes in R [migrated]

How can one force the visualisation of the zero axes $y=0, x=0$ in R, removing the external ones siding the plot? I want to obtain the same effect that one can have for example in Gnuplot with ...
1
vote
2answers
59 views

Weibull Survival Model in R

If I run a Weibull survival model in R with the code survreg(Surv(t,delta)~expalatory variables, dist="w") how do I interpret the output of the model? That is, ...
0
votes
0answers
9 views

customized bsts model CausalImpact

I'm using the CausalImpact & bsts package to evaluate the effect of a programme. My problem is that in a model with regressor component the command ...
2
votes
0answers
12 views

Polygon pattern analysis -> point pattern analysis?

Is it correct to convert polygons to points in order to do a point pattern analysis ? I have a set of polygons that tend to be clustered around roads in a study area. I just want to show this fact. ...
1
vote
1answer
20 views

Feature selection with genetic algorithm in R [on hold]

I'm looking for a R-package that does feature selection using a genetic optimization algorithm. I couldn't find one on CRAN and I wonder whether there is a free one. I would be very appreciative for ...
0
votes
0answers
12 views

If doing a meta-analysis with R, using log hazard ratios, do I supply the variance/SE or the log variance/SE? [duplicate]

As above, really! I have a load of trials for which I have the HR, the standard error of the HR, and n. I can either supply the variance with vi=(SE*sqrt(n))^2 or ...
2
votes
1answer
31 views

Three-ways Kruskal-Wallis test [on hold]

I need to make a Kruskal Wallis a three ways. The my dataset is composed by x (Presence) and three variable. I want to see the statistical difference of my x versus all the factors. I try to apply the ...
1
vote
0answers
15 views

Cost/Benefit of BootStrapping CIs for dependent samples, but unequal number of observations

In the experiment, subjects were equally exposed to two conditions: 100 of condition_a and 100 of condition_b. A pre-determined response criteria created an unequal number of observations. Thus, no ...
2
votes
2answers
26 views

two-sample t-test VS two one-sample t-tests. What's the difference?

I have dataset which contains values of some numeric variable for two independent groups: ...
2
votes
1answer
36 views

Meta-analysis of trials given hazard ratios

I'm trying to do a meta-analysis in R (using metafor) of trials where the outcomes are hazard ratios and I'm given the 95% CI for them and/or the standard error and n. So if I have columns like: ...
1
vote
0answers
20 views

Using regression fit to compare two groups at a time point

I have estimated a regression model in R with two groups, included as factors. Their regression fits are visually quite different, but I would like to statistically test if they are different on a ...
0
votes
1answer
39 views

How to compute classification accuracy of PCA?

How to check classification accuracy for principal component analysis (PCA)? In order to compare it with different methods, for example with random forest classification, how can I compute accuracy? ...
1
vote
1answer
49 views

1 and 2 sample t-tests for plants and soils question!

I have a good friend who has an experiment where he grows different kind of plants on various soils and measures the protein content and weight each week for 5 weeks. His goal is to determine which ...
1
vote
1answer
17 views

chi-squared to test if two variables have the same frequency distribution

I want to test if x and y have the same frequency distributions using chi-squared. In my code below, I've concluded that because ...
0
votes
0answers
6 views

i want tc compute influence function of robust logistic estimator [on hold]

i have wrote the following code for computing a robust logistic estimator of m-estimators type: inf<-t(matM_w_inv) %% t(wrd[i,]) %%t(expectation_score) where: matM=Hessian/m # ...
0
votes
1answer
36 views

I want to generate outliers in binary logistic model

I want to generate outliers in binary logistic model What I want is: to select 3 elements of 10 elements that are randomly generated, and: if the selected value is 1 convert it to zero & if ...
0
votes
0answers
17 views

why nsdiffs() returns this time series is not seasonal while it looks seasonal?

nsdiffs() returns this data is not seasonal and hence no seasonal differencing is required. nsdiffs(TrainTs, m=frequency(TrainTs), test=c("ocsb","ch"), max.D=8) Error in nsdiffs(TrainTs, m ...
4
votes
1answer
9 views

Testing whether sampling (convex polytope) is uniform

Currently, I am sampling points from: i) a convex polytope (i.e. Ax <= b) ii) a high dimensional simplex The algorithms I am using are hit-and-run and a simple version of Bayesian bootstrap. I ...
0
votes
0answers
10 views

Need serious help preparing a GLMM and multinomial logit model in R

I am having trouble choosing appropriate statistical packages in R, in order to analyze (1) the relationship between a binary response variable and a few categorical variables which may be nested ...
0
votes
0answers
8 views
0
votes
1answer
32 views

set slope to 1 in linear regression in r [on hold]

In R, lm(y~x) will get the linear regression in terms of y=a+bx, giving the estimates of both slope and intercept. Now I want to set the slope to 1, and do the regression, which means the form of the ...
1
vote
1answer
20 views

Estimating error for parameters from multiple regression with linear constraints

I am working on a multiple linear regression problem where I would like to constrain only some of the parameters to non-negative values. There have been discussions of how to solve for the parameters ...
1
vote
3answers
87 views

What does this scatter plot imply? How to model it?

The data is from Udacity DAND Project 3. I finished this project but I am still wondering about some interesting discoveries. I got the scatterplot below and there must be something over there. ...
0
votes
1answer
10 views

How to add overall data to group by category chart in R? [on hold]

i have a (ggplot) chart whit multiple data grouped by factor column. I also would like to add an "overall" group to it. Is there an easy way to do this? For example i want to extend this plot with a ...