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

Fixed effect regression time and individual effects

I have a question about including both time based and individual fixed effects. (I am using within fixed effects.) They are both significant individually when I run an F-test on a basic OLS regression ...
0
votes
1answer
38 views

How to draw the estimated power curve of a test?

The estimated power of a given test can be reported with a table or with a curve in a plot. I need to compare the power of two permutation tests by simulation and I was wondering how to create a ...
0
votes
0answers
5 views

replace values in one dataset with values in another dataset R [migrated]

I have a somewhat seemingly simple problem that I am stumped with. I have a df, say: x y z 0 1 2 3 5 4 1 0 5 0 5 0 and another: ...
0
votes
0answers
22 views

confidence intervals for mixed effects models with small sample size

I have several datasets, all of which have a nested structure. However, the number of groups is quite small (varies from 10-50) and the number of observations per group varies between 1-10, but most ...
0
votes
0answers
10 views

R forecast - How to plot only subset? [migrated]

I'm fitting a model with the R forecast package like this: fit <- auto.arima(df) plot(forecast(fit,h=200)) Which prints the original data frame plus ...
0
votes
0answers
27 views
+50

Interpretation of partial dependence plots for multinomial GBM

I've been a big fan of the gbm package for some time, but am having difficulty understanding the output from the partial dependence plots in the case for multinomial classification problems. Below ...
-1
votes
0answers
17 views

how to do a cluster ensemble in R?

I have a dataset containing numerical and categorical variables. I want to cluster this. In order to do that i have seperated the categorical data and numeric data and built k-modes and k-means ...
0
votes
0answers
16 views

Markov chain with quota based 'immigration'

I am trying to simulate a KPI for my work, and while markov chains were covered briefly in the courses I attended for stats, I've never actually needed to use one until now. The difficulty I have is ...
0
votes
3answers
30 views

How to perform grid search effectively for tuning SVM parameters in cross validation?

I have C and gamma parameters for RBF kernel to perform SVM classification through cross validation in R software. How to fix values for grid search to tune C and gamma parameters? For example I took ...
0
votes
0answers
15 views

Unequal variance and crossed random effects in linear mixed effects model

I'm analyzing an experiment that has 50 subjects and 50 items. Each item can occur in two possible conditions. Every experimental subject produces a (continuous) response to every item, but only once ...
0
votes
1answer
26 views

Cluster selection and formula in (longitudinal) GEE models

I have a question according the "formula interface" from GEE models, for instance when using the gee function from the R gee package. Let's say I have a measured ...
1
vote
0answers
61 views

Mixed model with crossed effects and repeated measures - what is correct ‘maximal model’ for use in lmer/lme4? [R]

Objective I have a crossed and implicitly nested design and am trying to validate the correct ‘maximal’ model (including all linear and pairwise interactions of the variables) for use in ...
2
votes
1answer
34 views

How to analyze multiple treatments and measurements?

I've been asked to analyze data from an experiment measuring blood hormone levels from rats after a surgery. Hormone measurements were taken 10 days after surgery and 20 days after surgery. To make it ...
0
votes
0answers
19 views

R H2O Telco Churn Prediction Expected Error Rates (Precision and Recall)

I have a simple question, I'll try to formulate it as simple as I can. I am modeling a churn predictor for a telco company. I am using H2O with R, and have run some tests. My data set is the whole ...
1
vote
1answer
15 views

Combine multiple predictions of binary outcome

I am moving from a single-model prediction of a binary outcome to an aggregate of a small number of models, for example: ...
0
votes
1answer
42 views

Applying an Arima model with exogenous variables to new data for forecasting [closed]

