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

Filter by
Sorted by
Tagged with
1
vote
1answer
34 views

VIF for Categorical Variable with More Than 2 Categories

I'm trying to detect multicollinearity using VIF in both Python and R. Based on my knowledge, the VIF should be less than 10 if there is no multicollinearity. However, for the categorical variable ...
0
votes
1answer
31 views

Best visualization for distributions at multiple time steps

I have a set of discrete observations at multiple time points (~40) all of which are at similar scales i.e., between 0 and 10, and have been trying to determine the best visualization to show the ...
1
vote
0answers
22 views

Multinomial logistic regression on document-topic probabilities with user rating

I am analyzing a dataset of customer reviews with topic modeling and am trying to quantify which topics have a positive/negative influence on the given ratings. I have computed a topic model using LDA ...
0
votes
1answer
20 views

Machine Learning - Training/Validation Sets

I have a very general question that I can't seem to get a straight answer on. Machine Learning - I understand how it works - you have your dataset for which you want to answer either a prediction or ...
1
vote
1answer
11 views

Random forest out of bag, what difference does this make to computing the proximity matrix

In the R documentation for random forest here it says, for the parameter oob.prox: ...
0
votes
1answer
16 views

Current chi-square test of homogeneity POST HOC analyses in R

I am looking for a currently-working method of running a chi-square post hoc test. I've run a chi-square test of homogeneity using chisq.test from stats, however, ...
0
votes
1answer
13 views

r propensity score matching (psm) for the same year [closed]

I am conducting PSM for my study. I used MatchIt package for my PSM. And the result gave me a similar set of control groups, but they control groups were different from the treatment group in terms ...
2
votes
1answer
46 views

Splitting of bimodal distribution, use in regression models

I have a bimodal length-frequency distribution for the females of a species with a one-year life span. This pattern is not observed in the males. I suspect that the bimodality is due to different ...
0
votes
0answers
15 views

Estimate quasi AIC for GAM models in R

I am new to R with little statistical backround. I want to built a GAM model which consists of categorical and continuous variables and cross basis matrices(cb). I use dlnm and mgcv packages. So, I ...
1
vote
2answers
59 views

How do I fit models with predetermined covariates?

I'm trying to fit a multiple linear regression model. It has 10 variables, 2 of which are specified (e.g. $\beta_4 = 0.5$, $\beta_7 = 0.77$). How do I go about fitting this in R? I need to find the ...
2
votes
1answer
30 views

Determining sample size for Structural Equation Model with R

I want to run and experiment to test the validity of a theoretical model. I have the structural and measurement model, but do not have previous data on any of the parameters. Is there a way I can find ...
0
votes
0answers
25 views

Gelman multilevel regression analysis, understanding of formula for partial pooling estimates

I'm looking through Gelmans data analysis using regression and multilevel models and want to know whether I understand the definition on page 253 (12.1) which is as follows $$ \hat{\alpha}_j^{...
1
vote
0answers
10 views

Can we get the specific formulation form of thin plate regression spline in GAM?

In mgcv package, the default smoother is thin plate regression spline. After building a GAM model, can we "write" the formula form of the thin plate regression ...
0
votes
1answer
31 views

compare p-value from two different glm (with the same response variable)

I am currently analyzing the occupancy of bat boxes and the factors that are influencing the occupancy. To determine the most significant variables influencing the occupancy I am running a glm with ...
1
vote
2answers
62 views

What are the exact factors used in smooth.spline by R?

What exactly is optimized mathematically when I use: smooth.spline(x, y, lambda) in terms of the integrated second derivative? Is it $$\min_{f\in C^2} \sum_{i=1}...
0
votes
0answers
4 views

Output R statistics as organized LaTeX table [migrated]

I am looking for a way to output a lot of statistics from several data frames, each consisting of multiple values of the respective statistic test. I think R Brew can do this, however I have not found ...
1
vote
0answers
23 views

Need help: nested fixed effects in nlme()

I have two fixed effects in a nonlinear mixed effect model. One is nested in the other, as the case here: "Specie" is nested in 'category'. ...
0
votes
0answers
25 views

