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
0
votes
0answers
5 views

Converting a Continuous Response Variable into a Categorical Variable

I have the following question: Are there any Standard Methods for Converting a Continuous Response Variable into a Categorical Variable? To give my question some context, I give the following example (...
0
votes
0answers
15 views

Data with Hierarchical Structure and Multicollinearity (E.g. ZIP Postal Codes)

I always had the following question: Can data having "naturally occurring hierarchical structure" be transformed to better make use of this hierarchical structure at different levels? To ...
0
votes
0answers
8 views

How to calculate the joint and conditional probability of multi-varivale after getting the PDF based on the RVinePDF() of vinecopula package in R? [closed]

Assuming that I want to get the joint probability of P(X<0.3,Y<0.1,Z<0.2), u1, u2,u3 are the marginal distribution of X,Y and Z, respectively. Here are my codes: ...
0
votes
0answers
11 views

Power analysis for correlations, controlling for multiple comparisons

I want to estimate number of participants required for an experiment. I will be conducting 28 correlation tests. I am seeking 80% power for an effect size of 0.15 and alpha of 0.05 (all two-tailed). ...
0
votes
0answers
9 views

In R, how to model one level of a factor with another level of the same factor using lm() on a tidydata frame [migrated]

I'm working on the publicly available dataset 'FEV.dat' on this page (raw data here) and am trying to fit a linear model. I can do this without issue when the data is in wide format, but once I put it ...
0
votes
1answer
10 views

How to extract FSAs from postal codes when there is no match?

I would like to extract Canadian FSAs from unstrucured data. I want to pull only the first instance of each match. The problem: Some data don't include postal code and my function won't produce the ...
0
votes
0answers
10 views

How to fit general multivariate linear regression model (aka general linear model) for longitudinal data in R?

Let's consider a longitudinal data. Let $Y_{i}$ be the vector of $n$ repeated measurements for the $i$ th subject : $$ \boldsymbol{Y}_{i}=\left(Y_{i 1}, Y_{i 2}, \ldots ,Y_{i n}\right)^{\prime} $$ And ...
15
votes
7answers
1k views

Why are Hypothesis Tests still used when we have the Bootstrap and Central Limit Theorem?

I have the following question: Why are Hypothesis Tests still used when we have the Bootstrap and Central Limit Theorem? To give context to my question, I briefly go over the Central Limit Theorem and ...
0
votes
0answers
27 views

Fit distribution to partially-observed data with covariates

Here is a question that has burnt my brain lately. I do not have a strong mathematical background so perhaps the solution is relatively easy. Imagine we have partially-observed distance data between a ...
0
votes
1answer
25 views

Cohort Regression Models vs Individual Regression Models

I have always had the following question: Were regression models originally designed and intended to be used for predictions/inference only at the "cohort level" (i.e. for large groups of ...
0
votes
0answers
18 views

Appropriate test for independence of predictor variables in logistic regression

I want to test for independence between 7 categorical predictor variables in a logistic regression model. I believe the appropriate test would be a chi-square test, but I have 7 variables - is there a ...
0
votes
0answers
8 views
0
votes
0answers
22 views

calculate correlation of broken time series

Is it statistically correct to calculate correlations between two broken time series? For example, ...
0
votes
0answers
9 views

Removing NAs in logistic regression model [closed]

I have a data set that contains lots of NA values. If I use the na.action = na.omit argument, will this delete everything except row #2 (based on table below) OR does it result in retention of rows ...
0
votes
0answers
20 views

Mclust and factorial data: R [migrated]

I'm trying to do some clustering with R and I need some help: The first step was a factorial analysis of percentage data and the results are 4 factors. After that I would like to try some mixture ...
0
votes
0answers
38 views

How to statistically compare the trend of two-time series

I have 3 time-series, shown in the plot below: The plot shows a specific time frame for the 3 time-series data. I'm aware that some questions were posted around this subject (time-series trend ...
0
votes
0answers
26 views

pvalue lm output interpretation in R [closed]

...
1
vote
0answers
11 views

Comparing mixed-effects models in R- stepwise regression

I am currently working with a mixed effects model, and I would like to compare model fit between many potential models. I have seen some posts on this forms (as well as some work in the literature) ...
1
vote
0answers
22 views

Do Statistical Models (Automatically) Allow For "Ranking" Predictions?

I have always had the following question: Do statistical models (e.g. regression models, decision trees, random forest, etc.) automatically allow for ranking the predictions? I.e. If a random forest (...
0
votes
0answers
16 views

Using PCA to construct index from survey items

I have a data set consisting of responses to dozens of different survey items. I would like to create indices (such as for example political orientation) from some of these items representing closely ...
0
votes
0answers
11 views

R - contrasts in two-way within-subjects ANOVA?

I have a data set from a 4x2 within-subjects (aka repeated measures) design. Participant Identifier: SubjectNumber IV1: Purpose (A, B, C, D) IV2: Type (X, Y) DV: Score After running the overall two-...
0
votes
0answers
12 views

How to find the "inverted" version of a log regression when y is transformed to 100-y (y is a percentage)?

This question is both related to math and coding, and for transparency, I also posted it on Stack Overflow for the coding part. I need to modify a log regression when I change my y-axis data from y to ...
0
votes
0answers
16 views

1st order(linear?) polynomial logistic regression, is it a reasonable build? and have only one inflection?

I have been working on a third order polynomial logistic regression ...
2
votes
0answers
31 views

How to find a turning point of quadratic term for different categories?

I have built a logistic regression with polynomial relationship with variable age, which I include in the model as an interaction with variable ...
0
votes
0answers
7 views

Test of Significance in Discriminant Analysis for R

I am currently learning about discriminant analysis in R. As far as I know, the MASS package allows us to perform Linear Discriminant Analysis using the ...
0
votes
1answer
49 views

Validity of Hypothesis Testing for Non-Normal Data

I have never been able to clearly understand the relationship between Hypothesis Testing, Central Limit Theorem and the Normal Distribution. As an example, suppose we have the salaries of randomly ...
34
votes
2answers
2k views

How are Bayesian Priors Decided in Real Life?

I always had the following question: How are Bayesian Priors decided in real life? I created the following scenario to pose my question: Suppose you are researcher and you are interested in studying ...
1
vote
1answer
20 views

What are alternatives of Visual Statistics in R? [closed]

There is software, "Visual Statistics", which helps to visualize some concepts in Statistics. For example, if I want to teach confidence interval at confidence level %95, I would say if I ...
0
votes
0answers
51 views

Using Pearson Moment Correlation For Establishing Validity Between Two Questionnaires

I'm moderately new to psychometrics and test design, and I'm currently in the process of attempting to develop a questionnaire that measures soft skills (communication, collaboration, work ethic, ...
1
vote
1answer
39 views

Manual and Computer-Calculated Two-Sample t-tests

I want to calculate p value and confidence interval (CI) both manually and by R. this is my data set: ...
0
votes
0answers
5 views

No predictions due to variability in cv.glmnet

I am using elastic net regression with CV.glmnet to predict values for about 500 responses across 900 samples using responses and features in 200 samples. For some of the responses the CV.glmnet model ...
0
votes
0answers
12 views

Using the FSA R package to test effect of continuous covariates on von Bertalanffy growth rate

Is it possible to use the FSA package in R to test for the effect of continuous variables (such as temperature, latitude, precipitation). I have recapture growth data and am able to test for the ...
0
votes
0answers
19 views

extract similar distribution of a variable from 2 different databases [closed]

I have 2 different samples' DBs that differ for the variable age: ...
0
votes
1answer
28 views

Why individual fixed effect method is not estimating average marginal effects (panel data)?

I am using an individual fixed effect method in a panel data. I look whether the working hours changed differently between men and women following the 2008 financial crisis. Here is a simple model in ...
0
votes
0answers
29 views

Best log linear model from 3-way contingency table

The file "Aspirin" contains a 2 × 2 × 2 contingency table with columns defined as follows in R. Column 1: V1=Count. [Nonnegative integer count for each cell in the Table.] Column 2: V2=Case/...
0
votes
0answers
31 views

Question related to BFGS algorithm in "optimx" package [closed]

I would like to print out all intermediates estimates for the parameters in a logistic regression using the "optim" function from the "optimx" R package. How can do it ? For ...
0
votes
0answers
20 views

Random effects model for longitudinal data with repeated measures at each time point

Scenario 1: I have data for 100 patients at 5 time points each. Generally, this is a classic case where I can fit the following random effects linear model: $$Y = \beta_0 + \beta_1*t_{ij} + b_{0i} + ...
2
votes
1answer
42 views

Using kernlab::kqr(reduced = TRUE), how is the y argument missing in the call to csi()?

I'm trying to perform a kernelized quantile regression on some data using the function kqr() from the kernlab package in R. The ...
0
votes
1answer
34 views

Possible non-linearity pspline Cox model

Our working group ran a Cox regression with a p-spline to model the possible non-linearity of continuous variables. However, I'm a bit confused with the interpretation of the linearity or non-...
0
votes
0answers
16 views

Error when adding factor variables into R-INLA stack [closed]

I am running a joint hurdle model with R-INLA, the model has two liklihoods, a binary part and a count part modelled with a truncated negative binomial distribution. There are 8 covariates, 2 factors ...
0
votes
0answers
24 views

Calculating Pearson's generalised statistic

I have a poisson regression model (pbest = (V3~V2+L4+V5+V2*L4*V5,family=poisson)) which has a summary of ...
0
votes
0answers
24 views

Is this an application of sampling statistics?

Suppose there are is a bake sale and one of the participants prepares 20 cakes. You try 6 of this participant's cakes, and unfortunately you don't like any of his cakes. Question: Can you use ...
1
vote
1answer
40 views

Why is the $p$-value significant but the confidence interval includes zero in a $t$-test?

I am interested in learning whether the two groups below are statistically significant: ...
1
vote
1answer
19 views

feature selection of multivariate time series forecasting with fsMTS package

The fsMTS package uses the following example: ...
1
vote
1answer
28 views

How do I interpret a classification table from a logistic regression model

I completed a logistic regression model and a classification table but I am unsure of how to interpret the results of this table. The output is as follows ...
0
votes
0answers
18 views

What is the different between 2 codes for K-S test

What is different between these two codes and when can we use them I use K-S test code in R to check normaliity for data that is generated from N(1,6) of size 5 ...
0
votes
1answer
31 views

Weighted linear regression coefficient without intercept's closed-form solution differs from R's lm(.., weights=)

I am working through Harold Larson's Introduction to Probability Theory and Statistical Inference. In Chapter 9, Example 9.1.4 he discusses the simple linear regression model but where we assume the ...
0
votes
0answers
12 views

Restricting model parameters estimates to control the weights in logistic models in python/R

Referring to a similar problem as Restricting model parameters in logistic models in R, is there a method such that I can impose constraints on parameters for a logistic model in either ...
3
votes
1answer
69 views

Can statistical inferences be made on "any" probability distribution?

I have always seen statistical inferences being made on "clean and exact" probability distributions - for example, (multivariate) normal distributions. But can statistical inferences be made ...
0
votes
0answers
17 views

Is it possible (reasonable) to weight the regularization for some variable in Ridge/elastic net based on their importance/causal effect

Say I have 100 predictor variables. And I have estimations from a causal inference method that indicates the causal effect size of each variable to the response variable. Then I want to build a linear ...

1
2 3 4 5
523