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
Make your voice heard. Take the 2019 Developer Survey now

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
1answer
14 views

how to calculate manually propensity score weights for multinomial treatments where one of them is baseline

I want to get intuition into the calculation of propensity scores (PS) and inverse probability of treatment weights (IPTW) for a multinomial treatment using multinomial regression. One of the ...
0
votes
0answers
7 views

two-sided Mann-Kendall test, interpretation p-values from R:trend package

I would like to perform a two-sided Mann-Kendall Test to check if I have a trend in my data. I understand that I calculate the Mann-Kendall statistic S with And the variance of S Then I calculated ...
1
vote
0answers
22 views

Simple effects in mixed design with R

My experiment consists of two factors, one between and one within subject. Time is the between-subjects factor and hold two levels: (low and high). Times is the within-subject factors and hold three ...
2
votes
1answer
20 views

cant get model info from caret model in R

cant get model info from caret model in R for linear model i can just use the summary function however for this caret ridge model i got strange information this is what i got when i run summary <...
1
vote
2answers
17 views

Which method to choose when comparing non-nested models

I have 2 non-nested models which I would like to compare. Both models are based on the same dataset but use different predictors. Model1 predictor A+B Model2 predictor B+C I know there are multiple ...
0
votes
0answers
7 views

How to model a Fisher progression and a Leeuw's inverted V distributed-lag dynamic model in R?

I've been reading about restricted distributed-lag models, especificcaly about Fisher aritmethic progression (regressor effect fades out in a simple progression: k+1, k, k-1,..,0), Leeuw's inverted V ...
0
votes
0answers
7 views

Classify() returning NaN values - stylo package in R [on hold]

I went to a brief introductory workshop about stylometry earlier today, where I learned about the stylo package in R. It's been really interesting to play with; however, I'm finding that I get NaN ...
0
votes
1answer
10 views

Treatment Vs control analysis with two groups

I have cancer and WT controls samples from two different groups for size comparison. I would like to do some statistics to calculate p-value and perhaps get some plots. I am not very familiar with ...
0
votes
1answer
9 views

Differences between Wald Statistics and P-values obtained with Dummy Coding vs. Direct Coding in Cox Models

Using the larynx dataset (source: Survival Analysis Techniques for Censored and Truncated Data) to illustrate, supposing you want to estimates the hazard rates of event for stages 2 and stages 3 ...
2
votes
0answers
37 views

Models and standard scores

I'd like to use standard scores to describe a variable $y$. If I always measured $y$ in a particular place and time, I'd just take the mean and standard deviation of $y$ and then calculate the ...
0
votes
0answers
13 views

Why I have fewer clusters than I have assigned using semi-supervised k-means?

I am working on class discovery related work in leukaemia and I have some RNA-Seq data. With them, I am using kcca in flexclust ...
1
vote
0answers
17 views

Statistical test to compare polynomial terms between two separate regressions

Let's say I have two OLS specifications with different IVs (R notation): lm(outcome ~ IV_1 + I(IV_1^2)) lm(outcome ~ IV_2 + I(IV_2^2)) I theorize that the ...
0
votes
0answers
8 views

Is this task about soft evidence or just creating of Bayesian Network?

I have a task. We have two sensors that are meant to detect extreme temperature, which occurs 20% of the time. The sensors have identical specifications with a false positive rate of 1% and a false ...
0
votes
0answers
19 views

Find the min (or max) density over a complex function in R with continuous ranges for variables [on hold]

Let's say we have some function of three continuous (or nearly continuous) variables and one factor variable: I would like to: Find the optimal and continuous range-of-values for X1, X2, and X3, in ...
0
votes
0answers
12 views

Is this task about soft evidence or just creating of Bayesian Network?

I have a task. We have two sensors that are meant to detect extreme temperature, which occurs 20% of the time. The sensors have identical specifications with a false positive rate of 1% and a false ...
0
votes
0answers
16 views

Understanding the algorithm behind aregImpute in R::Hmisc

