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

How to know the importance of all the variables and levels in them using Random Uniform Forest in R?

I have a dataset containing 3 parameters (Region( factors - say US,UK,Aus,NZ),Domain or Industry( factors - say IT,Electrical,Mechanical) and Scope - good or bad). Using Random Uniform Forest package ...
0
votes
0answers
32 views

Solve KNN classification using both categorical and quantitative variables in r [on hold]

Im new in this field, I am trying to classify a data set (what influence the alcohol consumption of young people, made of 32 variables like age, family situation, absences at school, etc.) using r. I ...
0
votes
1answer
44 views

Log-linear model, Poisson regression, categorical variable with 100 levels

I want to compare the incidence rate(asum) of 100 different cities(cityID) to see if there are significant differences among them. Given that the incidence rate is following Poisson, so it is a ...
0
votes
0answers
19 views

Error in CausalImpact package R [closed]

I am using the CausalImpact R package and using the following code. ...
0
votes
0answers
10 views

Case control sampling - matching distribution

I have large number of observations (say few thousands) which are divided into two groups A and B. I am interested in conducting ...
0
votes
0answers
21 views

Compute a double sumation with R [closed]

I'm triying to program the following expresion in R $$\frac{1}{\mu}\sum_{j=1}^{N} \sum_{i=j}^{N} \binom{N-j}{i-j} \binom{i}{j}^{-1} \left (\frac{\lambda}{\mu}\right)^{i-j} $$ where $\lambda$, $\mu$ ...
0
votes
0answers
11 views

Double Hurdle model with continuous DV and two sources of zeros

I want to regress a data set that contains a lot of zero's (~55%) and is determined by a typical 2-stage decision process generating the zeros: Consumer decides to apply for a bank loan or not (0-1) ...
0
votes
0answers
50 views

Will PCA also produce multicollinearity? [closed]

It's well known that PCA will generate orthogonal basis. But in practice, I found that even after PCA, I can still face the problem of multicollinearity. Is it due to the numerical limit or I did ...
0
votes
0answers
16 views

How do you get a pooled model fit of SEM after multiple imputation & propensity score matching? [closed]

using the R program, I would like to do multiple imputation --> propensity score matching --> structural equation modeling Here is my syntax: ...
0
votes
0answers
33 views

Influence of categorical variables on continuous outcome

I have a dataset of independent samples where we investigated whether an outcome variable 'TTI' was affected by four levels of relative humidity combined with two levels of oxygen. TTI does not seem ...
0
votes
1answer
22 views

Specifying starting values/modes for K-modes Clustering

I have a very large data set with 9000 observations and 25 categorical variables, which I've transformed into binary data and preformed hierarchical clustering and K-modes clustering in R. ...
0
votes
0answers
32 views

How to compute summation in r [closed]

This competition would be much easier if i formulated the problem as a summation. How do I do that? x is a data frame. Something like sum((x[i]-xm)^2) for i=1 to i=6 My R code: ...
0
votes
0answers
21 views

How to create training set for uni-variate prediction using SVM?

I am new to R and statistics. I have a problem related to the prediction: I want to predict a univariate time series using SVM, but I do not know how to construct the training set. what I want is that ...
2
votes
1answer
24 views

Predictions from BSTS model (in R) are failing completely

After reading this blog post about Bayesian structural time series models, I wanted to look at implementing this in the context of a problem I'd previously used ARIMA for. I have some data with some ...
7
votes
2answers
76 views

Compare MLR model to model $Y_i = (\beta_0 + \beta_1x_{1i} + \beta_2x_{2i} + \epsilon_i)^{\beta_3}$?

If I have theoretical reasons to suppose the data might be fit with an unusual equation such as the following: $$Y_i = (\beta_0 + \beta_1x_{1i} + \beta_2x_{2i} + \epsilon_i)^{\beta_3}$$ Can I use ...
1
vote
1answer
35 views

Why is it necessary to fix a matrix diagonal and after this calculate the exponential to assess transition probabilities?

I'm learning markov chains in order to compute estimations of transition probabilities, and I found an example of the estimator construction for continuous time markov chains: ...
0
votes
0answers
10 views