data analysis of categorial dicothomical variables

I have the following dataset I would like to calculate the frequency distribution of the response F or G in each participant, for each condition (MIO,TUO, NEUTRO) for a total of 15 images ...
0
votes
0answers
14 views

Compare beta coefficients from different (transformed) DVs but same predictors

statistics noob here. I have a dataset with 8 predictors (dimensions of brand image) that I regress on 4 different DVs (Differentiation, Relevance, Esteem and Knowledge). One DV at a time. In order ...
1
vote
1answer
26 views

Logistic regression using rms: calculate odds ratio and p-value for specific unit of change

I try to calculate the odds ratios and p-values for continuous and categorical predictors at a specific unit of change (e.g. odds ratio for a change of 10 years, not 1 year) of a multiple logistic ...
0
votes
2answers
122 views

What is the post-hoc power in my experiment? How to calculate this?

The following articles are reprinte of #3375492 of math.stackexchange.com. It was recommended to ask this community at math.stackexchange.com. My motivations I often see the claims that post-hoc ...
2
votes
1answer
87 views

Applying a non-normality and non-homoscedasticity penalty to the p-value of a t-test

【My motivations】:(Add on 05/10/2019 05:23 (JST).) In the traditional textbook, method like following codes are written. (Since our purpose is not to explain what is written in the textbook, the one ...
1
vote
0answers
21 views

Why does the tune.svm() function in R's e1071 package give me different results every time?

It was my understanding that SVMs did not rely upon the initialization of random weights in the way that Neural Networks do, and that therefore, results of running an SVM model would be consistent ...
0
votes
0answers
31 views

How can i choose the best result based on clustering

First of all: Sorry for my English grammer, but i hope you can help me! I have an question after working with the results of the folowing question: Plotting a heatmap given a dendrogram and a ...
0
votes
0answers
12 views

When to run the sphericity test

I'm currently running a repeated-measures ANOVA for my data. Both normality and sphericity have been violated using Machelys test and Shapiro-Wilk. I've removed outliers and log-transformed my data ...
2
votes
1answer
46 views

How to merge multiple one-sample Wilcoxon-tests into single test/model

I have data on the monthly rent of a certain group of people (n = 10 people). We call them people X. These people live in different neighborhoods (very far apart). Furthermore, I have data on the ...
1
vote
1answer
34 views

Fit regression model to the data with 3 dependent variables

I have a dataset that contains different sediment fractions (particle sizes). The column 'Event' consists of unique sample sites. Each sample represents sedimentary material that is sorted by particle ...
0
votes
0answers
9 views

R: extract subset of correlation statistics from larger correlated group

I have a simple x,y,z dataset that is highly correlated by a linear model of x and y, and ...
0
votes
1answer
42 views

Response is count and the first explanatory is binary second is continuous. Which GLM should I use?

So I've got a response variable with count data e.g. number of species found and two explanatory. The first is a treatment I did or did not applied -> Yes or No, so binary. My second explanatory would ...
-1
votes
1answer
36 views

How to fix R (coin) wilcox_test error in this code [closed]

I am trying to compute the Exact Wilcoxon-Mann-Whitney test. The data is not normal, and the amount of data (nrows) is not usually the same. My current approach is obviously not working as it runs for ...
0
votes
0answers
7 views

how to choose variance covariate in GLS?

I learn the gls recently, and confuse about how to choose the variance covariate in variance structure. I use the lm() to fit all the explantory variables(continuous variable), and ncvTest() to find ...
0
votes
0answers
15 views

Failing to recover true parameters in simulations of multinomial logit

I am trying to understand how multinomial logistic regression works. In the first round, I am using the following model representation: $$ P(Y=k|X_1=x_1,X_2=x_2)=\frac{\exp(\beta_{k0}+\beta_{k1}x_2+\...
-2
votes
0answers
23 views

How to plot minimum, maximum, and mean in r [migrated]

I've been reading how to plot points in r, but can't find anything that matches my problem. My data is a matrix; the rows start with a column called 'site' and it is followed by three columns ...
1
vote
0answers
13 views

Understanding how to weight variables

I am trying to model the "recruitment" of a deer population where recruitment is a factor of "females counted in fall" and "fawns counted in fall". e.g femaleFall:fawnsFall = Recruitment. In some ...
0
votes
0answers
12 views

simulation of SARIMA [duplicate]

I'm simulating a Seasonal Autoregressive Integrated Moving Average (SARIMA) model from the R package sarima. But I don't understand which is the extend formulation of the mathematical problem. For ...
2
votes
1answer
49 views

Generating Failure Times

I have 1800 units and I know the probability of failing for each unit every week for 2000 weeks. I would like to obtain some failure times for each unit. One way to do this could be to use a ...
0
votes
0answers
4 views

Error in eval(predvars, data, env): object 'year' not found [migrated]

I do have a question about calculating relative survival compared with observed survival with the package relsurv. Posting a reproductive example: For this, we need the package relsurv ...
3
votes
0answers
39 views

Comparing growth of rates for small time series measurements before and after intervention in R

I have 2 small time series where I calculate success rates before and after intervention. Experiment 1 ...
0
votes
1answer
19 views

Dynamic Outlier Detection in loop with Random Forest regression in R

I'm using randomforest regressor to predict values. I'm trying to make a automatic learning model. My database has let's say 100 rows. So, I train my model with only 10 rows. And one by one I want to ...
0
votes
0answers
37 views

Getting sense from loadings plot of scaled eigenvectors

I wanted to confirm my intution about the meaning of "loadings" I have made out of eigenvalue/eigenvector decomposition, but I still fail to do that. Note that I made 3 pairs of highly correlated ...
5
votes
3answers
456 views

Why is the intercept changing in a logistic regression when all predictors are standardized?

I'm conducting a logistic regression in R using glm. My outcome is race (White = 0, Black = 1). The data are below: ...
0
votes
0answers
15 views

Logic for testing differences in regression beta weights from a multivariate model

I have several questions regarding the logic of comparing difference scores and using a multivariate model as a means of doing this. To start, let’s say I have a multivariate model whereby I am ...
0
votes
0answers
15 views

R BayesFactor calculation not aligned with result from within-subjects ANOVA

I ran a repeated-measures ANOVA in which the interaction effect was almost significant (F=3.96, p=0.053). However, the Bayes factor comparing the interaction and main effects models favors the main ...
0
votes
0answers
27 views

Failing to understand and model market mix modelling

Hello I am have been trying to get my head around marketing mix modeling for last couple of months and have not been able to exactly figure out the nuances of the modelling. I have three years of ...
-1
votes
0answers
16 views

Do we need to normalize data for clustering by kproto (clustMixType)? [closed]

I have two questions: do we need to scale data when using kpro when having mixed data type? I know for sure we need to scale data for kmeans but when I use scale function, it returns some negative ...
0
votes
1answer
14 views

Setting the number of matches in Genetic Matching

I am using the GenMatch function from the Matching R-package to achieve a balance between the covariates in a treatment and control group. The GenMatch function allows to set M, which is according ...
7
votes
3answers
139 views

Why is the intercept in multiple regression changing when including/excluding regressors?

I have a seemingly naive question regarding the interpretation of the intercept in multiple regression. What I found several times is something like this: The constant/intercept is defined as the ...
0
votes
0answers
13 views

Comparing the predictive powers of survival models using Harrell’s C in R

My question is quite concrete. Does anybody know if the approach published in [1] to compare the performance of two models using the Harrell's C or Somers’ D is available in R? I've done a search ...
2
votes
1answer
18 views

R: two way ANOVA and ANCOVA functions return same result: is the code wrong?

I am struggling to find the right code for an analysis of covariance (ANCOVA) that is different from a 2 way anova that includes interactions. Here are the steps I followed: The goal here is to ...
0
votes
0answers
23 views

Improving accuracy in time series forecasting [duplicate]

I am trying to forecast a very typical sales data. I have tried Arima, ETS, Holtwinters and even neural networks but I can't get a model with more than 40% accuracy [Absolute sum of(forecast-Actual)/...