I have been working with the forecast package in R a lot, recently. And my question might seem trivial (or not, maybe I'm missing something), but for the life of me I can't seem to find a way to fit ...
1
vote
0answers
15 views

Estimating the battery capacity using current power consumption and battery percentage

I want to estimate the current maximum capacity (in kWh) having the current power consumption (in kWh) and the state of charge of the battery (in %) available in a time series. I do not have a full ...
0
votes
0answers
10 views

Calculate the non centrality parameter (ncp) for non central gamma distribution

How can I calculate the non centrality parameter (ncp) for non central gamma distribution, if I know the α and β parameter, and also the 0.975 quantile value ? How to do it in R ?
0
votes
0answers
35 views

Square error - interpretation [closed]

I have some simple data - people who smoke vs those who do not. I am trying to compare lifetimes. I have a script to generate density plots to compare age of death from smokers and nonsmokers: ...
1
vote
1answer
29 views

Mutual info via binning gives non-zero results for independent variables

I'm trying to calculate mutual information in Python, using numpy. My implementation so far is: ...
1
vote
1answer
63 views

Predict time of next purchase

I'm trying to build a model in R that will let me predict when a costumer will purchase a product again. For example, the training data list customers who purchased bikes. I want to predict when ...
0
votes
0answers
16 views

Partial Least Square regression in mixed models?

As a graduate student, I am glad to have so many cool things online to teach myself. To learn about PLS, I liked the materials provided G. Sanchez (e.g., ...
1
vote
0answers
42 views

Data Imputation with Amelia on large dataset: Taking very long time [closed]

I have 761,592 obs for 31 variables on users behaviours towards online ads. Out of 31 variables, 28 are categorical. Many cat. variables have more than 10 categories. I am using Amelia for missing ...
0
votes
0answers
3 views

How to plot a function involving summation and logs in R [migrated]

How to plot in R the following function $l(\theta) = ln(\theta)*\sum{y_i} -n*\theta -n*ln(1-e^{-\theta})-\sum{ln(y_i!)}$ where the summations are from $i=1$ to $n$ I have the data set, but I know ...
0
votes
0answers
9 views

R: Can I include random effects in Firth's penalized-likelhood regression?

I have the problem of (quasi-)complete separation in a dataset with N=500 but only 25 positive outcomes (response = binomial). Including a lot of categorical factors in my model, I face the problem of ...
0
votes
0answers
18 views

Finding cluster overlapping

I've a set of locations and I've clustered them thrice on the basis of some different parameters, now I want to find overlapping of the clusters obtained. So basically the dataset now contains list of ...
0
votes
0answers
15 views

Interpret C5.0 rules

According C5.0 documentation (https://www.rulequest.com/see5-unix.html#CASEWEIGHT) sample weights should not be a part of model and they should be used only during training. The case weight ...
0
votes
0answers
3 views

How to find the difference between a value and its closet value in a vector in R? [migrated]

I have a vector like below: x= c(1,23,4,15,8,17,21) after sort values in vector we have: c(1,4,8,15,17,21,23) my required ...
0
votes
0answers
31 views

Boruta feature selection with R

I have a concern :/, I used Boruta algorithm in R on a data set of ~600 attributes and with a sample of 50K (the original size is 300K). Using the following parametres: pValue = 0.05 getImp = ...
1
vote
1answer
32 views

raising the probability of correct answers of nextItem (catR)

Using the catR package I am trying to create a nextItem call that respondents would answer correctly about 65% of the time (even if that means the method is not as efficient as it could be). Children ...
0
votes
0answers
15 views

Dirichlet multivariable regression with temporal autocorrelation?

BACKGROUND: I have some animal behaviour data. The time allocated by a group of animals to different behaviours per minute was recorded repeatedly until the end of the experiment. Therefore, I have ...
0
votes
1answer
43 views

PACF and ACF on trend with random component

I am really confused when reading PACF and ACF plots on a small example dataset I created. I created a vector containing a linear trend (1:100) and added normally distributed numbers to it to include ...
3
votes
2answers
39 views

Why is SEM/CFA failing to find the correct factors in this simple set up? Possible error in 'predict'?

I've been getting very odd factors in more complex models and simplify to this minimal case that behaves oddly vs my intuition. Suppose we have the generative model, where everything is IID Normal ...
0
votes
0answers
35 views

Fit quantile regression

I have like 30k rows in training set and 60k in test set. Distribution of dependent variable (ascending order) looks like this: I believe I must use quantile regression here, as OLS regressions fit ...
1
vote
0answers
24 views

grouping attributes in RF and GBM

i have a dataset with 1000 samples and ~11k features (SNP markers). i have identified 100 additional binary features describing the markers themselves so i have a ...
3
votes
0answers
35 views

Difference between hierarchical Bayes and random parameter/effects models?

From my limited understanding, the difference is mainly that hierarchical Bayes (HB) incorporates parameter distribution priors that will "constrain" the individual parameters to one side of the ...
0
votes
0answers
4 views

Unexpected results with non-parametric multiple comparison of means (R package nparcomp functions nparcomp and mtcp) [migrated]

I am currently trying to perform a non-parametric simultaneous relative contrast effects using the R package nparcomp (https://cran.r-project.org/web/packages/nparcomp/index.html). I am getting some ...
0
votes
0answers
25 views

help with computing standard score for scarce discretely quantized data

I'm not a stats major and I'd appreciate any help I can get. I've got data with each point defined by a score (between 0-1) and a frequency (0-100%). At 100%, the score is most reliable, at 1% the ...
0
votes
0answers
10 views

J48 partykit access flat list [migrated]

I would like to access individual nodes in the flat list representation of the party object. That is, I would like to get a node, its split and kids and any other ...
1
vote
2answers
94 views

R-squared and fit of the model

This post is new version of my last question. It was deleted due to my error in data. Currently data updated and verified. I have 2 models. Model 1 gives me: ...
1
vote
1answer
53 views

Interpretation of DCC-GARCH output

I have done fitted a DCC-GARCH model using the dccfit function from the "rmgarch" package in R. The output is below: ...
0
votes
0answers
19 views

R C5.0 tree model to list conversion

I am using the C5.0 decision tree in R from the C50 package. The training function C5.0 returns a list which also contains a "tree" element which is basically a text representation of the tree. I am ...
1
vote
1answer
21 views

Design matrix with intersec 0 or 1

I am constructing a model matrix for a repeated meassurments experiment with three individuals per group and three treatments per individual. ...
0
votes
2answers
42 views

Output of linear model in R [closed]

I am learning R for statistical analysis. Earlier, also I've fitted some linear models and they worked well. But this time I am getting a weird problem. For data set in file "Auto.csv", I am trying to ...
0
votes
0answers
24 views

How to analyze repeated measurements with categorical/ordered outcomes

I have the following dataset: 100 indiviuals (id) Each individual with 4 measurements at 4 timepoints time1,time2,time3 and time4 Outcome is a categorical or ordered variable 1,2,3,4. I simulated ...
0
votes
0answers
15 views

Is there a function that can execute a character string? [migrated]

I wonder if there is a function in R that like this. For example, the function is f. Similar with calculating the mean of vector ...
0
votes
0answers
41 views

How to do feature engineering?

Suppose I know nothing about the variables in this sample data set except that y is the response variable: ...
0
votes
0answers
24 views

Understanding random effects lme4 model

I'm trying to understand mixed effects models in R. I have 2 questions: What is the difference between the models m=lmer(y ~ 1 + x + (1+x|g), data=r.data) and ...
1
vote
1answer
56 views

Linear regression on data with multiple levels?

Here is a table with values that depend on two variables (VAR1=column names, VAR2=rownames). ...
1
vote
0answers
20 views

Aggregating estimates for weekly data

I have a data set (in R) measuring the performance of all machines in a factory at the end of one week. Each machine has various metrics captured (feature vector) and the ppm defects (predicted ...