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
16 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
63 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
10 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
24 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
31 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
37 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
10 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
12 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
1
vote
1answer
12 views

Solving “n” equations with 3 unknowns

I'm new to R and I'm trying to solve a system of equations. I have about 380 equations where i have 3 unknowns per equation. I can use three equations and solve by using "solve()" and it works great. ...
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
21 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
89 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
13 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 ...
0
votes
0answers
35 views

Running Multiple Linear Regression in R with 3 Factors and 1 Continuous Variable

I am running a Multiple Linear Regression model using R. I am looking at travel behavior and most of the variables are factors with YES or NO as responses. However, I am concerned about using 3 ...
0
votes
0answers
15 views

Biplot diagram of PCA analysis differs from plot of variables [on hold]

In R I made the following PCA analysis: pca_<- dudi.pca(df=rg,scannf='F',nf=2) then plotted the result: scatter(pca_) I ...
1
vote
0answers
16 views

Parameter estimates from extended cox model using the coxph() function from the survival package in R

I want to understand how the parameters from a Cox Model using the coxph() function from the survival package in R are estimated. I am following a book by Rizopoulos [1]. In the book the partial log ...
0
votes
0answers
16 views

Fitting a student t distribution in R using fitdistr() yields error “non-finite finite-difference value” [migrated]

Reproducable example which will give the mentioned error code every time is: (Note that even without set.seed, the error comes up every time) ...
2
votes
1answer
38 views

Calculating constant hazards in exponential survival distributions in R using survreg()

In an ecological seed removal experiment, we have seed removal data from 720 seed plates with 25 seeds each. For each plate, we know the number of "surviving" seeds at several times ti until the end ...
0
votes
0answers
5 views

Valid values for nvecs sparseDecom2

I hope this is the right place to ask, and that someone would know the answer I am searching for the optimal sparseness value to solve a sparse regression problem (using MRI data) that involve ...
0
votes
0answers
34 views
+50

How to interpret conditional odds ratios from a three-way contingency table?

I am trying to understand how to correctly interpret the estimated conditional odds ratios from a loglinear model on a three-way contingency table. This is an example from Agresti 2013 (p. 346, ...
0
votes
0answers
13 views

Forecasting values along with corresponding years [migrated]

I have a sample data set (named as s3) in the following manner: ...
2
votes
1answer
9 views

Avoiding a spline dip [duplicate]

First off, I'm not very experienced in math techniques, so I am wide open to suggestions. I am working with a set of data in R. I have a curve (mostly linear at first, peaking suddenly, then ...
2
votes
1answer
26 views

Reproduce this chart using the provided equation

I am trying to reproduce this chart: which depicts the probability of various a gene is insert in a mutant screen by a transposon. Apparently the graph is constructed from the following equation: ...
1
vote
0answers
25 views

K-means cluster significance after PCA and hierarchical clusters in R with FactoMineR

I am using FactomineR to explore a set of continuous variables in a large set of sites (ecological data). I did a PCA and found the relevant principal components and their scores and such. Afterwards ...
2
votes
0answers
31 views

Multiple regression with an unbalanced grouping factor

I have a question regarding multiple regression with an unbalanced grouping factor. Essentially what I am doing is an ANCOVA, but the interaction term ends up significant (which is interesting!) so ...
1
vote
0answers
31 views

SVM for regression : confidence intervalls

I use the svm function (for regression) to make forecast like I would with for exemple the arima function: fit<-auto.arima(ts) ...
0
votes
0answers
9 views

How do I interpret overdisperion from glmmADMB models?

I have troublesome count data with loads of zeroes. All of the count, binary, and proportion models with GLMER are over dispersed and/or have bizarre residuals. I used Ben Bolker's overdisp_fun(). ...
0
votes
0answers
7 views

combining 2 dataframes, replacing values of one frame with other R [migrated]

Maybe this is easy, but I can't figure out a way to do this. My real issue is with a much larger data set, so I'm looking for something more elegant than what I'm currently doing. I have 2 data ...
0
votes
0answers
5 views

Problem with TSO function in tsoutliers [migrated]

I am trying to get the tso() function of the tsoutliers package to work but I keep running into the same maddening error when the dplyr package is loaded that I can't seem to figure out. Any ideas? ...
0
votes
0answers
15 views

ARIMA Simulation in R does not model data well

I have a time series that I wish to model with an ARIMA model in R. I computed the ARIMA model like so: arimaModel = arima(data, order = c(5,0,1)) When plotting ...
0
votes
0answers
25 views

Regression by random forest in R [closed]

I've worked with artificial neural network in matlab to predict data. There were feed rate, cutting speed and hardness as input and surface roughness as output. But now I want to predict surface ...
4
votes
1answer
28 views

Understanding warning message “Ties are present” in Kruskal-Wallis post hoc

I'm running post-hoc comparisons after a Kruskal-Wallis test. I'm using the PMCMR package. ...
0
votes
0answers
10 views

Rpart problem - cannot fit tree [closed]

I'm trying to use rpart to make a decision tree, however whenever I use rpart on the dataset I get no branches created. I understand that it won't fit a tree if the fit is poor, however I'm using ...
1
vote
0answers
32 views

Prediction Interval: Propagate error associated with variable in R

I have a linear dataset with known values of X & Y in R. I treat the dataset as a linear model. I have a data point with a known value of X and an unknown value of Y. The X value has an ...
0
votes
0answers
25 views

R programming: Can you use dplyr to apply a function to every row or column like apply(base) or ddply(plyr)? [closed]

group_by(dplyr) is great but you can't group_by every column or row, you can only group by a couple variables. that's my understanding. I want to apply a function to every single variable of a ...
0
votes
0answers
10 views

Predicting probabilities classification functions [closed]

I want to get the probabilities for classification problems in R. If I use predict(...,type="response",...) in Logit or Probit I receive the probabilities for the ...
0
votes
0answers
7 views

Format of data for apriori function in R [migrated]

I'm working on market basket affinity and I would like to use the apriori function in R from the arules package to determine which items are frequently purchased together. My question is how do I ...