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

1
vote
0answers
17 views

Testing and correctly interpreting the significance of nested random effects

I'm building a series of relatively simple random effects models where we repeatedly measure a water quality variable, say conductivity (cond), in different watersheds (ws) and streams (st). Here, ...
0
votes
0answers
12 views

Checking assumptions of a mixed model

I was wondering how to check the assumptions of a mixed model in R. Suppose I fitted a model with lmer. Is this what I should do? ...
0
votes
0answers
24 views

R: Interpreting mlogit coefficients

Edit: The subset of the dataframe I provided way giving a different error, so I've replaced the pastebin entry with the full data frame. Here's the top of the data frame, then read into mlogit format ...
0
votes
0answers
15 views

ggplot2, change title size [migrated]

I would like to have my main title and axis title have the same font size as the annotated text in my plot. i used theme_get() and found that text size is 12, so I did that in my theme statement - ...
1
vote
1answer
28 views

Using B-splines within a linear mixed-effects model in R

I am using linear mixed-effect model (run with the lme() function in the nlme package in R) that has one fixed effect, one ...
1
vote
1answer
19 views

Why not use always a binomial exact test to compare two proportions instead of chi square?

I am trying to figure out what test I should use in the following scenario: I know that there is a lot of room for improvement in a specific area at work - being extremely critical, let's say that ...
1
vote
0answers
6 views

What is a case where including random correlation parameters decreases the error on the fixed effects?

I'm wondering about the effect of true correlations among random effects on the standard error of my fixed effects in lme4::lmer models in R. My assumption is ...
0
votes
1answer
21 views

How does caret handle factors?

I have been testing conditional trees and random forests with caret, and I've noticed it does something weird with factors. So, for example, a ctree using the base dataset 'chickwts': ...
11
votes
6answers
519 views

When to use simulations?

So this is a very simple and stupid question. However, when I was in school, I paid very little attention to the whole concept of simulations in class and that's left me a little terrified of that ...
0
votes
1answer
36 views

Random effects for within subjects study in R

I have data which consists of subjective ratings. The ratings are done by different judges with each subject being judged under different experimental conditions. Each subject undergoes each ...
0
votes
0answers
7 views

glht on gamm results

I have a GAMM model that has both an LME and a GAM part. I have used glht (multcomp) to check significant differences through the code: ...
2
votes
1answer
38 views

ARIMA predictions constant

I've created an Arima model based on past forex closing prices using auto arima, which has generated a (0,1,0) ARIMA model. ...
0
votes
1answer
25 views

Best prediction model for binary data

I have a large medical data set (100.000+ patients), and have many variables (but selected 20 most interesting ones - 15 of these are binary). I want to make a model that predict if these patients ...
0
votes
0answers
12 views

Can I Use Distance Matrix (Weighted) For GLM Fit (Using R)

