Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

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`.

0
votes
0answers
9 views

Initializing structural expectation maximization for learning Bayes net structures

I am using bnlearn in R to learn Bayesian network structures. It has a structural.em method for learning with missing data that ...
0
votes
0answers
15 views

How to run a SEM mediation test with common method bias

Say the model I am working with is simply: M <- IV DV <- IV + M All three constructs are obtained using the same survey, hence the common method bias ...
0
votes
1answer
26 views

How to evaluate if year-over-year data is correlated and predictive

I'm working with data that is separated by year and classification and want to test if the data is correlated over each year. Essentially, I want to determine if the data is random each year or one ...
0
votes
0answers
7 views

Multiple Imputation using aregImpute and fit.mult.impute for (1) Chi-square test across groups and (2) Kruskal-Wallis [closed]

I would like to compare parameters across groups in a dataset which I have used multiple imputation (via aregImpute). First, several continuous parameters are such that I would like to use the non-...
1
vote
1answer
18 views

Differences in extreme values of two similar distributions with slightly different means

It is common to use, explore and test differences in attributes between groups. While often people are interested in significant differences and large effect sizes, I was wondering about the effect of ...
2
votes
0answers
37 views

How do I fit a cumulative Gaussian distribution in R? [closed]

I am trying to fit a cumulative Gaussian distribution function to my data, but I'm not sure how to do this. From what I understand, the fitting process tries to find the mean and standard deviation of ...
4
votes
0answers
82 views

Mixed-effects logistic regression

I'm new to data analysis and I'm trying to perform a mixed-effect logistic regression. My data look like this: ...
0
votes
1answer
35 views

Fitting model with unstructured covariance matrix with gls in R

Consider the following dataset: library(nlme) library(lme4) data<-sleepstudy data<-data[data$Days<5,] data$b<-sample(0:1,nrow(data), rep=T) I am ...
0
votes
0answers
17 views

Historical average with exponential smoothing model [duplicate]

This topic similar with this one R Time Series Analysis forecast result always remains same But I perfrom exponential smoothing model in R. ...
1
vote
0answers
16 views

How to tell R the meaning of a numerical variable and plot them? [closed]

I have a large data set in R which I am currently analysing. I'm trying to plot confounding variables and have one which considers the patients household equipment (2=none, 1= stove, 3= charcoal). ...
0
votes
0answers
23 views

Network clustering based on factor scores

I have a clustering problem for the following data (sample from the original): ...
0
votes
0answers
9 views

Error code: “Use of nonzero null hypothesis not implemented for independent samples test” [closed]

I'm working my way through a Coursera Course and could use an explanation of how to do the code for this question: To quantify the magnitude of the differences in mean birth weight, we can use a ...
0
votes
0answers
22 views

fitting distributions to given data [duplicate]

I would like to find the best fitting distribution to a given dataset. ...
1
vote
1answer
25 views

AIC values for auto.arima [closed]

I have a problem with identifying why auto.arima suggest specific coefficients. I have time series with multiple seasonalities and I am trying to forecast future values using STL+ARIMA. I have been ...
0
votes
1answer
34 views

Optimal R function for Predicting Time Series Dataset

Im trying to create a model to predict transactions at a shop. I have the date and hour of the transaction with 4 other predictor variables. I've provided the first 6 rows of the data below: ...
0
votes
0answers
3 views

Pair Correlations in R with mixed types in Data Frames [migrated]

If my data frame has mixed types in it (continuous and categorical), and I want to compute pair correlations using, for instance, pairs in R, is there a way to ...
0
votes
0answers
14 views

Survical model: get time-dependent survival estimates with nested random effect and repeated measurements

In an ecological experiment I have recorded survival of individuals in response to two different food items (treatment). Individuals belong to different families (random term) and are measured at 5 ...
0
votes
1answer
25 views

1:1 nearest neighbor propensity score matching in R (MatchIt package)

I used 1:1 nearest neighbor propensity score matching in R (MatchIt package) to match samples from an experimental group with a control sample. I used the procedure described here: https://pareonline....
0
votes
0answers
29 views

Test for lognormal distribution [on hold]

Do you know how to test, whether a lognormal fit is okay or not - I would like to test in R via statistical tests.. ...
1
vote
1answer
26 views

I want to simulate a random sample of length n from DAG of correlated Bernoulli's

Suppose I have a DAG of 4 vertices. Each vertex consists of a Bernoulli of parameter $p$. It is the following: (Z) ---> (Y) (Z) ---> (W) (X) ---> (Y) ---> (W) I hope it is clear. Anyway, I ...
0
votes
0answers
14 views

Prediction intervals for THieF

I would like to add prediction intervals to a temporal aggregation using the thief package. Can someone point out either how to automatically plot prediction ...
0
votes
0answers
11 views

How to calculate Customer lifetime for each customer from recency,frequency and monetory value in R? [closed]

I have a data that has customer ID,Recency percentile,Frequency percentile and Monetory values. How can I calculate customer lifetime value for each customers in R?
0
votes
0answers
3 views

planned comparisons across a continuous gradient

I am analyzing data on stream community before and after an invasive species removal event and have a dataset of dissimilarity values comparing the stream community at each time point in the dataset ...
0
votes
1answer
26 views

How to model survival panel data in R? [closed]

How do you model panel data in a survival model? I am unsure how to model repeated cases (or id) in coxph, since the common ...
0
votes
1answer
39 views

Using survival analysis in hockey analytics- Period 1 vs Period 2 as Treatment variable

In my article on hockey analytics, I answer how different are the rates of goals, shots, or hits from the NHL regular season to the playoffs (Playoffs are games played by the top 16 teams in the ...
1
vote
1answer
23 views

Distribution of variable importance in r party package [closed]

I have a dataset of 14558 rows and 250 variables. I am trying to solve a classification problem thanks to r party package and the cforest function (which corresponds to a Random Forest). I would like ...
0
votes
0answers
21 views

Sample Size problem: Have done a trial/pilot, but how to proceed? [closed]

I have a problem in calculating sample size. I did do a small pilot experiment, so this is some sample data with the same structure: ...
0
votes
2answers
62 views

I want to create a random sample of length n from a normal multivariate distribution

This may sound like a stupid question, but I have a problem in understanding this question, especially this part: "generate a random sample of length n from a normal multivariate" This is what I ...
0
votes
1answer
47 views

Formula used in confidence intervalle on R's lm function

Does someone know how confidence interval on factor values are computed on R (lm function), here is a simple example : data ...
0
votes
0answers
12 views

Log-rank test returning error code [on hold]

When trying to perform a log-rank test using the Survival package in R I run into the following error: ...
2
votes
1answer
40 views

Is it correct to run a mixed model (2-ways anova) on a unbalanced and incomplete design?

I am studying the effect of land use on biomass. I am struggling to find the right model to correctly analyse my data. Data description I have surveyed land use changes in 20 fields for 3 years. I ...
2
votes
1answer
65 views

Interpreting matrix notation to run MLE in R

I am trying to re-create some indicators from the World Bank, using the methodology described in this paper, and I need to do maximum likelihood estimation, preferably using R. The aim is to get an ...
0
votes
0answers
18 views

Evaluating ecological community over time with NMDS?

I have sampling data of insect communities per month for 7 months. The sampling occurred in the same location with the same methods once a month. I want to be able to see community changes over time ...
0
votes
1answer
21 views

checking normality in repeated ANOVA (residuals vs differences)

If I check for the assumptions of a repeated ANOVA (one IV with 3 measurements) I need to check for the normality of differences. From t-test for paired data I know, I calculate the difference and ...
0
votes
0answers
18 views

how to extract rules from final model made by caret

I have a made cross-validation (k=5) by caret package using C5.0 method. I have 21 features and 7000 instances. The C5.0 trials default is 40. The problem is C5.0 made > 1600 rules over 40 trials, ...
0
votes
0answers
13 views

RTools not working? [migrated]

Can anyone explain what's going wrong here: R.version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 ...
2
votes
2answers
40 views

controlling for clustering at id level in mixed effects model

I have one group ($n=40$) of subjects pre- and post-tested (time; coded $0$ and $1$) on a continuous variable (y). I also have a ...
0
votes
0answers
20 views

Compute posterior expected loss for choosing B over A

The bayesAB package in r computes the posterior expected loss for choosing B over A when running the following commands: ...
0
votes
0answers
10 views

One sample T-test with covariates lmer? [duplicate]

I have 139 subjects (ID), with measurements taken at two time points (Time1, Time2), at 148 brain regions, a dependent measure called volume, and a covariate called thickness. Each subject has 148 ...
-1
votes
0answers
15 views

R code GLM & confusion matrix [duplicate]

I am trying to do a GLM and I get a confusion matrix where not all the data is represented: ...
0
votes
0answers
24 views

Deal with data from spectrometry

I'm trying to predict type of cells (A or B) using data from a spectrometry, here is the shape of data I have : I'm facing the following problems : each value of the spectre is represented by a ...
1
vote
0answers
12 views

Determining nested or crossed random effects in study design

I've found several versions of the canonical example of nested random effects about classes in schools or students in classes.. However, I'm still having a hard time connecting the school/classes/...
1
vote
0answers
16 views

interpretation of treatment effect from linear mix model when Y is log-transformed in longitudinal analysis

In a clinical study, 100 patients are evenly divided into two treatment group, trtA and trtB. For each patient, a biomarker is measured at 5 different visit timepoints. Y is the measured biomarker ...
0
votes
1answer
39 views

Analysis of one group of subjects (data provided)

I have one group ($n = 39$) of subjects pre- and post-tested on a continuous variable. I also have a gender variable coded $0$ and $1$. I was wondering how I can analyze this data so to detect any ...
5
votes
2answers
115 views

Completely different results from lme() and lmer()

I've been playing around with both nlme::lme and lme4::lmer. I fitted a simple random intercepts model using ...
1
vote
0answers
19 views

Which statistical analysis is most appropriate to determine differences between 3 treatments and control for monthly and yearly variation?

I have a 4-year dataset of zooplankton biomass that was sampled three times a summer (i.e. June, July, August) for all four years. There are 6 sites that were sampled in triplicate (took 3 reps): two ...
0
votes
1answer
18 views

What is the difference between Rand Index (RI) and Simple Matching Coeffiecient (SMC) in clustering?

I don't understand the difference between Rand Index (RI) and Simple matching Coefficient (SMC). From the calculation provided in the following page, the calculation looks so similar. RI: https://...
0
votes
0answers
13 views

classification-multivariate analysis+creation of class variable

I am working on a university R project of multivariate analysis and I need some help: DATA: MIXED, with 17 variables : 4 qualitative and the 13 are continuous. PROBLEM: I don't have a class variable, ...
0
votes
1answer
24 views

Logistic regression with coefficients penalized to other numbers

When you penalize logistic regression using l1, l2 or both penalizations, the coefficients are penalized towards 0. I would like to do the same thing but penalizing the coefficients towards other ...
2
votes
1answer
26 views

Books on Bayesian inferential analysis of GARCH models

Do you know books about Bayesian inferential analysis of GARCH models with the analysis of these models in R and JAGS? Here is a list of the books I already have: [Ardia] - Financial Risk Management ...