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 program in `R`.

learn more… | top users | synonyms

0
votes
3answers
19 views

Why the density plot of a vector with uniqe numbers is a normal distribution?

The density plot of vector that containing unique number is normal distribution with mean 1: For example: plot(density(rep(1,100))
0
votes
0answers
11 views

Altering a glm object's variance-covariance matrix in R [migrated]

I am using glm to model health care costs as a function of various demographic factors, using cluster-robust standard errors since my observations are clustered within hospitals (HOSPNUM). In ...
0
votes
0answers
53 views

Anyone use R or Python as statistical tool in industry? How to get coefficients of gradient booting models?

I tried gradient boosting models using both gbm in R and sklearn in Python. However, neither of them can provide the coefficients of the model. For gbm in R, it seems one can get the tree structure, ...
0
votes
0answers
18 views

R - randomForest - rfcv function - explanation in laymans terms

My name is Abhi and I am trying to teach myself data science by solving problems on the internet. In my current model I am using a random forest & the rfcv function to test the performance of the ...
0
votes
0answers
4 views

Using dates in R for Theil-Sen [migrated]

I am trying to use dates as my X variable in a Theil-Sen slope estimation and I am having difficulty using the R package zyp ...
1
vote
0answers
42 views
+50

time varying continuous covariate with one single binary outcome

Despite having only a single binary outcome for each ID, there are multiple correlated measurements for the same test for each ID at different timepoints. The individual ID´s are obviously ...
0
votes
1answer
19 views

Mixed logistic ridge regression

I would like to build a logistic regression model in which I will be looking for predictor variables having a significant effect on the breeding success of a raptor bird. The predictors in the ...
0
votes
1answer
54 views

R code to solve for probability of normal distributions?

I don't understand which R code I am supposed to be using to figure these problems out. I brief explanation of what the code is doing would be amazing. The problems below are two different ...
2
votes
1answer
33 views

1-Way ANOVA with single independent/repeated (within/between) factor

I want to perform an ANOVA on data with a single factor with three levels. The difficulty for me is that two of the levels are repeated measures (within subjects) and the third level is independent ...
-1
votes
0answers
13 views

why is this giving me an NaN [migrated]

Ok, my problem is that I'm trying to compute $(-1)^{1/3}$, but when i ask R to compute this an NaN occur. > (-1)^(1/3) [1] NaN I really don't know why? I'm using R 2.15. i want to compute ...
0
votes
0answers
31 views

Which R packages offer the foldid (or simliar) parameter for cross-validation of group lasso?

My situation: small sample size: 116 binary outcome variable long list of explanatory variables: 50 (both continuous and categorical) explanatory variables did not come from the top of my head; ...
1
vote
0answers
118 views

Writing a coordinate descent algorithm for elastic net in SAS

In order to run Lasso and elastic net multiple regressions on my company's SAS server (which doesn't support R), I've been working on a coordinate descent macro for performing least squares ...
2
votes
1answer
58 views

What is the lme4::lmer equivalent of a three-way repeated measures ANOVA?

My question is based on this response which showed which lme4::lmer model corresponds to a two-way repeated measures ANOVA: ...
0
votes
0answers
29 views

Categorical Data

I have a questionare. Questionare has six variables, suppose x1,x2,....,x6 and each variable has six questions. each questions has a response , strongly agree, agree, indifferent, disagree, strongly ...
3
votes
0answers
50 views

Trouble fitting mathematical model to data in R

I am trying to select the correct mathematical model for my standard curve. This data was collected from spectrophotometry. I am hoping to get a model to help me detect very small absorbance. ...
6
votes
2answers
202 views

How trustworthy are the confidence intervals for lmer objects through effects package?

Effects package provides a very fast and convenient way for plotting linear mixed effect model results obtained through lme4 ...
0
votes
0answers
16 views

Diagnostics for the analysis of variance model

I have problem with the diagnostic of the one way analysis of variance model (fitted in R). I've checked all the assumptions of the analysis of variance 1) "For each level of the within-subjects ...
0
votes
1answer
43 views

How to test main effects of categorical variables in a binary logistic regression including an interaction?

I measure two binary responses from each participant (ChoiceVA = V or A, AestheticOnly = 0 or 1). There are two experiments (between-participant). I want to test the following hypotheses: ...
1
vote
0answers
12 views

In R: Replace values of a row if missing with values of another row [migrated]

I am relatively new to R and probably the solution to this problem is rather simple. I have a dataframe that looks like this: ...
3
votes
1answer
101 views

How can I optimize coefficients of an arbitrary model?

This might be terribly easy but I'm probably lacking the keywords to search for. Assume the following (dummy) data: ...
0
votes
0answers
32 views

lmer with multiply imputed data

How can I get pooled random effects for lmer after multiple imputation? I am using mice to multiple impute a dataframe. And lme4 for a mixed model with random intercept and random slope. Pooling lmer ...
-1
votes
0answers
34 views

Density distribution of outcomes of 2 dice rolled [duplicate]

This question is related to: http://stackoverflow.com/questions/26153925/r-studio-a-histogram-with-a-bar-for-each-frequency-value Amongst the outcomes of 2 dice rolled, the chances of 2 are equal to ...
0
votes
0answers
8 views

How to not only compute predicted values but also standard errors [migrated]

I am trying to generate standard errors for predicted values. I do manage to generate the predicted values, however, do not get the standard errors. Instead, I consistently get the following error ...
1
vote
0answers
33 views

Weighted Kaplan-Meier Curve Log Rank Test

I need to compare two weighted KM curves created by using the svykm function from the survey package. I am unable to find any ...
1
vote
1answer
38 views

R - MLE of modified Champernowne density

