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

0
votes
1answer
63 views

Which library is the easiest to start with for Deep Learning

I am quite proficient with Machine Learning libraries and now want to get into Deep Learning. I am even quite comfortable with neural networks as far as understanding back propagation algorithm is ...
0
votes
0answers
10 views

Estimation of explained variance using Partial Constrained Correspondence Analysis (pCCA) in Vegan (R pacakge)

I am attempting to use the vegan R package to explain variance in (dummy data) of human height. Total height is the sum of three components (head, torso, and leg ...
0
votes
1answer
31 views

Controlling nuisance covariate in lmer

I want to control for a nuisance covariate in a linear model. Since the covariate interacts significantly with one of the fixed factors, the homogeneity of regression slopes assumption is violated for ...
0
votes
0answers
8 views

How to measure the concurvity? (MGCV)

In the R package MGCV there is a function to measure the level of concurvity https://stat.ethz.ch/R-manual/R-patched/library/mgcv/html/concurvity.html What is the formula behind that? Is there any ...
0
votes
0answers
28 views

Project help [undergraduate] [R]

I have to do a project for my statistics course, which I have now finished but would very much appreciate some insight and help as I've never done anything like that before. I was given data on ...
1
vote
0answers
44 views

Fitting GLM with Quasi-Newton method

I'm trying to code my own quasi-Newton algorithm for fitting GLMs in R. My results do not match up with glm and I've been over my code many, many times so I'm ...
0
votes
0answers
16 views

How to Calcuate Segment & Symbol Periodicity

I want to calculate segment and symbol periodicity using R. Has any one done it before as i am relatively new to R? i have a lot of timeseries with irregular sporadic data and i want to find out if ...
0
votes
0answers
8 views

Converting Repeated Measures Code in SAS to Equivalent in R [migrated]

I am attempting to convert existing SAS code I have for a research project into R. I am, unfortunately, finding myself totally clueless on how to approach this for repeated measures ANOVA despite a ...
0
votes
0answers
2 views

creating a 3D kernel regression fit from a pool of predictors

i have a ~1k data set that has one response column(z) and 4 hypothesized predictors(x1-x4). i wish to create a 3D plot of the response surface, for example z ~ x1+x1 or z~x2+x4 i know that i need ...
1
vote
2answers
38 views

GLM over time and space?

is it possible to fit a GLM over space and time? I have shrimp densities measured over 8 months, and in each month there are 4 stations sampled along a freshwater-saltwater gradient, so I have 32 ...
0
votes
1answer
23 views

r, caret - preprocessing range vs scale

I noticed that caret preprocessing has a range method to "scale predictors between 0,1". When does this option become more desirable than center and scaling?
1
vote
0answers
18 views

PCA using prcomp and princomp in R [duplicate]

I have been trying to do Principal Component Analysis (PCA) via R. The data set is available at https://www.dropbox.com/s/s3jstl8pu1e1xcp/Cars.csv?dl=0 I tried to do PCA via 2 different methods - ...
0
votes
0answers
9 views

Plotcp Plot Plateaus

I'm trying to understand why this graph plateaus. I have many more levels in the predictors than there are splits, so I'm confused why the tree stops splitting at only 447. I'm also confused why the ...
2
votes
0answers
46 views

Omitted Variable Bias in Linear Regression - Simulation

Is the following a reasonable illustration of the OVB problem? We build up fictional data around the regression line: $$y = 7.2 + 2.3 \, x_1 + 0.1 \, x_2 + 1.5 \, x_3 + 0.013 \, x_4 + eps$$ by ...
1
vote
1answer
26 views

Equivalent to Welch's t-test in GLS framework

How can Welch's t-test be expressed as a generalized least squares model? A standard independent samples t-test (where it is assumed that the samples being compared are drawn from populations with ...
0
votes
1answer
62 views

“Error during wrapup: the leading minor of order 2 is not positive definite” when trying to use LME with random slopes

This works fine: lme(fixed=target~target_projection, random= ~ 1|CLINICIAN_USER_ID, data=study_pop) But if I try to let the slopes vary: ...
2
votes
0answers
43 views

Maximizing combined log likelihood from different dataset using r

I have observed data $y$. And I have a function that gives me estimated $\hat{y} = f(x,\hat{P})$ where P is the parameter I want to estimate. I was able to optim() command in R to get maximized ...
0
votes
0answers
14 views

Anomaly Detection with very small number of positives [closed]

I am trying to detect anomalies in a population comprising of 10 features and around 90,000 observations. Past investigations have revealed 18 positives. Given limited data for supervised learning, I ...
0
votes
0answers
6 views

R merge function with custom ID match criterion [migrated]

Hello I need to merge two data frames. The relevant ID columns of the two data frames contain comma-separated lists of IDs (as string). For example those two rows should be merged: ...
0
votes
0answers
23 views

Consistent weight.matrix from the GenMatch (Matching package) in R

So I want to use the GenMatch function to generate optimal weight coefficients, to later use in the Match() function. But when I run the command twice, I do not get the same Matrix values. For ...
0
votes
1answer
38 views

Resources for understanding meta-regression?

I'd like to learn more about the statistical techniques that one should use for a meta-regression. I'm interested in both general theory, as well as examining methodologies in R.
0
votes
0answers
8 views

How to substitute the original data with the results from the count function from the plyr package? [migrated]

My original data is something like this: x1 x2 x3 1 0 0 0 2 1 1 1 3 1 1 1 4 1 3 1 5 2 2 2 6 3 3 3 7 3 3 3 8 3 2 2 After using count ...
1
vote
0answers
14 views

Meta analysis; significance test of correlations

I have performed a meta analysis using the 'Metafor' package in R. I have some corrected correlations. Now I am wondering how I can calculate whether they are significant and whether there is a ...
0
votes
0answers
35 views

Valid to run glmnet package with single lambda value for lasso regression instead of sequence of lambda values?

I'm executing a few test runs of a lasso regression with the glmnet package in R using the diabetes dataset (http://www4.stat.ncsu.edu/~boos/var.select/diabetes.tab.txt). I’m choosing a single lambda ...
-1
votes
0answers
27 views

k-prototype clustering with mixed data [closed]

I know that numerical clustering algorithms such as k-means are not suitable for clustering mixed data (nominal and numerical data), so I want to use k-prototype clustering in R.I have 1 discrete ...
6
votes
1answer
51 views

Is it possible to recover original numbers of 2x2 table from odds ratio with given 95% confidence interval?

Odds ratio is usually calculated from 2x2 table and looks to have quite unique combination of the resulting statistics and confidence interval values for each number combination (or number ratios) in ...
1
vote
0answers
17 views

R: Effect size from simple slopes

I have calculated simple slopes for a multiple regression using simpleSlope from package pequod(). Is there a way to easily compute an effect size for a single simple slope analysis from the output? ...
1
vote
0answers
11 views

How to label observations based on latent class analysis

I perform a latent class analysis to a dataset of binary variables with ...
0
votes
1answer
29 views

How do I estimate VECM with weak exogeneity restrictions placed in R?

I am estimating VECM model of electricity demand. I would like to impose weak exogeneity restricitions on the estimation of VECM in R. How do I implement this? Thanks a lot.
1
vote
2answers
52 views

Fit very Skewed Data with Large Amount of Zeros in GLM in R

Problem I was hoping someone could help me fit an unusual data set which includes a large amount of 0's in my dependent variable in R. Model My goal is to find which variables (tyre brand ...
1
vote
0answers
22 views

How to model time-series data with nested random and fixed effects?

I'm analysing PAM fluorescence data from an experimental set-up that I duplicated from an earlier experiment with a missing control. That's why I haven't given the statistics of the experiment much ...
0
votes
0answers
35 views

Outside 1.5 times inter quartile range yet not outlier

I have a data set with the following density histogram and box plot. Summary info as given R function. ...
0
votes
0answers
29 views

Identify suitable regression method and implementation approach in r

I would dearly appreciate the community's help on this topic. I have a categorical predictor variable (10 options), a confounding categorical variable (15 options), and a response variable. This ...
1
vote
2answers
49 views

Kernel PCA and classification

I need to perform kernel PCA on the colon-­‐cancer dataset and then I need to plot number of principal components vs classification accuracy with PCA data. For the first part I am ...
7
votes
2answers
560 views

Simple non-linear regression problem

I'm trying to model a simple use case: predicting the price of a car based on its mileage, with RStudio. I know it's a really naive model, just one variable, but it's for comprehension purposes. My ...
0
votes
0answers
20 views

Testing model fit and running model validation plots for averaged models

I have carried out a model selection process and averaged the models within the top 2 AICcs (using MuMIn in R). I would like to test the model fit using both the chisq and validation/residual plots. ...
0
votes
0answers
6 views

R: How to find max length sequence between two values in a vector? [migrated]

Let's say I want to find max sequence(in length) between number 0 A=c(0,2,3,0,5) in this case it should return 2 . I was really cracking my head for this. Not that good in programming to write that ...
2
votes
0answers
35 views

Kernel density estimation with reflection

EDIT: I try to decode the Silverman's reflection methods for the kernel density estimation using R. In my case, the lower boundary of the domain of a density to be estimated is set to 0 (zero). As ...
0
votes
0answers
17 views

Feature Selection for Regression Models in R [duplicate]

I’m trying to find a feature selection package in R that can be used for regression. Most of the packages implement their methods for classification using a factor ...
2
votes
1answer
60 views

simulate t-tests of mean differences

I would like to simulate t-tests of mean differences. I would like to simulate data based on 1) pre-specified (desired) mean difference between the variables and 2) desired t value 3) and p-value ...
-2
votes
1answer
22 views

