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
12 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
11 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
6 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
4 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
14 views

KS, RMSE tests in R

I am trying to calculate KS p-value and RMSE for a set of streamflow data in R. This is my first time doing this, and I want to be sure i am not doing something wrong. The data: ...
0
votes
0answers
11 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 ...
-1
votes
0answers
23 views

Use ks test in R [on hold]

I wanted to use the Kolmogorov-Smirnov test in R to evaluate how dissimilar two emp
0
votes
0answers
12 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 ...
0
votes
0answers
23 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
4 views

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
5 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 : ...
3
votes
1answer
18 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
41 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
14 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
0answers
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 ...
5
votes
0answers
77 views

What's wrong with this visualization of eigenvalues/vectors/PCA?

I have a dataset of 17 people, ranking 77 statements. I want to extract principal components on a rotated correlation matrix of correlations between people (as variables) across statements (as ...
2
votes
0answers
20 views

Finding the optimal combination of independent variables for a constrained dependent variable

I'm currently working on power plant time series data and my main objective is finding out the optimal combination of independent variables which would keep "SO2 concentration (dependent variable) ...
0
votes
0answers
17 views

Find sample size of all interactions for cross classification GLM in R [on hold]

Suppose that I have a response variable called A and four explanatory variables that are all factors (all with at least 3 levels) called B, C, D, and E. I know that the total sample size of my data is ...
0
votes
0answers
12 views

Confidence interval for the difference of two proportions from small sample size

Suppose I have two trials with small sample sizes such that the event rate for the first trial is $p_1=2/25=0.08$ and for the second trial $p_2=3/20=0.15$. I am wondering what may be the best way to ...
2
votes
1answer
50 views

Comparing models in linear mixed effects regression in R

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

Non-linear regressions with caret package in R [on hold]

i'm new using R and my doubt is really basic. I have several dependent variables (x) and one independent variable (y), and I'd like to generate different regression models with ...
1
vote
0answers
16 views

calling R2OpenBUGS with Wine on Mac [on hold]

I really don't know where to go for a solution to this problem. This may not be the right place... I also tried stackoverflow but got no response. Any suggestions gratefully received. I'm trying to ...
1
vote
0answers
23 views

How to determine if a categorical variable affects an independent variable?

I am looking at the wine dataset from the R FactoMineRpackage to find out whether the categorical variable soil type affects the ...
1
vote
1answer
26 views

When is a Ljung-Box test significant?

I have trouble understanding the output of the Ljung-Box test due to conflicting information: The R documentation doesn't actually say how to interpret the output. This site states that small ...
2
votes
1answer
189 views

Negative-binomial why the answer is 0.288?

In a negative-binomial experiment with three independent trials, if I want the probability for 2 successes before the first failure. The probability of each trial is 0.6. ...
1
vote
0answers
13 views

Intercept in glmnet

I am trying to fit a regularized logistic regression to my data using glmnet. Using $\alpha=1$ I get a LASSO-regression, which is what I want. My problem is though that I don't know how the intercept ...
0
votes
0answers
18 views

Quantile regression prediction in r

When I call predict.rq function, it returns a matrix which stored different predictions when in different quantiles. But I only need exactly one number for each ...
0
votes
0answers
9 views

Define Data in R [on hold]

I have a data file with one column and 1000 row. I want to label each value in my data so I can call it if I want it. For example, if I name my data with C then I want to use the first value (c_1) or ...
0
votes
0answers
30 views

Curve fitting in R

I had 4 groups of data (in color 1 to 4) and one group is the data for one day, so I had 4 days of data. I was trying to fit a line which describes the pattern of theses lines (oscillating pattern) ...
3
votes
1answer
33 views

Spatial autoregressive model implementation in R

I need to implement a SAR model with no covariates. To be more specific, the regression I have to estimate is y=bWy+e where: y is the dependent variable; b is the coefficient parameter to be ...
0
votes
0answers
30 views

Arraning arriving Trains as good as possible to minimize the number of Tracks needed [on hold]

The problem I like to solve is very similar to the following: There are a number of trains arriving at different times, and staying for different duration at a rail station. e.g.: Train 1 arrives ...
0
votes
1answer
16 views

Does there exist an algorithm/package in R that tells if a matrix is aperiodic? [on hold]

I am currently reading Golub and Jacksons paper "Naïve learning in social networks and the wisdom of crowds" published in the American Economic Journal: Microeconomics in 2010. On page 120 they say ...
2
votes
2answers
25 views

R: how to interpret mosaic and association plots

I'm using the mosaic and assoc functions in the library vcd. My mosaic plot is as follows: ...
1
vote
0answers
30 views

Linear regression - Simulation - “what if” scenario

I have an assignment at university and I have been given a simple situation which I would like to explain here. Situation: I would like to perform simulation on purchase price of a product and see ...
0
votes
0answers
18 views

How to fit intensity peaks from a image?

I have a image - that I can convert to a txt/table with all intensities. In this image, several regions show higher intensity, i.e. a peak. A peak may be stored in a 10x10 matrix with rows and colums ...
2
votes
0answers
5 views

Forecast Function for Historical Data (Fitted Values)

I am fairly new to R so my data manipulation experience isn't as strong as it is with other software packages. I have been primarily using the high level functions that others have written. The ...
1
vote
0answers
14 views

Measuring effectiveness of marketing through attribution analysis

My data(dataframe in R) looks like this:The data is ordered by CustomerName and then TimeofEvent. ...
0
votes
0answers
9 views

Plotting multiple boxplots in one figure and include dotted line [on hold]

Take for simplicity following two vectors: ...
0
votes
0answers
16 views

Constrained optimization of non linear functions in R [on hold]

My objective is to maximize sales by reallocating my spend under certain constraints. For each key the sales is given by alpha*spend^beta. The total sales is the the sum of sales across all keys and ...
0
votes
2answers
48 views

Comparing datasets from 2 biological replicates

I have two datasets containing experiment data based on two biological replicates. I wonder what the best statistical methods are to find out and test how similar these two datasets are, and also how ...
1
vote
1answer
15 views

P-value from proportional hazards regression object [on hold]

I'm running some proportional hazards regression models using the survival package in r and would like to know how I can access ...
0
votes
0answers
12 views

Robust scoring to rank data

I am trying to develop a score for a dataset to rank (both numeric and categorical features, although I could just use numeric variables only as they are the more consequential ones) and would like to ...
-1
votes
0answers
26 views

Error in imputing data in R [on hold]

**i am imputing my data (all items) using VIMGUI package in R. But in the output section i am getting errors, which i am not able to understand, where the problem lies. The function which i run in R ...
0
votes
0answers
23 views

Zero inflated Poisson distribution [migrated]

Could someone help me in generating zero inflated Poisson data using R? thank you :) ...
0
votes
0answers
14 views

Quantitative or qualitative variable

Suppose I have a response variable $y$ and $p$ explanatory variables $x_1, x_2, \dots,x_p$. Suppose one explanatory variable is the month of the observation. Suppose that the variable "month" is ...
1
vote
0answers
13 views

How to force a division in tree and locate covariates that explain the variable in TraMineR?

my goal here is simple: I have a bunch of sequences, and a few sequences of interest (that do contain a certain subsequence). I want to force that division and use a tree method (either CART or ...
1
vote
1answer
18 views

How to do distance calculation and clustering for event sequences in TraMineR?

I've been using TraMineR for a while now, even though I consider myself a begginer user. The same goes for R language. Yet, I've been able to successfully perform a few optimal matching analysis. Now ...
0
votes
0answers
27 views

I'm in trouble while I'm estimating regression in R [on hold]

I try to estimate robust regression with R. But I am in trouble. I determine all variables. And I estimated regression with OLS (ordinary least square. I can do it. while I doing for robust, I ...
0
votes
0answers
27 views

How to plot the cumulative distribution function of std normal dist/smooth curve, step functions [on hold]

Look for “pnorm” and “pbinom” in help. Use these commands to plot the cumulative distribution function of the standard normal distribution (of parameters 0,1) and of binomial distributions of ...