Stack Exchange Network

Stack Exchange network consists of 175 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

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
0answers
9 views

Writing equation of Neural Network model

I am very new to neural networks. My goal is to replace my multivariate regression model with NN and use its output to perform mathematical optimization in order to identify the values of the input ...
1
vote
1answer
68 views

GLMM summary and multcomp differences

Thanks for taking the time to read my question. I am using R to run a GLMM because I have taken repeated measurements on 100 individuals. The explanatory variable it is a proportion so I am using ...
0
votes
0answers
13 views

Simulating AR/MA Process and forecasting it

I'm trying to simulate an AR and a MA process separately. I found the ACF and PACF as well. If now I want to forecast for one time period ahead, can I do that with a simulated time series in R, if ...
1
vote
0answers
5 views

In the summary of output of the regression analysis in R, is there a way to display categorical variable with just one coefficient

I am doing a linear regression analysis in R with logarithmic dependent variable. One of the control variables is categorical and describes an industry. There are 6 industries and thereby R ...
0
votes
0answers
4 views

Implementing Moran's I through markcorr in R package Spatstat

I am trying to analyse a set of replicated point-patterns, where a fixed number of points are distributed non-randomly in space. The package spatstat has methods to pool spatial objects, which has ...
1
vote
1answer
8 views

Post-hoc testing for cumulative link mixed-effects model with interactions in R

I'm a resident physician working on my doctor's thesis and I'm trying to analyse data from a survey with R. I have basic mathematic and rookie statistics skills. Participants of the survey have been ...
0
votes
0answers
12 views

Strange Tukey Output

I'm using HSD.test in package Agricolae to run a Tukey PostHoc test on heavy metals concentrations in otter livers and kidneys. I'm looking at differences between region, river basin, and age class. ...
1
vote
1answer
13 views

Model to capture non-linear patterns in data using R

I've fitted a linear model using: m2 <- lm(GPP ~ rainfall + summer.temp + parcel.size + soil.nutrients, data=gpp) As seen from the partial relationship plots ...
0
votes
1answer
18 views

How to use Cullen and Frey graphs for downstream statistical analysis?

How to use Cullen and Frey graphs for downstream statistical analysis? I do not see any difference in normalized and raw data Cullen and Frey plots! Raw data ...
0
votes
0answers
18 views

Confidence Interval for non-smooth term in gam (mgcv)

I fitted a gam model in mgcv package and now want to get the confidence intervals for the non-smooth term. ...
0
votes
0answers
14 views

Cohen's Kappa in R versus SPSS

I was working with R and SPSS trying to determine Cohen's Kappa for a dataset. I decided to test the two and see if they would end up getting the same numbers. However, they did not. I was wondering ...
0
votes
0answers
3 views

Problems loading functions with @importFrom [migrated]

I'm currently trying to develop my first R package and run into a following problem. I have a DESCRIPTION file where all needed packages are listed under Imports like suggested by Hadley Wickham in ...
0
votes
2answers
21 views

Decrease a column of values by a given percentage in R [on hold]

I have a dataset with a column of values (in dollars) that needs to be decreased by a percentage. For example: ...
0
votes
0answers
11 views

Change ONE bar to different color in ggplot [on hold]

I can't puzzle out how to do this, even after looking through lots of stuff online. Like there has to be a simple way? In Excel, you can just double-click on the bar to change its color... Either ...
0
votes
0answers
13 views

How to do uncensored cox regression in R?

First of all, I'm not sure if the analysis name is uncensored cox or it has other names. I watched this youtube video, which is done in stata. So, anyone can recommend any package in R that able to ...
2
votes
2answers
185 views

Identifying contrasts between groups in R

I have some doubts which R function choose for my task. Lets imagine we have two types of objects "tree" and "grass" . I've estimated the height of both multiple ...
0
votes
2answers
2k views

How do you turn the output of a nnet neural network model into an equation?

Assuming the output of the above nnet feedforward model (nnetModel) is such that the following summary is produced: ...
0
votes
0answers
10 views

Compare fit Cox models with clusters in R

I would like to compare the model fits of Cox proportional-hazards models with a likelihood-ratio test (or equivalent). This usually works by comparing the fit with the ...
0
votes
0answers
6 views

Cannot get goodnes-of-fit measures from ivprobit output (in ivprobit package)

I am using the ivprobit function from the ivprobit package in R. This ivprobit function is a binary regression with instrumental variables. However, I could not find a way to derive any goodness-of-...
1
vote
0answers
23 views

PostHoc Tests after two way anova in R [on hold]

I have a data table with 2 explanatory variables: Noise, with 2 levels ("Exposed", "Unexposed") Voltage, with 9 levels The dependent variable is Delta Cm So, after checking Normality and variance ...
3
votes
1answer
427 views

compare non-nested Cox models

What I want to do is comparing two non-nested Cox regression models using R. Just for example: ...
1
vote
1answer
24 views

R: How to fit a GLMM in nlme

I want to compare lme4 and nlme packages for my data. But I'm confused by how to use syntax in nlme. I'm working with Mixed-Effects Models in S and S-Plus (Pinheiro, Bates 2000) and the current ...
4
votes
1answer
415 views

coxme proportional hazard assumption

I am running mixed effect Cox models (I have 1 random effect factor) using the coxme function {coxme} in R, and I would like to ...
0
votes
0answers
5 views

Conducting a three-step Latent Class Analysis in R

I'm trying to conduct a Latent Class Analysis in R using the poLCA package, and I have now become stuck on two aspects of the process. I have conducted Latent Class Analysis separately for males and ...
0
votes
0answers
8 views

How can I test significant differences across multiple categories in different dataframes?

