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

Calculating PLV (phase locked value) using ifreq function in seewave package in R

I am trying to calculate the PLV (phase locking value) using the seewave package in R. My code for calculating the PLV looks like this: ...
0
votes
1answer
14 views

Linear model decomposition

Is is possible to decompose fitted linear model? What I mean by that: I have parameters of fitted linear model as following: y=2.3a-1.23b+1.65c+1.76d Now I have ...
0
votes
0answers
8 views

Model averaging with MuMIn. What's the mean of pvalue?

the summary() of a model.avg made with MuMIn in R, give a lot of interesting results, in particular model averaged coefficients (estimate, standard error, adjusted standard error and a z value with a ...
1
vote
0answers
19 views

Regression model for predicting life expectancy

I have average life expectancy at birth data for an 8 year period and I would like to use that 8 year period to predict the trend for average life expectancy for the next 5 years. I would then like to ...
0
votes
0answers
10 views

sequential importance sampling step by step

I'm experiencing some problems when learning particle filtering (without resampling). I've found examples where the bootstrap filter has been used but none using the sequential importance sampling. ...
0
votes
0answers
17 views

Grouping similar plots together in a Stripchart [migrated]

I have groups of data that I want to put more closely together on my strip charts ...
0
votes
0answers
11 views

interpreting y axis of a partial dependence plots

I have read through other topics on partial dependence plots and most of them are on how you actually plot them with different packages, not how you can accurately interpret them, So: I have been ...
0
votes
0answers
10 views

Standard errors of estimates in multi factorial LMEM

This question may already be well-answered as it seems relatively straight forward, but my search of existing posts has failed... apologies if it is redundant. I am building a linear mixed effects ...
0
votes
0answers
18 views

(binary) Matrix completion with less known data

Recently, I meet such problems, I call it matrix completion problem. For example, the row denotes the users and the column denotes items. And If one user like the ...
0
votes
0answers
5 views

Simulation of CI of amount of values in different intervals by adding noise to original data

I am having a hard time trying to solve this problem, so maybe some of you guys can sort it out. I have a large data set containing a value describing the thermal comfort in buildings called PMV. The ...
0
votes
0answers
6 views

Ggplot gives “arguments imply differing number of rows” error in geom_point while it isn't true - how to debug? [migrated]

I have two objects of type Large SpatialPointsDataFrame named st2 and st10. They come from the same source. They both plot without problems with: plot(st2) or ...
0
votes
0answers
14 views

Strange behaviour of list in R [migrated]

I ran on a very strange behaviour. I am trying to evaluate a rather long list (Generated code). ...
0
votes
0answers
4 views

Passing a function with parameters as an argument to another function in R [migrated]

Consider an example: I want to pass a function with or without parameters to another function and use it in the following way: ...
0
votes
0answers
5 views

error for xreg and newxreg matrix size in an arima model

I am using auto.arima to forecast a daily data and used holiday and weekday dummies as regressors. I am getting an error which does not make sense. When I want to predict a 7 step ahead forecast, it ...
1
vote
0answers
27 views

Why only full ARIMA models in auto.arima?

It seems that the auto.arima() function in the forecast package in R only considers full ...
0
votes
0answers
16 views

Some doubts about using time random effect

I'm starting with lme4 and GLMM. Maybe this question can be basic for experimented researchers, but I'm still learning. I have a pooled data where every ...
0
votes
0answers
16 views

Error “initial value in 'vmmin' is not finite” when changing factors in ordinal logistic regression [migrated]

I've generated some fake data to give a simple example of ordinal logistic regression. My data set (raw data here) looks like this: ...
2
votes
0answers
9 views

Repeated measures - sum of biomassproduction

I am student in biology. For my examination I conducted a greenhouse experiment with gras. Actually I am not sure how to develop the correct model and unfortunately I haven't found an answer in the ...
1
vote
0answers
18 views

Predicting values using linear regression

I am very new to statistical analysis and R. Recently I worked on a simple linear regression model to predict values. For example: consider the below data set ...
0
votes
1answer
23 views

What is the meaning of the R factanal output?

What does all this mean? I'm a factor analysis 'noob' and although I've read a book, it didn't tell me everything apparently. Since the chi square statistic is so high and the p-value so low, it ...
3
votes
1answer
32 views

Is there a way to add inequality constraints on the LASSO in R?

I am trying to use LASSO for model selection, but I need my fitted values to remain non-negative. Is there a way to implement this simply in R? I've found that the penalized package allows for non ...
4
votes
1answer
52 views

Given a chi-squared distribution, find $\Pr(\mu-2\sigma \leq Y \leq \mu + 2\sigma)$

Given a chi-squared distribution of df = 8, which R command do I use in order to find $\Pr(\mu-2\sigma \leq Y \leq \mu + 2\sigma)$? That is, the probability that $Y$ lies within 2 standard deviations ...
0
votes
0answers
14 views

How to define samples in caret package?

I am using the caret package and need to train a random forest, where only certain samples should be in the held-out set. I want to define the sampling for each tree in the random forest, for say 100 ...
0
votes
0answers
27 views

Need help setting up multilevel logistic regression

I am trying to see the effect of a certain intervention in schools. The outcome variable is binary. We have students within schools. Also students' age is a covariate (doesn't changed before and after ...
2
votes
2answers
85 views

Which is correct way for regression line?

I have a set of data (some Frequencies per month, Var1 is the month): ...
0
votes
0answers
15 views

What does the intercept correspond in the Anova() function in R?

I've been struggling to understand what the intercept sums of squares and p-value correspond to when I run a one-way ANOVA with Type "III" sums of squares using the Anova() function in the car ...
1
vote
1answer
47 views

Interpreting a linear mixed effect model's interaction term

I am a biologist and am attempting to analyze the effects of time and location on depth. I was told I needed to use a mixed effects model to account for the random variables of Individual and tracking ...
1
vote
0answers
19 views

Fitting a model to data for prediction - best choice for data

I have some data I need to fit a model to that can be used for prediction (interpolation). The data is summarized by the plot below. The black line is x=y. I want to be able to fit a model so as I ...
0
votes
0answers
8 views

How to properly renderDataTable in Shiny when theres is whitespace in the column headers [migrated]

I am rendering a DataTable from a data.frame to which I've given names like "Agent Name" for readability's sake. When I deply a shiny app to view this data as a DataTable, the whitespace in the column ...
2
votes
0answers
37 views

Looking for and dealing with collinearity in a GLM

I've got this dataset with one continuous dependent variable and two categorical explanatory variables. I'm wanting to run glms on the data but I'm finding problems with what I think is collinearity. ...
0
votes
1answer
10 views

Multivariate Regression on Multicollinear Categorical Variables

I am working on a dataset with a continuous response (which could be dichotomized), one continuous covariate, and multiple categorical variables. The continuous covariate (weight) is directly ...
0
votes
1answer
20 views

How to cluster data with repeated measurements?

Most clustering algorithms assume that data points in each row are independent. I have some data with repeated measurements from individuals. I can use a standard algorithm, and then check to see if ...
1
vote
1answer
31 views

Glmnet Caret Package with small number of observations

I have a regression problem where I’m attempting to train a data set with 70 predictors, but only 35 observations with glmnet in the caret package. I’m trying to determine the best resampling method. ...
1
vote
1answer
41 views

Removing collinear variables for LDA/QDA in R

I'm new to R and I've been searching for a while for a function which can reduce the number of explanatory variables in my lda function (linear discriminant analysis). Basically, I've loaded the ...
4
votes
1answer
213 views

Why does this logistic GAM fit so poorly?

I am trying to create a logistic regression model with mgcv::gam with what I think is a simple decision boundary, but the model I build performs very poorly. A local regression model built using ...
0
votes
2answers
49 views

Density plot narrow peaks and mean far away from peaks

I am trying to understand a density plot. It has narrow peaks and means are far away from the peaks. What would be the reason for such behavior? Should I be doing a different plot to understand this ...
0
votes
0answers
23 views

non-parametric tests with significant difference in sample sizes

I have outcomes from a biological expt., where we have measured DNA lengths that has been affected. For condition1, I have 11 observations (length of DNA) and for condition2 I have approx. 116000. I ...
3
votes
1answer
41 views

Multivariate hypergeometric distribution in R

Say I have a bag of colored marbles. This bag contains 30 marbles, 2 of which are red, 3 are green and the rest are blue. I am now randomly drawing 5 marbles out of this bag, without replacement. I ...
0
votes
0answers
13 views

Comparison of two correlation matrix of same dimension in R [duplicate]

I have two correlation matrices(Pearson).For example, metrices of (3 gene X 3 gene) for cancer samples and normal samples,individually. I have got gene-gene correlation for both sample. Now I want to ...
0
votes
1answer
27 views

Count the number of each unique row in a data frame? [on hold]

Suppose I have a data frame such like: ...
2
votes
0answers
8 views

Why does glmnet in caret give different predictions for different alphas even though lambda is zero?

In R, when using caret to train an elastic net regularization model, I find that different values of alpha give different predictions when the lambda parameter equals zero. This should not be the ...
3
votes
0answers
24 views

Solving non-linear equations in R with optimal inital values

I am using the rootSolve package in R to estimate parameters of non-linear equations. The basic formula is ...
-2
votes
0answers
33 views

why cannot we find an arima model for the daily forecast of a dataset with more than 2 years of historical data?

I faced this problem a few times. I used TBATS to fit a model to the daily forecast of a variable and then wanted to include other regressors to my forecast. So I used auto.arima. all of my databases ...
0
votes
0answers
8 views

Select the cases from a data.frame that have been used in a GLMM [migrated]

I am trying to see differences in the feeding-rate of one bird species between big forest patches and small ones. I have several forest patches of both sizes, and three years of study. Some ...
0
votes
0answers
22 views

How to solve hat check problem using R? [on hold]

Suppose n people go to a fancy restaurant. Each person is wearing a hat and checks his/her hat at the door as he/she arrives. The hat-check attendant gets tipsy throughout the evening, forgetting ...
0
votes
0answers
52 views

Using MySQL or r, or both? [migrated]

I have a large dataset and I want to do statistical analysis on certain subsets of the data. At the moment I see this as a two step procedure: Import data into a MySQL database and use the world ...
0
votes
1answer
34 views

sum of correlated random sample

Suppose I have 1000 draws each of two random variables X and Y. If I wanted to sample the sum of these variables, I would simply calculate 1000 samples, i.e. $$ S_{i}=X_{i}+Y_{i}, i=1,2,…,1000 $$ ...
2
votes
0answers
37 views

Imputation of missing values for doing PCA in R [duplicate]

I have a dataset with approximately 4000 rows and 150 columns. I want to predict the values of a single column (= target). The data is on cities (demography, social, economic, ... indicators). A lot ...
1
vote
0answers
30 views

multiplicative model in r

I have to estimate a model forecasting the sales (as stock units) for AXE deoderants.I want to apply the multiplier specification on this model. The model should look like this: log(Sales) = b0 + ...
0
votes
0answers
25 views

Trying to understand the basics of a mixed-effects logistic regression model for a 10-step continuum

I am trying understand how to correctly build a mixed-effects logistic regression model in R. I believe my model is pretty simple and straight forward but I'm lacking in experience and uncertain I'm ...