Estimating Distributions of Weighted Data

I'm trying to build a bivariate copula-based model of income and wealth in Italy and I'm having trouble handling weighted data. I have access to micro data, a survey of about 10,000 households that ...
1
vote
1answer
33 views

How do you do a non-linear Poisson? What even is it?

I have a count data that I am having trouble transforming to be linear. First, what are smoothing functions and how do I do it in R? Let's use the famous crab satellite example. If you plot width to ...
0
votes
0answers
9 views

Interpreting the psych::cor.smoother function in R

I've tried to contact William Revelle (the package creator) about this but he isn't responding. In the psych package there is a function called cor.smoother, which determines whether or not a ...
1
vote
0answers
35 views

How to change your data to be homoscedastic?

I want to use a linear discriminant analysis and need homoscedasticity. I'm wondering how to get this assumption correct with the data that I have. I have in total over 7000 samples, but I'm ...
0
votes
0answers
7 views

How is the weighted version of Kendall's Tau computed? And is there an implementation in R yet?

I could not find a satisfying answer to my question yet. Could someone maybe give me a very simple numerical example how the weighted version of Kendall's tau is calculated? Maybe for the following ...
-1
votes
0answers
35 views

two parameter optimization in R [closed]

I have to find the maximum of accuracy (of classifier) which is depending on only two parameters and my parameters are as i.e., p1 ranges from 1 to 400 and p2 ranges from 666 to 1000. Please help me ...
1
vote
1answer
24 views

With multinomial regression, how to predict an event and get the ROC curve?

I'm using the multinom package in R to run a multinomial logistic regression model. My dependent variable has 3 levels and as the output, I'm getting the ...
0
votes
1answer
25 views

Estimate the probability of the distribution of a sample

Suppose I have the sample of a continuous variable and I want to estimate the probability of that variable taking certain values. Suppose in addition that I estimate the density of that distribution ...
1
vote
0answers
14 views

R clustering using mclust: BIC are often NA

I'm working on segmentation/clustering and trying to use Gaussian Mixture Modelling for Model-Based Clustering. I'm using the R package Mclust in order to come up with the best fit for my data. All ...
3
votes
0answers
18 views

Interpolating GPS coordinates in R based on coordinates of another object

I am looking at a ship and a vessel being towed behind it. I have coordinates (in decimal lat and long) for the ship at 1 second intervals. However, I only have intermittent coordinates for the towed ...
1
vote
0answers
7 views

what does it mean when one of my top ranked model is the null model?

I have some whale tourism data that I am trying to model to see which factors significantly affect the number of encounters between whales and tourists. I have two years worth of data and have ...
0
votes
0answers
8 views

How can I calculate distance of points in multi-dimension space from the centroid in R [closed]

I have centroid of space in 5 dimenions given as ...
0
votes
0answers
16 views

parameter estimation of skewed student-t distribution in R

I am trying to fit skewed student-t distribution to fitted residual returns obtained from ARMA(1,1)-GARCH(1,1) The histogram of my data looks like I am using fGarch's sstdFit to estimate the ...
0
votes
0answers
15 views

How to obtain new variables using factor analysis in R?

I am working with 8 variables that are correlated with each other, and want to use factor analysis to construct two factors and then use them in my regression analysis. I typed this in R: ...
0
votes
0answers
23 views

Testing a 2 sample T test and finding proportion of rejections in R

The hypothesis given is that Ho = 0. A significance level of 0.05. Test the hypothesis for 1000 SRS's and find the proportion of rejections in those 1000 tests. What I did was ...
0
votes
1answer
41 views

Contradictory results of the ADF test in R [closed]

I used the urca pacakge in R to run the ADF test and got the following: It seems to me the results are quite contradictory: Using the statistic, we fail to reject the null hypothesis; However, ...
0
votes
0answers
10 views

GA Package in R - Function Restrictions [closed]

I am using the package called GA in R to optimize my non-linear function. The package says to the user to insert a vector min and max that is going to be the lower and upper boundaries for the search ...
0
votes
0answers
11 views

