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

3
votes
2answers
199 views

How fitting a mixture distribution of noncentral Student t components to a one-dimensional sample in R?

I`d like to extract the parameters of a two-component mixture distribution of noncentral student t distributions which first has to be fitted to a one-dimensional sample. My question is closely ...
4
votes
0answers
61 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 ...
0
votes
0answers
5 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 ...
0
votes
2answers
30 views

Can we use weights in lme as a covariable?

This question might be a duplicate, but a colleague and I have trouble understanding previous answers about the use of weights in lme. So in simple terms: We have an experimental design with 2 ...
1
vote
0answers
8 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 ...
1
vote
1answer
38 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
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 ...
6
votes
1answer
72 views

How to include the effect of time into social network analysis

I am trying to construct social network based on co-occurence of individuals. Clustering algorithm will be later applied on this network to find some distinct subgroups. Issue is that studied animal ...
2
votes
0answers
17 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) ...
3
votes
1answer
24 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 ...
5
votes
2answers
1k views

Confidence interval for difference between proportions

I'm wondering if someone could let me know if I have calculated the confidence interval for the difference between two proportions correctly. The sample size is 34, of which 19 are females and 15 are ...
0
votes
0answers
30 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 ...
0
votes
0answers
10 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 ...
1
vote
0answers
15 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 ...
0
votes
1answer
41 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
24 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 ...
0
votes
1answer
118 views

How to obtain p-values for a given Kendall's Tau value (not calculated from data)

I want to obtain p-values for Parker's Tau-U (Parker et al., 2011). which is a measure based on Kendall's Tau. Tau-U is related to Kendall's Tau in such a way that it's possible to translate a Tau-U ...
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 ...
0
votes
1answer
8k views

How to interpret KPSS results?

I'm using R to calculate the KPSS to check the stationarity. The library that I'm using is tseries and the function is kpss.test I have done a simple test using cars (a default matrix on R). The ...
2
votes
1answer
186 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
28 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) ...
0
votes
0answers
17 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 ...
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: ...
0
votes
1answer
266 views

Specifying Dirichlet prior in rjags

I am running the below mixing model using the rjags package in R, but I keep getting the error message ...
1
vote
1answer
93 views

SV model estimation in R using tsbugs

I have been trying to estimate the basic stochastic volatility model using OpenBUGS via R and at an stage of the following command. Please can you comment for the ...
4
votes
3answers
174 views

find the point at which the curve significantly shoots up

so this is getting a little complex for me and hope someone can help me out. I do not have a mathematical background. I have a time series of daily rainfall for 50 years for a particular location. ...
0
votes
0answers
28 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
0answers
17 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 ...
11
votes
8answers
3k views

Pairwise Mahalanobis distance

I need to calculate the sample Mahalanobis distance in R between every pair of observations in a n x p matrix of covariates. I need a solution that is efficient, i.e. only n(n-1)/2 distances are ...
0
votes
1answer
67 views

How do I estimate VECM with weak exogeneity restrictions placed in R?

I am estimating VECM model of electricity demand. I would like to impose weak exogeneity restricitions on the estimation of VECM in R. How do I implement this? Thanks a lot.
4
votes
4answers
3k views

Pairwise Mahalanobis distance in R

I'm trying to calculate a Mahalanobis-type pairwise distance matrix in R. I have 33 individuals, each with 10 variables. The idea is to get a distance matrix D, where ...
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 ...
1
vote
0answers
28 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 ...
1
vote
2answers
42 views

ANOVA with three IVs

I have a following problem: I have some research data that need to be analysed. There are three randomized independent variables (binary) and one dependent variable (reaction time). The data consists ...
1
vote
1answer
29 views
+50

Interpretation of the hazard ratio in a spline model on continuous exposures

I am having trouble interpreting the output from a Cox proportion hazard model with a spline term on a continuous exposure. In the below example (pseudo-code from ...
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
13 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. ...
2
votes
1answer
257 views

Calculating effect size for variables in a multiple regression in R

I've been trying to learn about effect size in relation to linear regression and am wondering how to implement it in R. Sure, I have p-values and they indicate how "predictive" the explanatory ...
0
votes
0answers
9 views
2
votes
2answers
28 views

Hierarchical clustering with agnes - how to cut the tree?

I am working on a data.frame with both categorical and metric variables ...
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
0answers
39 views

Bad results for R's auto.arima

I have a time series for sales data on a weekly and monthly basis. I tried using holt.winter and auto.arima. ...
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 ...
4
votes
3answers
662 views

How to explain how I divided a bimodal distribution based on kernel density estimation

I have a dataset of bimodal population. It contains a smaller peak, which is considered to be "bad", and a bigger peak. I try to separate the bad part of data from the rest of data. What I did was: ...
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
25 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 ...
2
votes
2answers
440 views

Changepoints in R

I have the following dataset: ...
1
vote
1answer
96 views

Which type of residuals to use for the Durbin-Watson test (autocorrelation)

I want to check if there is residual autocorrelation in my model and the test for this is the Durbin-Watson test. I am using R and my question is if it makes a difference which type of residuals one ...