I am new to statistics but a business user liking to base my decisions on prediction models. And I am relatively new to regression. I have data in the below format. (I have used only imaginary ...
0
votes
0answers
4 views

what is the relation between significance level and forecasting values

From the past data we estimated the future values in R with default level of significance but my doubt is if we increase or decrease the significance value then how much change will be there in ...
0
votes
1answer
23 views

Conditional Indicator Coefficients: Multiple Linear Regression in R

I'm trying to create a regression model for a set of data that includes time and temperature, among others, for 30 minutes intervals throughout the course of a month. I want to build a model that ...
1
vote
1answer
57 views

Linear regression model mistakenly gives $R^2$ equal to 1

I'm using R to create a linear regression model from survey data about public sentiment for a new technology. I am encountering a problem where the addition of a new explanatory variable raises the ...
0
votes
1answer
20 views

What is the proper way to do vector based linear regression in R

I want to do linear regression between vector inputs and vector output. That is each y is a vector with M components, and each x is a vector with N components and the answer should look like y ~ Ax + ...
0
votes
0answers
26 views

r linear regression mistakenly giving me r2 value of 1 [duplicate]

I'm using R to create a linear regression model from survey data about public sentiment for a new technology. I am encountering a problem where the addition of a new explanatory variable raises the ...
0
votes
1answer
13 views

Test to determine correlation between organism size and concentration?

I have a gamma distribution. I am looking to determine if higher concentrations of a toxin are correlated to larger organism size. I think a non-parametric test would be best, but I'm not sure which ...
0
votes
0answers
6 views

r code/test to determine correlation between organism size and concentration?

I have a gamma distribution. Looking to determine if higher concentrations of a toxin are correlated to larger organism size. I think a non-parametric test would be best, not sure which one. Also ...
0
votes
0answers
5 views

Calculating 2 hourly average of data [migrated]

I have flow data for a year. I want to get the 2 hourly averages of the data and make a timeseries that records the average flow for the two hours along with the timestamp. The data look like this: ...
0
votes
0answers
19 views

Optimizing a time-series with multiple predictors

I have a few questions about turing a univariate time series into a multivariate time series and optimizing the predictors. Here is the univariate data: ...
1
vote
2answers
13 views

credible interval equivalent of confint() for bayesglm() in Gelman et al's 'arm' package?

How do I extract a credible interval ala confint on a glm object when working with the object returned by bayesglm() in arm?
0
votes
0answers
10 views

LCA not returning the same results with the same data

I'm pretty new to Latent class analysis, and I obviously still have a lot to learn. I have a data set with 10 000 observations and 20 variables. I'm trying plot the probabilities of each of my ...
0
votes
0answers
10 views

Why is MeanDecreaseGini over 1 in RandomForest package in R? [duplicate]

I am using R package randomForest, and calculated MeanDecreaseGini as below. ...
0
votes
0answers
2 views

How can I create multiple bar charts at once (in R)? [migrated]

I have a data set that includes Likert-type ratings of a bunch of around 20 measures. In my head I have an image of one long chart with 20 plots showing the distribution for each question. Using ...
1
vote
0answers
16 views

R: Export CrossTable to Latex [migrated]

Is there a way to export a CrossTable (from the gmodels package) to Latex? So if I do : ...
0
votes
0answers
10 views

Forecasting with a trained hidden markov model (using r?) [on hold]

if I have a trainned hidden markov model i.e. the transistion and emission probability matrix are known, how do I make a prediction of let say 2 or 4 time steps ahead? Thanks, Andrew
0
votes
1answer
22 views

Chi Square distribution with degree of freedom 3

For X following a Chi-square distribution with degree of freedom m = 3, I want to compute P(1 < X < 4) Would it be, ...
0
votes
0answers
9 views

r cluster analysis of neurons

I am trying to run a cluster analysis in R to determine which neurons are putative dopamine neurons. I am thinking about using a k means cluster analysis. Is there any cluster analysis that specifies ...
1
vote
0answers
31 views

interpreting PERMANOVA (adonis function) output?

I am trying to look at expression of some genes and relate the dist matrix (Sm) to a number of different factors that I collected on the individuals (e.g., litter size, licking behavior, group housing ...
0
votes
0answers
10 views

Fieller's Theorem Equation computation with R programming [on hold]

Given that this is a fairly common used theorem, I am hoping someone has already used the R programming Language and console to work with this equation. Having a limited understanding of the ...
0
votes
1answer
11 views

R glmnet - appropriate link function for log-loss

I have a 2 class classification problem that I'm trying to optimize the log-loss for (not ROC/AUC). I'm using the glmnet package in ...
0
votes
0answers
20 views

Coverage probability Poisson - R [on hold]

I am trying to figure out in R a graph that displays the coverage probability of the confidence intervals for a parameter of a Poisson. I am taking as benchmark paper Brown, Cai & Dasgupta (2003) ...
2
votes
2answers
15 views

How to interpret p-values in output of seqecmpgroup()?

The seqecmpgroup() function returns a table that, among other things, include p-values for each identified subsequence. How should these be interpreted? I can see ...
1
vote
0answers
29 views

Model formulation of mixed models: from R (nlme and gamm) syntax to mathematical

I have finalized two types of models, a linear mixed effects model and a generalized additive model for my data set. I have read and understood how it works and how to choose which model would be the ...
-1
votes
0answers
12 views

Quality measure k-means implementation in R [on hold]

I used a couple of methods to find the optimal number of clusters in k-means. From some research I found that people quite often use quality measures to deal with this problem. As I'm working with ...
0
votes
0answers
10 views

MINST Image Classifier in R: NaNs produced

I'm teaching myself to do image classification in R. I came across a great bit of code that employs K-Means and SVM to perform image classification (the code is available on GitHub) Feature ...
0
votes
0answers
5 views

R power analysis pwr.f2.test

I'd like to run a power analysis for a repeated measures within-subject design. Most relevant is a 4 x 3 interaction. Can I use pwr.f2.test of the pwr package for the power analysis of this repeated ...
1
vote
1answer
56 views

Plot regression with interaction in R

I did a regression analysis with the following variables: Predictor = dummy variable, dependent Variable = metric, moderator variable = metric. I now want to show my results in a figure. The ...
0
votes
0answers
31 views

Can a Naive Bayes Model predict using pattern alone?

Say I have a set of data abc-def-ghi jkl-mno-pqr stu-vwx-yza and lots of other training samples which are catagorized as **names*. The above dataset does not have ...
0
votes
0answers
39 views

Transpose matrix [migrated]

I have a csv file with two colums transid and item. It has the following values ...
1
vote
1answer
24 views

simulating a multiple comparisons problem using R and bonferroni correction

I am actually working on an exercise for my students dealing with multiple comparisons. However, I was having trouble trying to simulate some data in R to demonstrate the problem with multiple ...
1
vote
0answers
24 views

Subject-specific graphics for repeated-measure design

I am doing linear mixed effect modelling testing the effect of treatment on pitch, with ...
0
votes
0answers
14 views
+50

Can the rcorrp.cens paired concordance test be done taking into account strata?

Followup to these discussions: Bootstrapping Hmisc::rcorrp.cens for paired concordance? Stratified concordance index (survival::survConcordance) Is there a way to perform a stratified paired ...
1
vote
1answer
24 views

sample size of Anderson-Darling test

Why sample size of Anderson-Darling test for normality must be greater than 7? It is designed as above way in ad.test function of some packages in R. I want to test 5 samples data in normality test, ...
0
votes
1answer
20 views

Deep Learning Predictions Seem Off

I'm doing a linear regression using the h2o deep learning interface with R. I'm comparing the predictions to the ones I'm getting from the randomForest R module. The predictions from randomForest ...
0
votes
0answers
27 views

How do you fit a group level regression for a multilevel model using the lme4 package in R?

How do you fit a multilevel regression model in R where you want to include a group-level regression? I think that the answer is using STAN, but I've been trying to use lmer() from the lme4 package. ...
1
vote
0answers
93 views
+50

Obtaining adjusted proportions with lme4, using the glmer-function

I aim to estimate the annual proportion of patients (% of patients) that are smokers in a population whose age and sex must be taken into account. In other words, I want to calculate the adjusted ...