How to get correlation of each predictor to response

I am wondering how can I get the correlation from one predictor to a repsonse when I am looking at a given data set with many predictors. For example, the output of GLM in R would be exactly what I ...
0
votes
0answers
24 views

Using R, can someone help me draw an SRS of 100 given a normal distribution with mean 0 and STD 2? [closed]

Much help would be appreciated, I initially used xbar=numeric(1000) for (i in 1:1000){x=runif(100);xbar[i]=mean(x)} hist(xbar,col="orange",main="n=1") however I don't think this is correct
0
votes
0answers
27 views

How to calculate how uniform a curve is [closed]

I would like to know any ideas about to quantify how uniform a curve is. Any recommended way to calculate their uniformity in R? For example, I have two datasets showing the quantity of measurements ...
0
votes
0answers
34 views

More effective seasonal adjustment to time series data?

I am trying to predict surface temperature using solar energy. I have 3650 daily averages for both variables. The plots of both are below: I attempt to seasonally adjust with a periodic ...
0
votes
1answer
21 views

Can coxph be used for categorical data?

I'm doing some survival analysis and I got the idea to change a binary variable into three-category variable by sub-dividing one category of the binary variable into two new categories. Here's a ...
0
votes
0answers
19 views

R: Errors in leaps/regsubsets

I am doing some regression analysis and in certain cases I'm getting errors I cannot understand. R environment image is shared here: https://www.dropbox.com/s/n6opew73l7xgcbz/data.RData?dl=0 And ...
1
vote
2answers
42 views

What transformation should I use for a bimodal distribution?

I have some bimodal data like the one generated down (R language), and I don't know how to transform it to have a normal distribution or homoscedasticity. I'm running a linear discriminant analysis ...
0
votes
0answers
19 views

Flushing unused objects from memory [closed]

I want to freeing up some memory after creating some cforest objects, which seems to occupy my memory even after deleting them from my environment like this: ...
0
votes
0answers
15 views

Error: Variable has <2 category levels [closed]

I am using lrm in R to run logistic regression on my data set that has dimensions of 1252 by 96: ...
0
votes
0answers
11 views

Is the r package “clValid” also applicable for non biological research?

I am trying to cluster a bunch of countries according to certain parameters (GDP, birth rate, etc.). Therefore I am wondering whether I can apply the r package "clValid". From what I got from ...
1
vote
0answers
27 views

Zero-Inflated Poisson Regression – Warning message: In sqrt(diag(object$vcov)) : NaNs produced

I'm trying to model the following data: using zero-inflated poisson regression: model <- zeroinfl(dv ~ c1 + c2 + session | participant, data = dat) where ...
0
votes
1answer
39 views

R's algorithm for finding glm estimates

Is there a way of seeing the algorithm behind the glm function in R? I'm not really interested in the source code, but the step by step algorithm for finding estimates for binomial family and how it ...
5
votes
3answers
111 views

A bar graph and its look - should I add titles, where should values go etc

I didn't use r but I have recently decided to use it to plot graphs because of its great capability to do so. 'd like to plot a graph that shows voter turnout in ...
0
votes
0answers
10 views

predict.glmnet() gives same predictions for type = “link” and “response” using family = “binomial” [migrated]

Take this case (classic crab data for logistic regression): ...
0
votes
0answers
11 views

SPC charts in R - “Error in plot.window(…) : need finite 'ylim' values” [closed]

I'm using the qcc packing in R to try and generate an SPC 'R chart': library(qcc) my.data <- read.csv("/Users/Me/Desktop/data.csv",header=FALSE) The data are ...
2
votes
0answers
50 views

Is it possible to do a time series analysis with more than one explanatory variable?

I am working on a project, and I am absolutely new to forecasting and not so strong in statistics. I have an employee data for the last 7 years, along with the other variables like economic growth, ...
0
votes
0answers
17 views

probability of non-exceedance or the probability of exceedance for weibull distribution [closed]

How to calculate the probability of non-exceedance or the probability of exceedance in R for Weibull distribution? R package "nsRFA" is available in order to calculate probability of non exceedance ...