I am dealing with time series data with gaps. I need to capture dominant frequencies in the data, and so have to perform an FFT on the data. However, since FFT requires evenly sampled data; I need to ...
0
votes
0answers
16 views

Comparing statical significance on a line chart

I have a line chart similar to the one below that shows the change in mean values over time for 5 datasets (A, B, C, and D). As you can see the plot includes error bars representing 1 +/- standard ...
0
votes
0answers
12 views

Specifying ANOVA with incomplete block design (R)

I have experimental data of individual sizes (continuous) as a function of two categorical variables (A and B) each with 2 levels (1 and 2), along with a control treatment. Each treatment condition ...
0
votes
0answers
6 views

Metric invariance testing in MIMIC models [on hold]

For a multigroup analysis, I'm testing the metric invariance of a MIMIC model (thus, including both formative and reflective items). I use the argument ...
1
vote
0answers
17 views

Unexpected behavior in inhomogeneous Cross K Function (Kcross.inhom) [on hold]

I am currently analyzing a point pattern in R using the "spatstat" package. I am comparing two different areas, therefore I made two plots for each area (first two plot-left-area1; second two plots-...
2
votes
1answer
62 views

Daily data, R forecasts only yield straight line?

I've tried ets, tbats, and arima - I can't seem to get anything but a straight line out of this. Example I tried: ...
0
votes
0answers
5 views

Large N Large T Unbalanced Panel - Serial Correlation

I have an unbalanced panel data, which consists of 180 vintage groups. The ith group will have time series length of t=181-i. For example, Group 1 will have 180-month observations; Group 2, originated ...
0
votes
0answers
17 views

How can I change the 'baseline hazard function' from its default?

I have implemented a gap time-conditional (aka PWP) recurrent Cox regression model in R. However, rather then baseline hazard function (delta_0(t)) acting as a constant, I would like to incorporate a ...
-2
votes
0answers
12 views

How can plot circular histograme in R using rose.diag function [on hold]

I have this data for wind direction in degree x=c(150,160,160,180,240,240,180,160, 200,180,180,190,230,240,190,210, 200,190,180,220,260,270,240,190, 200,170,190,250,280,220,200,150, 160,140,160,260,...
0
votes
0answers
10 views

Whats is the difference between using risk() and cvrisk() in the R package mboost

I am currently running an additive model using the function gamboost() in the package mboost. When using the ...
0
votes
0answers
12 views

R Mixed-Effect Models for 2-way Repeated Measures Design with more than 2-levels in each factor

Background: I am running an experiment with the following parameters. Design: 2-way Repeated Measures Design (as of right now there are NO between-group/grouping variables Dependent Variable: A ...
0
votes
0answers
9 views

Analysis for 1 observation per group [on hold]

I have a data set that counts the number of times an event occurs at several sites. This count was repeated for 5 years every time a strong storm passed. Each site is unique and each time the count ...
0
votes
0answers
17 views

Change certain values of a vector based on mean and standard deviation of its subsets [migrated]

I am trying to inject anomalies into a dataset, essentially changing certain values, based on a condition. I have a dataset, there are 10 subsets. The condition is that anomalies would be 2.8-3 times ...
0
votes
0answers
18 views

What is scaled in the global sensitivity analysis by Morris?

The Morris method papers (e.g. Campolongo, Cariboni, Saltelli, Environmental Modelling & Software 22, 2007) usually note that the model parametes have to be scaled to [0,1] and later transformed ...
0
votes
0answers
12 views

Remake predictive model from Bagged trees (ipred) to Random Forest (ranger) [on hold]

I need You help in solving a my problem. I have a working Bagged trees model. However, in large areas, the calculation time is very long. Help, please, remake this example for the random forest model ...
0
votes
0answers
20 views

Coding a categorical variable: 0-1 or multiple subcategories?

I'm working with R and want to run a correspondance analysis on a dataset containing, among the others, the following factors: city district: 27 levels, each corresponding to a given district ...
0
votes
0answers
10 views

How to generate samples without replacement using mvrnorm in R? [on hold]

I'm using the mvrnorm function in R to generate positively correlated bivariate data with specified means, variances and correlation coefficient. I'm generating 50,...
-1
votes
0answers
15 views

How can we calculate all models possibilities for a negative binomial mixed model? [on hold]

Our problem here described is to obtain the best model from a GLMM negbin. Our data compose by 2 Categorical variables (Yes/Not), 3 Numerical variables and our random factor, all without any NA. We ...
1
vote
0answers
16 views

Planned contrasts in mixed models

My experiment consists of two factors, one between and one within subject. Time is the between-subjects factor and hold two levels: (low and high). Times is the within-subject factors and hold three ...
0
votes
0answers
11 views

Using waldtest with matrices [on hold]

I have a lot of data so my variables are organized as matrices. I am trying to do the following code and test for H0: b2=b3=0 ...
0
votes
1answer
19 views

R auto.arima with transformed covariates

I have a non-stationary output time-series (oil prices) that is to be forecasted with 20 different input time series. The series are all non-stationary. I am considering two approaches. Approach 1) ...
0
votes
0answers
29 views

Fourier analysis of the orography (terrain) [on hold]

is there any package in R that's commonly used for Fourier analysis of the orography (terrain)? I have the digital elevation model and I'd like to use Fourier transform of the terrain h(x, y) to ...
0
votes
1answer
28 views

r-linear mixed model with the random effect variable be continuous

Suppose there are $N$ subjects under study, with subject $i$ contribution $n_i$ observations, for $i =1,...,N$. And let $y_{ij}$ denote a response variable for subject $i$ at observation $j$. Let $x_{...
0
votes
0answers
16 views

How can I run a classification model with categorical response variables that have - and + signs in R-caret? [on hold]

I would like to run a classification analysis using caret in R. My categorical variables have -/+ signs e.g BB+, BB- and when I run CART,SVM etc i get an error message as shown below: CART fit....
0
votes
1answer
28 views

Is it possible to find Normalized Root Mean Square Error (NRMSE) of Root Mean Square Error (RMSE) in R?

I have code in R that calculates the RMSE from a Linear Regression model: ...
0
votes
1answer
27 views

Constructing 3-way ANOVA when design is not fully factorial

I have conducted an experiment measuring individual sizes as a function of two categorical variables (A and B), each with three levels (1, 2, 3). The combination A3:B3 is a control group. This ...
-1
votes
0answers
17 views

SVM for image classification in Rstudio [on hold]

I am using a code for svm in Rstudio. Few months ago code was running accurately but now it gives errors at every step. I have reinstalled the software but it is ...
0
votes
0answers
11 views

Getting the document-per-topic loading using TextmineR package by passing term co-occurrence matrix

I am using TextmineR package to find the most similar documents to given document list. I used the following code to generate the tcm not dtm ...
0
votes
0answers
11 views

How to combine restricted cubic spline with ordinal logistic regression with package rms in R [on hold]

which function can be used to combine ordinal logistic regression and restricted cubic spline in R
0
votes
0answers
15 views

Interpreting units for random forest variable importance

I've trained a random forest for classification in R's caret package using the ranger method and impurity for measuring variable ...
0
votes
0answers
12 views

Stata 'suest' (seemingly unrelated regressions) in R? [on hold]

Is there a similar command in an R package that makes it possible to use for two probit models? The command systemfit() does not work for objects of ...
0
votes
0answers
13 views

Predicted values in selection model with binary outcome in R

I would like to generate predicted values for a Heckmann selection model with two probit equations (the selection equation as well as the outcome equation have binary dependent variables). According ...
0
votes
0answers
12 views

Homoskedasticity of the residuals

When, I fit an ARMA model to data, I look at the standardized residuals plot to assess if they behaves like uncorrelated random variables with zero mean and costant variance (if the model is good). ...
1
vote
0answers
34 views

Is lmer or glmer appropriate for nested continuous proportion data

I have a reviewer that wants me to analyze my data along the lines: Con_Ratio ~ Range * Latitude * Longitude + (1 | Genotype/Pair). But I'm not sure if this can be done and how. My experimental ...