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

2
votes
1answer
52 views

Very large odds ratio (558) in logit regressions

I have been running logit regressions on large samples in order of hundreds of thousands in a preliminary study that will eventually end up in non-parametric tests. Both my dependent variable and my ...
0
votes
0answers
7 views

ordinal variables and caret when preprocessing

I have found that many examples in the APM book by Dr. Max Kuhn tend to cover data sets that have continuous variables as the predictor set. If working with a data set that has ordinal factors, would ...
0
votes
0answers
14 views

Difference between these two R functions [migrated]

I am trying to illustrate the three types of extreme value distributions in $R$. For type one, the distribution function is as follows. $$ G(z) = \exp \left\{ -\exp \left[ ...
0
votes
4answers
62 views

Interpreting high p value and low correlation value

I am trying to run regression on financial data in R. I am new to regression analysis so I am finding it to difficult to interpret certain scenarios. I have the code as follows: ...
3
votes
1answer
58 views

R Deep Learning with H2O vs neuralnet package

I had a fairly open ended question. I've been looking at deep learning architectures for neural networks for classification in R. A few packages came up, neuralnet, ...
2
votes
1answer
80 views

Computing the power of Fisher's exact test in R

Suppose that I have the following 3 x 3 contingency table: ...
1
vote
2answers
37 views

Determine mean from data and variance

I have some data x[i] that differ from the true values by random measurement errors 􏰉cx. Hence one can write x[i] ~ N(mu,cx) My question is: how can I determine ...
1
vote
3answers
39 views

How can I run a t.test in this situation of two processes having binary outcomes

I have two processes, lets call them A and B. I want to infer whether their population means are equal for their experimental outcomes. Both of these processes generate 1s and 0s only. That is, the ...
0
votes
0answers
50 views

How to overcome prediction results that are overestimated

I'm trying to create a prediction model for estimation of continuous variable based on about 35 Independent variables.My data set has circa 27k observartions. Here is the summary of the the targeted ...
0
votes
1answer
7 views

Anomaly classification probability on Machine Learning

I am using features to predict a dataset classification. I have use the Gradient Boosting Classifier of scikit-learn for the prediction and tune it to reduce the error classification. The error ...
1
vote
0answers
21 views

What state-space representation of VARMA is commonly used for fitting

What state-space representation of VARMA is commonly used for fitting? Is Kalman filter + MLE approach used for fitting VARMA model as a common practice? Does the choice of which state-space ...
0
votes
0answers
15 views

Generate survey response data from correlation matrix

I would like to create survey response data if possible from a correlation matrix or factor analysis, or any other way if possible. My end goal is to scale up the samples in my data file and run a ...
0
votes
0answers
34 views

Generalized Linear regression Model in R [closed]

I run the GLM model on insurance dataset, I got the following script at the end of execution. ...
0
votes
1answer
80 views

Logistic regression: class probabilities

I am using logistic regression to solve the classification problem. g = glm(target ~ ., data=trainData, family = binomial("logit")) There are two classes ...
2
votes
2answers
43 views

Output of chisq.test in r

I have a question regarding the below output from a chi-squares test, which I find to be confusing and contrary to my expected results - my chi-squared value is infinity here :) I have two questions ...
0
votes
0answers
26 views

Enterprise Use of SAS & SPSS and Impact of Open Source Platforms (R & Python) [duplicate]

I'm curious to hear from people that use SAS & SPSS why a lot of the Fortune 100/500 enterprises still use SAS & SPSS despite the high cost of the license. Also would love to understand what ...
0
votes
0answers
44 views

R subsetting and factor levels

I was wondering why it is that when subsetting a dataframe, the new frame retains the factor levels of the parent dataframe. For example, consider an arcaheological data set that includes ...
7
votes
2answers
262 views

What are some reasons iteratively reweighted least squares would not converge when used for logistic regression?

I've been using the glm.fit function in R to fit parameters to a logistic regression model. By default, glm.fit uses iteratively reweighted least squares to fit the parameters. What are some reasons ...
3
votes
0answers
26 views

Student classification with Multinomial Logit

I’m analyzing student performance data. In my dataset, each row corresponds to a student and each column contains several performance metrics (continuous) and the student type (categorical, 4 types). ...
2
votes
0answers
30 views

What happens when fixed and random effects overlap?

For example, if your response is the number of ticks on deer, and you sample deer at 10 sites. You include 'site' as a random effect, but you also want to include the density of trees at each site as ...
0
votes
0answers
9 views

function for calculating the mean of a chosen row? [migrated]

This i ask as i am total noob in R I have csv files with data from sensors. i read them into a big data frame I want to get the mean of a column after choosing a,or b column. i do this:(which is ...
0
votes
0answers
16 views

glm function in R uses conditional or unconditional likelihood? [migrated]

I read from Logistic Regression:A Self-Learning Text by Kleinbaum that the parameter estimates of logistic regression is unbiased when conditional likelihood is used and biased when unconditional ...
0
votes
0answers
37 views

Combining p-values from multiple imputed data sets

I have created a set of imputed data sets using 'mice'. The data is longitudinal in nature, with both a longitudinal outcome and survival outcome of interest, and time-varying predictors. I conducted ...
0
votes
0answers
16 views

How can I create a graph in R from a table with four variables? (Likert scale) [migrated]

I have been really struggling to create a bar chart in R, in which I could present responses to questionnaire questions that use a five point Likert scale. Considering that 1-Not familiar; 2- Somewhat ...
0
votes
0answers
13 views

How to evaluate differences in spp richness between two comunities

I am trying to assess if there is a difference between ne number of species between two communities, that share some species. any suggestions??? Maybe a multivariate analysis??
0
votes
0answers
7 views

Exporting R lm model with multiple dependent variables to csv [migrated]

I have the following lm with a vector of dependent variables: ...
0
votes
0answers
9 views

How to write a program to find Hellinger distance in R [migrated]

So, I recently learned about the Hellinger Distance. Now, I wanted to generate a random sample from Poisson distribution using R, and then use this to estimate $\lambda$. Now, generating a sample, and ...
2
votes
1answer
49 views

how to test the significance of a multivariate, multiple regression model as a whole

I have a dataset with seven dependent variables and three independent variables. Now I want to test the significance of a multivariate regression model as a whole. My model looks like this (using ...
0
votes
0answers
10 views

How do I blot out too big p-values in a correlation matrix comparing two different subsets? [migrated]

I'm doing correlation matrixes in R. I love the corrplot package, because of its ease of use and pretty graphics. All the examples on the help page have been done using mirrored rows and columns, but ...
2
votes
1answer
44 views

Manually calculating p-value for t-test: How to avoid values bigger $1$?

These two methods for calculating the p-value should be equivalent: t.test(rats.drug,mu=1.2)$p.value 2*pt((mean(rats.drug)-1.2)*sqrt(n)/sd(rats.drug),df=n-1) The ...
2
votes
1answer
160 views

Why is the difference between these two t-tests so big?

I am using a t-test to find out whether the mean of a sample ($1.05$) with a sample size of $100$ is significantly different from a given mean ($1.2$). The standard deviation should be $0.5$: ...
0
votes
0answers
25 views

teststatistic vs linearstatistic in wilcoxsign_test

In R, wilcoxsign_test in library coin calculates both a "teststatistic" (output as "Z") and a "linearstatistic" (I think this is ...
2
votes
2answers
149 views

Q-Q plot and sample size

To study the quantile-quantile plot, I used the following codes (modified from here). The first group of pictures is derived from 100 data points while the second from 10000. ...
2
votes
1answer
68 views

two-sample KS test: data becomes significantly different after normalization

I'm currently working on a data set with two sets of samples. The csv file of the data could be found here. I would like to use KS test to see if these two sets of samples are from different ...
1
vote
0answers
23 views

In R: Gravity model; how to handle vectorized data from symmetrical matrix?

I have vectorized data from a symmetrical matrix with collaboration data. So the collaboration between country i and country j is the same as between country j and country i. I deleted the principal ...
0
votes
0answers
9 views

Code to create interacting dummy variable [migrated]

I'm very new to R and am trying to interact my dummy variable with an explanatory variable and don't know how to do this. Apologies if I've not formatted this the right way but I'm new to this site as ...
1
vote
1answer
55 views

In what sense is the interpretation of coefficients in a GLMM subject-specific?

There is something I'm not quite understanding conceptually about the output from generalized linear mixed models. I have read that the target of inference in GLMMs is subject-specific. For example, ...
0
votes
0answers
25 views

SNA tools for insurance fraud detection

I’m currently looking at open source solutions to carry out Social Network Analysis on a large (1 Mn) insurance fraud claims dataset. The solution/packages need to have the following functionality: 1 ...
7
votes
1answer
189 views

Fitting a heteroscedastic generalized linear model for binomial responses

I have data from the following experimental design: my observations are counts of the numbers of successes (K) out of corresponding number of trials (...
2
votes
1answer
39 views

How to visualize impact of variables on formula?

I wonder whats the best way to visualize a formula (code for R would be nice, but the question is more general about what to visualize) The formula (a stochastic distribution function) takes two ...
0
votes
0answers
13 views

Create a binning variable in r to roll data up on? [migrated]

I'd like to create a variable that bins values from another variable based on a binwidth The data would look something like this if I wanted to create a bin variable based on counts where: ...
1
vote
1answer
42 views

Can site be used as a factor in a multiple regression model?

I am studying two sites with different fertility and soil texture. In the model I used the data from both sites. I would like to know if could I could use the site as a factor (variable) in the model? ...
2
votes
1answer
93 views

Why is the arima function giving odd answers

I have a problem in interpreting what the arima function in R is doing. I have the following code: ...
5
votes
1answer
157 views

Default lme4 optimizer requires lots of iterations for high-dimensional data

TL;DR: lme4 optimization appears to be linear in the number of model parameters by default, and is way slower than an equivalent ...
0
votes
0answers
9 views

Problem with R Caret J48 [migrated]

My code is below: ...
1
vote
2answers
111 views

Generating random samples with bivariate t-copula

I'm trying to generate a bivariate random sample of the t-copula (using rho = 0.8), without using the "copula" package and its function "rCopula" with method "tCopula". I'm using the following R-code: ...
0
votes
0answers
6 views

Determine if a Model is reasonable through correlation analysis?

I am looking to build a regression model with x as the dependent variable and several independent variables. Can correlation analysis be used as the first step to determine if a reasonable model can ...
0
votes
0answers
25 views

Interaction between continuous predictor and repeated-measures factor in R

How can I test for the presence of an interaction between a categorical repeated-measures factor and a continuous predictor? I'm using R. My data looks like this: ...
0
votes
1answer
37 views

Marginal effects calculation in R: logit model [closed]

How do you calculate marginal effects of parameters of logit model in R uging package {glm}? Are following codes correct? ...
0
votes
1answer
32 views

How to conduct Cox PH stratisified by matched pair in R

I am wanting to calculate hazard ratio in a matched cohort design. For such I am using the coxph() function in R. But I have been recommended to stratify by matched ...