I have very basic statistic knowledge and would like to hear some suggestions to analyze my data. I've three dataframes as displayed below: ...
1
vote
0answers
11 views

How to numerically solve a matrix differential equation in R?

I have interest in using the R language and environment to numerically solve a system of linear ordinary differential equations. The numerical solver, deSolve, ...
0
votes
0answers
7 views

Calculating RMSEC and RMSECV of PCA in R

I have been trying to calculate the root mean squares error of calibration (RMSEC) and the root mean squares error of cross validation (RMSECV) for a PCA model made in R using the mdatools package. ...
2
votes
1answer
35 views

How can t-SNE or UMAP embed new (test) data, given that they are nonparametric?

I have started using the UMAP method for dimension reduction which is a similar method to t-SNE, Diffusion Maps, Laplacian Eigenmaps, etc. The named dimension reduction methods have in common that ...
6
votes
2answers
2k views

Two poisson random variables and likelihood ratio test

I have two cases: Two random poisson variables $X_1 \sim \text{Pois}(\lambda_1)$, $X_2 \sim \text{Pois}(\lambda_2)$, and testing: Null Hypothesis: $\lambda_1 = \lambda_2$ Alternate hyp: $\lambda_1 \...
2
votes
1answer
37 views

Using ppois in r to calculate probabilities of random variable with variance

I'm working on a homework assignment on little sleep and hoping for some help. Here is the question I'm trying to write a script for: Write a script in R to compute the following probabilities of a ...
5
votes
1answer
19 views

Pairwise comparisons of regression coefficients [duplicate]

I would like to know how to make quickly pairwise comparisons of regressions coefficients across three or more groups in R. Here is a small example: ...
0
votes
0answers
89 views
+50

Logistic regression including instrumental variable (“ivprobit” in R) has coefficients with much reduced significance

I am trying to run a logistic regression including instrumental variables by using "ivprobit" function in R from the package called "ivprobit". If I do not include the instrumental variable, the "glm"...
0
votes
0answers
26 views

How do you run a regression when categorical variables may be involved, using R?

I have a data set with several categorical and quantitative variables. Say A, B, and C are categorical with several levels, X and Y are quantitative. I know that X ~ A will basically just be a ...
2
votes
1answer
76 views

Ripley K function value in a specific radius and dataset using R's Kest function

I'm having general trouble with calculating Ripley's K function values. The following is a simple spatial point pattern, where both X and Y range from 0 to 200: Here's its corresponding Ripley K ...
3
votes
1answer
22 views

How to estimate confidence intervals for LC50

This is my first question, so I hope the question is properly done (my apologies if it's not...) I am using a binomial GLM model (logit) for some toxicology data investigating the effects of a ...
0
votes
0answers
12 views

How to compute multiple Chi^2 P-values for each of a factor in a 3-way contingency table?

How were the p-values calculated using chi^2 (method cited in paper below) in the following table. Its a three way contingency table, tumor stage 1-4, race B/W and hospital city/university. They have ...
0
votes
1answer
186 views

Test same coefficient from two different models in R

I am working with two ivreg models. The only difference between them is the choice of instruments on the other side of the line. Example: ...
0
votes
0answers
47 views

Expected value of a variable given a probability distribution

I have fitted some data with a normal and gamma distribution. But I need to find the expected value of my variable. For example is x is my data (mine is not normal) and fit them into a normal and ...
0
votes
0answers
9 views

Mixed logit with repeated choices coefficient comparison

We are analysing data from the discrete choice experiment using mixed logit model. Data is panel, since we had repeated choices. We would like to compare if the difference in coefficients within the ...
0
votes
0answers
8 views

R glmmadmb continuous vs categorical interaction multiple comparisons

I'm running a model using glmmadmb and I'm not sure how to do multiple comparisons on an interaction between categorical and continuous predictors. Here are details on the model and data: My ...
0
votes
0answers
15 views

PCA based on group variables in R

I have a dataset containing 144 variables in 12 different groups. For example, the first 12 variables belongs to the group of industrial Production and the following 12 variables are taken from ...
3
votes
1answer
3k views

calculating adjusted means from lmer

How can I calculate adjusted means for a regression model with fixed and random effects? I'd like to calculate the adjusted means for a lme regression with this formula ...
1
vote
0answers
11 views

Taylor Series Power Function in R

I'm trying to recreate a compartmental model from Yu et al (2017). In this model there is a expanded taylor series power function that is used that I am not understanding how to code. where W(t) = 0, ...
7
votes
1answer
3k views

How to determine weights for WLS regression in R?

I am trying to predict age as a function of a set of DNA methylation markers. These predictors are continuous between 0 and 100. When performing OLS regression, I can see that variance increases with ...
0
votes
0answers
31 views

Initial conditions for nonlinear models using the nlsLM function

I have a data frame containing 70000 rows. For each row, I am trying to apply the nlsLM function (minpack.lm package) to find ...
0
votes
1answer
13 views

choosing metric for R keras for imbalanced binary class

i am using Keras on a text classification task in RStudio. I have a very imbalanced binary classification problem where the positive class is only present in about 2% of cases. If i use down-...
0
votes
0answers
16 views

Joint probability distribution from Clayton Copula in R [on hold]

I have two series and I assume that their dependence structure is given by a Clayton copula. I want to compute the joint probability P(X=x, Y=y) for different x, and y,along with the conditional ...
0
votes
0answers
20 views

Additivie vs multiplicative time series in R

Is there a function, or a way, in R that helps me know if my time series should be decomposed into an additive model or multiplicative model?
0
votes
1answer
124 views

Time series forecast - ARIMA/ARIMAX with daily data [on hold]

I am working on a project to analyse and forecast time series for sales and revenue of a client. There are various models that i want to test for accuracy purposes - namely Holt Linear Method, Holt ...