I've come across an article (http://papers.ssrn.com/sol3/papers.cfm?abstract_id=704903), in which author wrote about maximum likelihood estimates of parameters in the so called modified Champernowne ...
0
votes
0answers
30 views

How do I use R code to solve for probability of normal distributions? [duplicate]

I don't understand which R code I am supposed to be using to figure these problems out. I brief explanation of what the code is doing would be amazing. The problems below are two different ...
2
votes
1answer
45 views

Using ordered factor as predictor in R [duplicate]

This is a really simple problem I am having, yet for the life of me I can't find a solution searching around. In theory I can simply recode the data, but that is an extreme solution I would rather not ...
0
votes
0answers
38 views

covariate selection for a cox model by Lasso using glmnet

I would like to use model selection through shrinkage (Lasso) using glmnet. So far I did the following: ...
0
votes
1answer
41 views

AFT model with time varying independent variables

I am a newbie in survival analysis and I would like to pose some simple questions, after reading numerous posts regarding how to perform survival analysis in R. So, what I would like to know is: Can ...
0
votes
0answers
10 views

what is the best forecast interval for tbats?

I used tbats to fit a model to a set of weekly data (but only for weekdays) so I have seasonality of 5 for daily and 261 of annual. I wonder if tbats works better by updating the model using observed ...
0
votes
1answer
46 views

How can I run an analysis of variance with one independent variable and multiple dependent variables?

From my limited statistical knowledge, I could use MANOVA if I had multiple independent variables (x1, x2...xn). What can I do (specifically in R) with one "x" variable and multiple "y" groups? I'm ...
1
vote
0answers
10 views

How to model non-linear, linear and crossed random effects in one model

I have a model with fixed and crossed random effects like this: glmer(response~1+var1+var2+var3+var3^2+(1|var4)+(1|var5)+(1|var6), family="poisson") Now, I decided that variable3 is best modelled ...
1
vote
2answers
68 views

Seasonal adjustment for a series that has already been adjusted

A dataset I am working with (from the OECD), for harmonised unemployment seems to be seasonally adjusted: The unemployment rates shown here are calculated as the number of unemployed persons as a ...
0
votes
1answer
30 views

Does the calculation of error bars in lme4 require the Cosineau (2005) correction?

In Cosineau (2005) a method for calculating within-subject design error bars which removes the between subjects variance before calculating confidence intervals, error bars and so on is suggested. I ...
0
votes
0answers
29 views

Multivariate Multiple Logistic Regression in R

I have several dependent and independent variables. All my dependent variables are binary, therefore, I want to perform a multivariate multiple logistic regression, is that possible to do in R?
0
votes
0answers
6 views

Multiple combinations (ex drug-ADR) with the same unique case ID.

I am quite new to R statistics, and I one you can help me. I have tried finding the answer to my question by searching the forum and so on, and I apologize in advance if my question is trivial or ...
1
vote
0answers
62 views

Logistic regression gives very different result to Fisher's exact test - why?

I have a confusing situation where I have strongly conflicting results from two ways of analyzing my simple data. I measure two binary variables from each participant, AestheticOnly and ChoiceVA. I ...
0
votes
0answers
25 views

Fuzzy regression (using linear programming)

I want to replicate a fuzzy regression using a linear programming problem approach. I have the following information: " A fuzzy regression analysis with only one independent variable X results in ...
3
votes
3answers
838 views

Why there is no significant difference between a number list and its 100 times list

I am finding that there is no significant difference between a number list and another list which has 100*same numbers. The P value is 0.4487. The means are obviously very different (100 times). Why ...
1
vote
1answer
31 views

Using interaction terms in an MCMCglmm

I am using MCMCglmm models in R, with hierarchically nested data. The basic structure of the data is as follows - each dyad is a unique combination of focal/other: ...
0
votes
0answers
15 views

MCMCglmm interpretation of effective sample size

I'm running a selection of MCMCglmm models in R, and have a basic question about the outputs. Based on what I've been reading, one indication that the model is mixing well is a large effective ...
0
votes
0answers
20 views

How can I make decisions from the output of predict.coxph()?

I'm studying Survival Analysis for the purposes of customer churn modeling. I've managed to put together a model, but I'm confused about what to do with the output. As I understand it, the output is a ...
0
votes
1answer
89 views

model selection through shrinkage (Lasso) using glmnet

I would like to use model selection through shrinkage (Lasso) using glmnet. After trying the example of the glmnet manual and tried the procedure with my data. ...
2
votes
1answer
75 views

Impute missing values using aregImpute

I have a data frame with 61 columns. Some data is missing. I read in Steyerberg's book about aregImpute in Hmisc. I used it with ...
2
votes
0answers
37 views

How to compare variables' coefficients obtained from lasso?

My situation: small sample size: 116 binary outcome variable long list of explanatory variables: 50 explanatory variables did not come from the top of my head; their choice was based on the ...
2
votes
1answer
100 views

How to ensure that the most appropriate value for lambda is chosen in lasso?

My situation: small sample size: 116 binary outcome variable long list of explanatory variables: 50 explanatory variables did not come from the top of my head; their choice was based on the ...
1
vote
1answer
102 views

How to assess the incremental additive information of a new predictor in a Cox model using R?

I want to check whether the addition of the new predictor x3 improves the predictive information of a Cox model significantly or not. So far I have: ...
1
vote
1answer
48 views

Comparing coefficients of linear “ Stochastic Frontier Production and Cost Functions” in R

I am using the function frontier::sfa() in R to obtain the Stochastic Frontier Production and Cost Function as followed: ...
0
votes
0answers
34 views

Linear regression vs additive modelling, any meaning when linear modelling has higher accuracy?

I have a simple question. Is there any important meaning when non-linear modelling (general additive modelling such as gamm in R) has lower accuracy than linear modelling? some useful plots are ...
-4
votes
0answers
21 views