Why my code error? find call value in R code [closed]

this is my code whats miss? Im confused why my code error please help me this code like black-scholes but in geske formula Values Call = VT1*N(d1)-K2*exp(-r*(T2-T1))*N(d2) N=distribution normal ...
0
votes
2answers
28 views

R lm() nested formulas give different results

Online sources show two supposedly equivalent ways to write an R linear model formula with nested factors: ...
0
votes
1answer
33 views

Simulating a dynamical system

Basically I need to replicate Hartley's 'A User's Guide to Solving Real Business Cycle Models' . Specifically (to make question relevant to stats.stackexchange), I want to simulate the dynamical ...
0
votes
0answers
9 views

change order of variables for plots in effects package- prob easy but can't figure it out [migrated]

I made a plot using the effects package in R, which I think draws on lattice for plotting, but can't figure out how to change the order of the variables. Here is the plot: And here is the code: ...
4
votes
3answers
106 views

(Feed-Forward) Neural Networks keep converging to mean

I'm having an interesting dilemma with the neuralnet and nnet packages in R. I recently ...
3
votes
0answers
36 views

What is the theory behind using eigenvectors for spatial filtering

As a programmer I have used the spdep package successfully for spatial filtering. But would appreciate it if someone could offer a description (preferably with supporting references) of how this ...
0
votes
0answers
9 views

Inference drawn from multiple correlation coefficient and partial correlation coefficient

I would like an explanation to why we need both types of correlation coefficients. Google helps me with the appropriate formula to calculate the coefficients so I do not think I need any help on that. ...
0
votes
1answer
30 views

Newey West standard errors in regression model without constant

I'm estimating $y_i= \beta_1 \times x_{1i} + \varepsilon_i$ on a time series on $y$ and $x$, so in presence of Heteroschedasticity and Autocorrelation. My model does not include any intercepts. Are ...
0
votes
0answers
34 views

Formula to compute factor scores (used for CFA in lavaan, to be applied in Excel)

I'm asked by my client to recreate cfa model in excel; with all the formulas in the cells. I used lavaan and R to fit the model. It's a simple step to get factor ...
0
votes
0answers
52 views

Semi-supervised classification with Rmixmod package in R

Semi-supervised classification with Rmixmod package in R. http://math.univ-lille1.fr/~biernack/index_files/articleJSS.pdf , a document on the Rmixmod R package, provides mathematical exposition of ...