Id
stringlengths
1
6
PostTypeId
stringclasses
7 values
AcceptedAnswerId
stringlengths
1
6
ParentId
stringlengths
1
6
Score
stringlengths
1
4
ViewCount
stringlengths
1
7
Body
stringlengths
0
38.7k
Title
stringlengths
15
150
ContentLicense
stringclasses
3 values
FavoriteCount
stringclasses
3 values
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
stringlengths
1
6
OwnerUserId
stringlengths
1
6
Tags
list
5250
1
5325
null
36
40374
I am trying to analyse some data using a mixed effect model. The data I collected represent the weight of some young animals of different genotype over time. I am using the approach proposed here: [https://gribblelab.wordpress.com/2009/03/09/repeated-measures-anova-using-r/](https://gribblelab.wordpress.com/2009/03/09/...
Multiple comparisons on a mixed effects model
CC BY-SA 3.0
null
2010-12-08T11:22:42.240
2015-10-28T21:18:42.730
2015-01-07T15:52:47.797
582
582
[ "r", "anova", "mixed-model", "multiple-comparisons", "repeated-measures" ]
5251
2
null
5226
1
null
If you lose iid and normality assumptions things can get ugly. In [Anderson book](http://rads.stackoverflow.com/amzn/click/0471047457) you can find explicit formulas for expectations of type $\sum_{s,r,t,u}E(X_s-m)(X_r-m)(X_t-m)(X_u-m)$ when $X=(x_1,...,x_n)$ is a sample from stationary process, with mean $m$. In gene...
null
CC BY-SA 2.5
null
2010-12-08T11:31:14.750
2010-12-08T11:31:14.750
null
null
2116
null
5252
2
null
5235
22
null
In the regression model: $$y_i=\mathbf{x}_i'\beta+u_i$$ the usual assumption is that $(y_i,\mathbf{x}_i,u_i)$, $i=1,...,n$ is an iid sample. Under assumptions that $E\mathbf{x}_iu_i=0$ and $E(\mathbf{x}_i\mathbf{x}_i')$ has full rank, the ordinary least squares estimator: $$\widehat{\beta}=\left(\sum_{i=1}^n\mathbf{x}_...
null
CC BY-SA 3.0
null
2010-12-08T12:15:49.997
2013-11-07T12:15:14.593
2013-11-07T12:15:14.593
2116
2116
null
5253
1
5256
null
188
1020056
After reading a dataset: ``` dataset <- read.csv("forR.csv") ``` - How can I get R to give me the number of cases it contains? - Also, will the returned value include of exclude cases omitted with na.omit(dataset)?
How do I get the number of rows of a data.frame in R?
CC BY-SA 3.0
null
2010-12-08T12:16:53.550
2013-08-22T15:46:09.177
2011-10-08T01:21:44.497
183
1950
[ "r" ]
5255
2
null
5253
40
null
Briefly: - Run dim(dataset) to retrieve both n and k, you can also use nrow(df) and ncol(df) (and even NROW(df) and NCOL(df) -- variants are needed for other types too). - If you transform e.g. via dataset <- na.omit(dataset), then the cases are gone and are not counted. But if you do e.g. summary(dataset) the NA ca...
null
CC BY-SA 2.5
null
2010-12-08T12:29:53.513
2010-12-08T14:51:02.570
2010-12-08T14:51:02.570
null
334
null
5256
2
null
5253
217
null
`dataset` will be a data frame. As I don't have `forR.csv`, I'll make up a small data frame for illustration: ``` set.seed(1) dataset <- data.frame(A = sample(c(NA, 1:100), 1000, rep = TRUE), B = rnorm(1000)) > head(dataset) A B 1 26 0.07730312 2 37 -0.29686864 3 57 -1.18324224 4 91...
null
CC BY-SA 3.0
null
2010-12-08T12:34:11.843
2013-08-22T15:46:09.177
2013-08-22T15:46:09.177
1390
1390
null
5257
2
null
3845
4
null
It is a known bug in plm package, when `effect="individual" ` the pgmm crashes. The bug is fixed in plm version 1.2-7. As for simulation, you need to calculate estimates of individual effects, since they are not estimated in GMM. At the current moment, the plm does not have the functions for predicting GMM model. I ha...
null
CC BY-SA 2.5
null
2010-12-08T13:04:03.837
2010-12-08T13:04:03.837
null
null
2116
null
5258
2
null
5171
10
null
[Log-linear models](http://en.wikipedia.org/wiki/Poisson_regression) might be another option to look at, if you want to study your two-way data structure. If you assume that the two samples are matched (i.e., there is some kind of dependency between the two series of locutions) and you take into consideration that data...
null
CC BY-SA 4.0
null
2010-12-08T14:39:39.863
2022-12-11T17:43:57.517
2022-12-11T17:43:57.517
362671
930
null
5259
2
null
726
15
null
`Torture numbers, and they'll confess to anything.` ~Gregg Easterbrook
null
CC BY-SA 2.5
null
2010-12-08T15:13:53.143
2010-12-08T15:13:53.143
null
null
1371
null
5260
1
5273
null
4
237
Suppose $\hat{m} = \frac{1}{N}\sum_{i=1}^{N}(X_i)$ where $X_i \sim N(m,\sigma)$. Are the following steps correct? \begin{align}\operatorname{Var}\left\{(\hat{m}-m)^2\right\} &= \mathrm E\left\{(\hat{m}-m)^4\right\} - \mathrm E^2\left\{(\hat{m}-m)^2\right\}\\&= 3\mathrm E^2\left\{(\hat{m}-m)^2\right\} - \mathrm E^2\left...
Calculating $\operatorname{Var}\left\{(\hat{m}-m)^2\right\}$ for a univariate normal distribution
CC BY-SA 4.0
null
2010-12-08T15:37:55.173
2023-03-12T04:46:29.670
2023-03-12T04:46:29.670
362671
2148
[ "normal-distribution", "variance", "estimation", "expected-value" ]
5261
2
null
5247
3
null
Two figures of merit in control charting are (1) the expected length of time the process will appear to remain in control when in fact it is; and (2) the expected length of time it takes for an OOC condition to be detected after the process first moves out of control. Under the usual assumptions--iid normally distribut...
null
CC BY-SA 2.5
null
2010-12-08T16:12:12.467
2010-12-08T16:12:12.467
null
null
919
null
5262
2
null
5249
9
null
I wonder if there is a criterion collision going on here. One complaint about file formats such as Excel, SQL, etc are that you have to define the datatypes in advance to have it behave well, which runs contrary to the "something more light weight" criterion (as I understand your restriction to be more time related tha...
null
CC BY-SA 2.5
null
2010-12-08T16:32:54.793
2010-12-08T16:44:01.007
2010-12-08T16:44:01.007
196
196
null
5263
2
null
5181
5
null
The correct answer here is [hierarchical modeling](http://en.wikipedia.org/wiki/Hierarchical_Bayes_model) (also called multilevel modeling). What you want to do is have the variance parameters drawn from a common prior distribution who's parameters are also estimated. Something like CountryVariance_i ~ D(Location, Sc...
null
CC BY-SA 2.5
null
2010-12-08T16:51:02.557
2010-12-16T03:26:47.083
2010-12-16T03:26:47.083
1146
1146
null
5264
2
null
4451
1
null
Check out kaggle.com , they have some contests about social networks and they give out datasets. Also, Stanford's SNAP is a great resource. And it has research works to boot.
null
CC BY-SA 2.5
null
2010-12-08T16:58:44.833
2010-12-08T16:58:44.833
null
null
null
null
5265
2
null
5238
3
null
I suggest you look at google refine (http://code.google.com/p/google-refine/). I think is a very good tool for editing CSV files
null
CC BY-SA 2.5
null
2010-12-08T17:19:52.813
2010-12-08T17:19:52.813
null
null
null
null
5266
1
null
null
4
607
I have a need to analyze an experiment that had a binomial outcome and categorical predictors. For context we sent out an email to our customers and encouraged them to register their account online (did register or did not register online). There are different nine groups that received the email. The groups are segment...
Analysis with binomial outcome and categorical predictor
CC BY-SA 3.0
null
2010-12-08T17:34:11.617
2017-01-12T15:41:15.810
2017-01-12T15:41:15.810
11887
null
[ "r", "logistic", "anova", "binomial-distribution" ]
5267
2
null
5266
2
null
The model you re looking for is called a [logistic regression](http://en.wikipedia.org/wiki/Logistic_regression). Look at the `glm` function in R and use `family=binomial()`.
null
CC BY-SA 2.5
null
2010-12-08T17:48:19.950
2010-12-09T02:28:42.037
2010-12-09T02:28:42.037
919
1979
null
5268
1
null
null
11
965
I wish to cluster users together in a database, with each user represented by a number of features that are both discrete and continuous in nature. The aim is to define a small number of archetypal "users" with specific set of features. All other users are then categorized as being similar to one or other of these ar...
Recommended method for finding archetypes or clusters
CC BY-SA 3.0
null
2010-12-08T17:56:29.253
2023-04-12T21:09:27.230
2013-02-13T04:13:31.840
7290
null
[ "clustering", "categorical-data", "unsupervised-learning" ]
5269
2
null
5260
3
null
I think you intended to take the mean of the $x_i$, instead you took the sum in the definition of $\hat{m}$. This makes the quantity $\hat{m} - m$ look weird.
null
CC BY-SA 2.5
null
2010-12-08T18:06:58.873
2010-12-08T18:06:58.873
null
null
795
null
5270
1
5276
null
3
2925
I have some data which, after lots of searching, I concluded would probably benefit from using a linear mixed effects model. I think I have an interesting result here, but I am having a little trouble figuring out how to interpret all of the results. This is what I get from the summary() function in R: ``` > summary(no...
Interpreting size and direction of fixed effects in a linear mixed effect model
CC BY-SA 2.5
null
2010-12-08T18:27:38.503
2010-12-08T20:06:40.940
null
null
52
[ "r", "mixed-model" ]
5271
1
5272
null
2
11172
I have fit a linear model and I now doing a lack-of-fit test. If the model has a good fit, the residual deviance should follow a $\chi^2$ distribution. The model I just ran has a very poor fit, and now I want to show this visually. I have used the following R code to plot the value of the residual deviance and the $\ch...
How to change X-axis format in plot
CC BY-SA 2.5
null
2010-12-08T18:46:12.053
2010-12-08T19:08:27.073
null
null
1973
[ "r" ]
5272
2
null
5271
1
null
Look at function `axis` help page. Something like the following should work: ``` axis(1, at = x <- seq(3.5e5, 8e5, by = 5e4), labels = paste(x/1000, "k", sep = "" )) ```
null
CC BY-SA 2.5
null
2010-12-08T19:08:27.073
2010-12-08T19:08:27.073
null
null
2116
null
5273
2
null
5260
7
null
If $\hat{m}=\frac{1}{n}\sum_{i=1}^nX_i$, where $X_i$ is iid normal sample, then $\hat{m}\sim N\left(m,\frac{\sigma^2}{n}\right)$. Then $(\hat{m}-m)\sim N\left(0,\frac{\sigma^2}{n}\right)$ and we can apply the results about normal distribution. We have \begin{align*} \operatorname{Var}\left(\left(\hat{m}-m\right)^2\righ...
null
CC BY-SA 4.0
null
2010-12-08T19:35:22.073
2023-03-12T04:41:25.077
2023-03-12T04:41:25.077
362671
2116
null
5274
2
null
5233
3
null
Let's take a derivative (difference) here, so instead of working with location, you work directly with what you want: distance. Say word FOO appears in the text 30 times. Calculate the distance (number of other words) between each consecutive occurrence of FOO, creating a vector of 29 distances. Then pick your plot: hi...
null
CC BY-SA 2.5
null
2010-12-08T19:43:07.323
2010-12-08T19:43:07.323
null
null
1764
null
5275
1
5277
null
5
1703
Let $\{x_i\}_{i=1}^n$ be a sample from a multivariate Gaussian distribution ${\cal N}(0, \Sigma_X)$ and $\{y_i\}_{i=1}^m$ be a sample from ${\cal N}(0, \Sigma_Y)$. Are there hypothesis tests for $\Sigma_X = \Sigma_Y$? Pointers to relevant literature would be very appreciated.
Two-sample test for multivariate normal distributions under the assumption that means are the same
CC BY-SA 2.5
null
2010-12-08T19:53:15.887
2010-12-08T21:56:58.590
2010-12-08T20:19:25.480
930
168
[ "hypothesis-testing", "multivariate-analysis" ]
5276
2
null
5270
1
null
If we assume that your model is adequate, then your reasoning is correct, if relative.sents.B increases by 1, relative.sents.A will increase by 0.43.
null
CC BY-SA 2.5
null
2010-12-08T20:06:40.940
2010-12-08T20:06:40.940
null
null
2116
null
5277
2
null
5275
7
null
The [Mauchly's test](http://en.wikipedia.org/wiki/Mauchly%27s_sphericity_test) allows to test if a given covariance matrix is proportional to a reference (identity or other) and is available through `mauchly.test()` under R. It is mostly used in repeated-measures design (to test (1) if the dependent variable VC matrice...
null
CC BY-SA 2.5
null
2010-12-08T20:52:08.077
2010-12-08T21:56:58.590
2010-12-08T21:56:58.590
930
930
null
5278
1
5280
null
67
21480
What way (ways?) is there to visually explain what is ANOVA? Any references, link(s) (R packages?) will be welcomed.
How to visualize what ANOVA does?
CC BY-SA 3.0
null
2010-12-08T21:45:45.977
2017-05-16T05:33:21.900
2017-03-29T07:47:18.597
11887
253
[ "data-visualization", "anova", "teaching" ]
5279
2
null
5249
6
null
In all seriousness, I would consider RData files created by R itself as it fits - reliable (check) - simple (call it a draw--the format is binary) - open (check: doesn't get more open than R source code) - interoperable (check: works everywhere R works) Close enough for me. If by systems you mean applications ra...
null
CC BY-SA 2.5
null
2010-12-08T22:11:26.423
2010-12-08T22:26:10.397
2010-12-08T22:26:10.397
930
334
null
5280
2
null
5278
54
null
Personally, I like introducing linear regression and ANOVA by showing that it is all the same and that linear models amount to partition the total variance: We have some kind of variance in the outcome that can be explained by the factors of interest, plus the unexplained part (called the 'residual'). I generally use t...
null
CC BY-SA 3.0
null
2010-12-08T22:24:17.513
2013-09-30T15:34:41.750
2013-09-30T15:34:41.750
30872
930
null
5281
1
5284
null
8
1778
Suppose we are to estimate a expectation problem $E(f(X))$, where $X$ is a random variable with known distribution, by simulation and Large Law of numbers estimator. [Antithetic method](http://en.wikipedia.org/wiki/Antithetic_variates) is a way to reduce variance of estimator in such cases. If $X$ is a 1D random variab...
Questions about antithetic variate method
CC BY-SA 2.5
null
2010-12-09T00:42:19.260
2011-05-17T20:29:54.773
2010-12-09T02:27:09.217
919
1005
[ "expected-value" ]
5282
2
null
5160
8
null
These two links provide some R (and C) code examples of implementing a DP normal mixture: - http://ice.uchicago.edu/2008_presentations/Rossi/density_estimation_with_DP_priors.ppt - http://www.duke.edu/~neelo003/r/DP02.r Found another reference. Chapter 15 has DP winbugs code: - http://www.ics.uci.edu/~wjohnson/BI...
null
CC BY-SA 2.5
null
2010-12-09T02:10:10.680
2010-12-20T14:22:03.660
2010-12-20T14:22:03.660
2310
2310
null
5283
2
null
5278
10
null
Check out Hadley Wickham's presentation ([pdf](http://ggplot2.org/resources/2007-past-present-future.pdf), [mirror](http://www.webcitation.org/6K1QO80KC)) on ggplot. Starting on pages 23-40 of this document he describes an interesting approach to visualizing ANOVAs. *Link taken from: [http://had.co.nz/ggplot2/](http://...
null
CC BY-SA 3.0
null
2010-12-09T02:19:57.483
2013-09-30T15:56:55.523
2013-09-30T15:56:55.523
7290
995
null
5284
2
null
5281
8
null
- Yes. There's no simple condition. When $f$ is monotonic, $f(X_1)$ and $f(Y_1)$ will still be negatively correlated. When $f$ is not monotonic, all bets are off. For example, let $F$ be a uniform distribution on $[-1,1]$ and let $f(x) = x^2$. Then $X_1 = -Y_1$, whence $f(X_1) = f(Y_1)$, implying $f(X_1)$ and $f(...
null
CC BY-SA 3.0
null
2010-12-09T02:26:44.333
2011-05-17T20:29:54.773
2011-05-17T20:29:54.773
919
919
null
5286
2
null
5249
4
null
In response to Dirk Eddelbuettel's answer, I suggest using the [HDF5 file format](http://www.hdfgroup.org/HDF5/whatishdf5.html). It is less simple than the RData format, or you might say, 'more rich', but certainly more interoperable (can be used in C, Java, Matlab, etc). I have found that I/O involving large HDF5 file...
null
CC BY-SA 2.5
null
2010-12-09T05:38:20.340
2010-12-09T05:38:20.340
null
null
795
null
5287
2
null
5114
2
null
What about the [Kumaraswamy](http://en.wikipedia.org/wiki/Kumaraswamy_distribution) distribution, which has the following pdf: $$ f(x; a,b) = a b x^{a-1}{ (1-x^a)}^{b-1} $$ for $a>0$, $b>0$, $0 < x < 1$. This distribution can be [rescaled](http://en.wikipedia.org/wiki/Kumaraswamy_distribution#Generalizing_to_arbitr...
null
CC BY-SA 2.5
null
2010-12-09T10:07:54.657
2010-12-09T10:07:54.657
null
null
8
null
5288
1
5313
null
5
7743
I'm working in a piece of software designed for satellite image classification based on various features of objects in the image. The software provides various built-in features like the mean of the values in the object, the maximum and minimum of the values etc. However, I want to use the median of the values. I don't...
Calculate median without access to raw data
CC BY-SA 2.5
null
2010-12-09T10:11:07.247
2010-12-09T17:34:04.427
null
null
261
[ "descriptive-statistics", "mean" ]
5289
2
null
5288
9
null
If you know underlying distribution of the data, you can. For example, for normal distributed data, the mean and median are same (median=mode=mean). Or for exponential distribution with mean $\lambda^{-1}$ the median is $\lambda^{-1} ln(2)$. it is impossible to obtain median without having raw data or knowing the actu...
null
CC BY-SA 2.5
null
2010-12-09T10:36:27.497
2010-12-09T10:36:27.497
null
null
2148
null
5290
1
5338
null
0
7759
I have a time series with an exponential moving average and I want to calculate a moving return of the EMA over the last m periods (something like a smoothed moving return). Let's say: Y(t) is the value of the time series at time period t S(t) is the value of an EMA of Y at time period t Now R(t) is the return of the E...
Moving return of exponential moving average -- choice of alpha
CC BY-SA 2.5
null
2010-12-09T11:08:23.557
2021-01-31T18:15:08.157
2021-01-31T18:15:08.157
11887
2316
[ "time-series", "exponential-smoothing" ]
5291
2
null
4030
6
null
In [Johansen article](http://www.jstor.org/stable/2938278) VECM is specified with dummy variables. If your exogenous variables are strictly exogenous I see no reason why you cannot use original Johansen VECM, so look in the article how Johansen treats dummies. R package `vars` implements Johansen approach, where you c...
null
CC BY-SA 2.5
null
2010-12-09T12:09:12.687
2010-12-09T12:09:12.687
null
null
2116
null
5292
1
5301
null
73
128436
Is there any GUI for R that makes it easier for a beginner to start learning and programming in that language?
Good GUI for R suitable for a beginner wanting to learn programming in R?
CC BY-SA 3.0
null
2010-12-09T13:49:10.580
2017-05-06T07:25:03.283
2017-05-06T07:25:03.283
28666
1808
[ "r" ]
5293
1
null
null
6
3452
My name is Tuhin. I came up with a couple of questions when I was doing an analysis in R. I did a logistic regression analysis in R and tried to check how good the model fits the data. But, I got stuck as I could not get the pseudo R square value for the model which could give me some idea about the variation explained...
Find out pseudo R square value for a Logistic Regression analysis
CC BY-SA 2.5
null
2010-12-09T13:56:21.027
2010-12-09T17:18:23.010
2010-12-09T15:33:07.360
930
null
[ "r", "logistic", "goodness-of-fit" ]
5295
2
null
5249
2
null
I'm not quite sure why fixed text format with the appropriate meta data does not meet your criteria. It is not as simple to read as a delimiter but you need metadata to use the information anyway. The task of writing syntax to read the program simply depends on how large and complicated the structure of the dataset is....
null
CC BY-SA 2.5
null
2010-12-09T14:13:59.967
2010-12-09T14:13:59.967
2017-04-13T12:44:29.013
-1
1036
null
5296
2
null
5292
24
null
This has been answered [several times on StackOverflow](https://stackoverflow.com/questions/1439059/best-ide-texteditor-for-r). The top selections on there seem to consistently be Eclipse with StatET or Emacs with ESS. I wouldn't say that there are any good gui's to make it easier to learn the language. The closest t...
null
CC BY-SA 3.0
null
2010-12-09T14:32:36.933
2011-10-15T07:24:40.610
2017-05-23T12:39:26.203
-1
5
null
5297
2
null
5266
0
null
As @fabians noted, this can be done with logistic regression. You should investigate the inclusion of your predictor as an ordinal variable (not categorical) because with 9 levels you likely could model it that way and gain power. Then you can test for a linear effect or a quadratic effect etc. instead of ignoring the ...
null
CC BY-SA 2.5
null
2010-12-09T14:38:43.207
2010-12-09T14:38:43.207
null
null
2040
null
5298
2
null
5293
5
null
Take a look at the `lrm()` function from the [Design](http://cran.r-project.org/web/packages/Design/index.html) package. It features everything you need for fitting GLM. The Hosmer and Lemeshow test has limited power and depends on arbitrary discretization; it is discussed in Harrell, Regression Modeling Strategies (p....
null
CC BY-SA 2.5
null
2010-12-09T14:42:42.797
2010-12-09T15:04:18.770
2017-04-13T12:44:45.783
-1
930
null
5299
1
51167
null
2
2215
I am looking for applied references to data augmentation (preferably with some written code). Either online references are books would be great. I found this book online: [http://www.amazon.com/Bayesian-Missing-Data-Problems-Biostatistics/dp/142007749X/ref=sr_1_1?ie=UTF8&s=books&qid=1291905761&sr=1-1](http://rads.stac...
Data Augmentation Examples
CC BY-SA 2.5
0
2010-12-09T14:49:52.150
2017-01-24T02:55:51.520
2017-01-24T02:55:51.520
12359
2310
[ "markov-chain-montecarlo", "error", "mixture-distribution", "measurement", "data-augmentation" ]
5300
1
null
null
2
125
I have a set of data with 4 input variables and 1 result field (they're all numerical values). I want to determine the influence of variable #4 on the outcomes, so it makes sense to try to fix the other 3 inputs and the compare the results versus the value of var #4. I realize I'm probably using horrendous statistics t...
Fixing 3 variables to find the influence of a 4th?
CC BY-SA 2.5
null
2010-12-09T14:56:16.567
2010-12-09T15:34:47.920
null
null
2320
[ "correlation" ]
5301
2
null
5292
37
null
I would second @Shane's recommendation for [Deducer](http://www.deducer.org/pmwiki/pmwiki.php?n=Main.DeducerManual), and would also recommend [the R Commander](http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/) by John Fox. The CRAN package is [here](http://cran.r-project.org/web/packages/Rcmdr/index.html). It's called the...
null
CC BY-SA 3.0
null
2010-12-09T15:05:19.457
2011-10-15T07:24:31.043
2011-10-15T07:24:31.043
-1
null
null
5302
2
null
5300
4
null
Fit linear regression model: $Y=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_3+\beta_4X_4$ where $X_i$ are your input variables and $Y$ is the outcome. The interpretation of coefficient $\beta_4$ then is the size of change of Y if we change $X_4$ by one unit, holding other input variables constant.
null
CC BY-SA 2.5
null
2010-12-09T15:09:13.803
2010-12-09T15:34:47.920
2010-12-09T15:34:47.920
930
2116
null
5304
1
5320
null
52
39185
Dear everyone - I've noticed something strange that I can't explain, can you? In summary: the manual approach to calculating a confidence interval in a logistic regression model, and the R function `confint()` give different results. I've been going through Hosmer & Lemeshow's Applied logistic regression (2nd edition)....
Why is there a difference between manually calculating a logistic regression 95% confidence interval, and using the confint() function in R?
CC BY-SA 2.5
null
2010-12-09T15:41:59.660
2019-04-29T00:21:04.340
2019-04-29T00:21:04.340
11887
1991
[ "r", "regression", "logistic", "confidence-interval", "profile-likelihood" ]
5305
1
null
null
10
7501
I have an irregularly spaced `XTS` time series (with `POSIXct` values as index type). How can I build a new time series sampled at a let's say 10 minute interval, but with each sample moment aligned to a round time (13:00:00, 13:10:00, 13:20:00, ...). If a resampling moment doesn't fall exactly on a original series val...
How to re-sample an XTS time series in R?
CC BY-SA 2.5
null
2010-12-09T15:55:17.107
2019-07-23T22:27:26.160
2019-07-23T22:27:26.160
11887
749
[ "r", "time-series", "sampling", "unevenly-spaced-time-series" ]
5306
1
5309
null
7
6326
I'm trying to transition to `R` from using `SPSS`. In the past, I've setup my data in the wide format for my repeated measures ANOVAs in `SPSS`. How do I need to setup my data to run `nlme()`? The data is balanced. It has within-subjects variables of trial type(3 levels) each measured on 8 times, and a between-subjects...
How do I setup up repeated measures data for analysis with nlme()?
CC BY-SA 3.0
null
2010-12-09T15:55:42.223
2013-09-04T15:59:02.337
2013-09-04T15:59:02.337
21599
2322
[ "r", "mixed-model", "repeated-measures", "dataset", "lme4-nlme" ]
5307
2
null
5304
20
null
I believe if you look into the help file for confint() you will find that the confidence interval being constructed is a "profile" interval instead of a Wald confidence interval (your formula from HL).
null
CC BY-SA 2.5
null
2010-12-09T16:17:46.617
2010-12-09T16:17:46.617
null
null
2040
null
5308
1
5326
null
0
3879
For this dataset: ``` data my; input x y; datalines; -122.413582861209 37.7828877716232 -122.417876547159 37.7848288325307 ; proc print; run; ``` The output and related tables are: ![alt text](https://i.stack.imgur.com/lGS8r.png) How can I import, save and use these values to their maximum precision?
Read decimal values in SAS
CC BY-SA 2.5
null
2010-12-09T16:34:50.800
2015-07-08T21:52:33.730
2015-07-08T21:52:33.730
28666
1077
[ "sas" ]
5309
2
null
5306
4
null
Yes, you need to set up your data so that each grouping factor, dependendent variable and covariate corresponds to a column and every row contains one observation (i.e. long format): Everything that you enter into the model formulas for the random and fixed parts has to be a column in your data set. You can use `reshap...
null
CC BY-SA 2.5
null
2010-12-09T16:41:02.197
2010-12-09T16:41:02.197
null
null
1979
null
5310
2
null
5305
5
null
``` library(xts) ?endpoints ``` For instance ``` tmp=zoo(rnorm(1000), as.POSIXct("2010-02-1")+(1:1000)*60) tmp[endpoints(tmp, "minutes", 20)] ``` to subsample every 20 minutes. You might also want to check out `to.minutes`, `to.daily`, etc.
null
CC BY-SA 3.0
null
2010-12-09T17:01:30.993
2015-08-05T09:21:11.167
2015-08-05T09:21:11.167
67395
300
null
5311
2
null
5292
13
null
I think that the command line is the best interface, and especially for the beginners. The sooner you'll start with console, the sooner you'll find out that this is the fastest, the most comfortable and what's most important the only fully non-limiting way of using R.
null
CC BY-SA 2.5
null
2010-12-09T17:11:31.780
2010-12-09T17:11:31.780
null
null
null
null
5312
2
null
5293
1
null
Pseudo R Square is very easy to calculate manually. You just need to look up the -2LL value for the baseline based on the average probability of occurrence of the binomial event. And, you need the -2LL value for the actual Logistic regression. Let's say the -2LL value for the baseline is 10 and for the Logistic reg...
null
CC BY-SA 2.5
null
2010-12-09T17:18:23.010
2010-12-09T17:18:23.010
null
null
1329
null
5313
2
null
5288
6
null
The question can be construed as requesting a nonparametric estimator of the median of a sample in the form f(min, mean, max, sd). In this circumstance, by contemplating extreme (two-point) distributions, we can trivially establish that $$ 2\ \text{mean} - \text{max} \le \text{median} \le 2\ \text{mean} - \text{min}.$...
null
CC BY-SA 2.5
null
2010-12-09T17:34:04.427
2010-12-09T17:34:04.427
null
null
919
null
5314
2
null
5292
2
null
I used JGR for a short while, until it became apparent it would quickly consume all the memory on my system. I have not used it since, and recommend you do not use it.
null
CC BY-SA 2.5
null
2010-12-09T17:39:07.070
2010-12-09T17:39:07.070
null
null
795
null
5315
1
5322
null
2
405
I am relating age to a binary outcome in a logistic model (or, more to the point I would like to). However, the distribution of the ages looks like this: ``` nn <- 1000 age <- c(rpois(nn / 3, lambda = 0.5), rnorm(nn / 3, mean = 10, sd = 2), runif(nn / 3, min = 0, max = 15)) age <- age[which(age > 0)] ```...
How would you deal with a bimodally distributed predictor variable in bivariate logistic regression?
CC BY-SA 2.5
null
2010-12-09T17:56:04.053
2010-12-10T02:23:20.637
null
null
1991
[ "distributions", "logistic" ]
5316
2
null
5306
2
null
It's unlikely reshape will help you out if you're coming straight from SPSS files because you not only need it set up differently, you probably need different data than you were using in SPSS. In the standard repeated measures analysis you enter means of each individual condition for each subject into the analysis but...
null
CC BY-SA 2.5
null
2010-12-09T17:56:56.857
2010-12-09T17:56:56.857
null
null
601
null
5317
2
null
5290
1
null
This is actually a rather complex problem. There are a few directions you can look into. One way, typically recommended in the forecasting literature, is to optimize for the forecasting error. If you have a specific application in mind you can define your own cost function to optimize. A different view on this is to ...
null
CC BY-SA 2.5
null
2010-12-09T18:00:15.903
2010-12-09T18:00:15.903
null
null
300
null
5318
2
null
5306
2
null
NLME relies on a "univariate" as opposed to "multi-variate" data structure. See the description below, copied from my response to another question here: [Data manipulation in R for functional data analysis](https://stats.stackexchange.com/questions/3702/data-manipulation-in-r-for-functional-data-analysis/3705#3705) As...
null
CC BY-SA 2.5
null
2010-12-09T18:55:54.040
2010-12-09T18:55:54.040
2017-04-13T12:44:48.803
-1
485
null
5319
2
null
5305
2
null
I'm still not sure what you're trying to do and I still think an example would help, but I thought I'd guess that you may be interested in `align.time`. ``` # Compare this: tmp[endpoints(tmp, "minutes", 20)] # with this: align.time( tmp[endpoints(tmp, "minutes", 20)], n=60*20 ) ```
null
CC BY-SA 2.5
null
2010-12-09T18:58:39.610
2010-12-09T18:58:39.610
null
null
1657
null
5320
2
null
5304
48
null
After having fetched the data from the [accompanying website](http://www.ats.ucla.edu/stat/Stata/examples/alr2/), here is how I would do it: ``` chdage <- read.table("chdage.dat", header=F, col.names=c("id","age","chd")) chdage$aged <- ifelse(chdage$age>=55, 1, 0) mod.lr <- glm(chd ~ aged, data=chdage, family=binomial)...
null
CC BY-SA 3.0
null
2010-12-09T19:00:23.177
2017-01-22T23:19:58.883
2017-01-22T23:19:58.883
89665
930
null
5321
1
5334
null
4
3782
I'm implementing PCA using eigenvalue decomposition in Matlab. I know Matlab has PCA implemented, but it helps me understand all the technicalities when I write code. I've been following the guidance from [here](http://books.google.com/books?id=bXzAlkODwa8C&lpg=PA647&dq=eigenvalue%20decomposition&pg=PA647#v=onepage&q&f...
Problems with implementing PCA in Matlab
CC BY-SA 3.0
null
2010-12-09T19:07:48.340
2015-02-04T14:11:22.420
2015-02-04T14:11:22.420
28666
1371
[ "machine-learning", "pca", "matlab" ]
5322
2
null
5315
7
null
Logistic (or other) regression does not make any assumptions about the distribution of the predictors, they are only assumed to be known exactly. So there is nothing stopping you from going ahead and using age in your regression model. The issue you have to actually worry about is whether the effect of age is linear on...
null
CC BY-SA 2.5
null
2010-12-09T19:35:12.803
2010-12-09T19:35:12.803
null
null
279
null
5323
2
null
5315
2
null
@andrew: I personally like a simple approach which is to create a logit plot where I would do something along the lines of binning age into 10 groups (deciles) and plotting the logit against these bins. This gives a sense for the linearity of the variable in the logit and may suggest a transformation.
null
CC BY-SA 2.5
null
2010-12-09T20:02:54.003
2010-12-09T20:02:54.003
null
null
2040
null
5324
2
null
5292
4
null
Personally ESS, but as stated above i have found Rcmdr very easy to use.
null
CC BY-SA 2.5
null
2010-12-09T21:31:56.837
2010-12-09T21:31:56.837
null
null
2262
null
5325
2
null
5250
31
null
If `time` and `Genotype` are both categorical predictors as they appear to be, and you are interested in comparing all time/Genotype pairs to each other, then you can just create one interaction variable, and use Tukey contrasts on it: ``` weights$TimeGeno <- interaction(weigths$Time, weights$Geno) model <- lme(weight ...
null
CC BY-SA 3.0
null
2010-12-09T21:44:24.397
2015-10-28T21:18:42.730
2015-10-28T21:18:42.730
279
279
null
5326
2
null
5308
4
null
The full precision value is there, you just don't see it. SAS uses formats to control what it prints/shows, even if you don't notice it (there are default numeric and character formats). Try using `FORMAT x y 17.12;` either in the data step to set it permanently, or in the `PROC PRINT` step to set it temporarily.
null
CC BY-SA 2.5
null
2010-12-09T21:50:21.977
2010-12-10T06:47:56.540
2010-12-10T06:47:56.540
183
279
null
5327
1
6508
null
11
28089
My (very basic) knowledge of the Tobit regression model isn't from a class, like I would prefer. Instead, I have picked up pieces of information here and there through several Internet searches. My best guess at the assumptions for truncated regression are that they are very similar to the ordinary least squares (OLS) ...
What are the assumptions for applying a Tobit regression model?
CC BY-SA 2.5
null
2010-12-10T00:54:26.633
2017-03-13T00:07:50.723
2011-01-24T20:30:24.627
1583
1583
[ "regression", "assumptions" ]
5328
2
null
4451
1
null
Facebook social graph, application installations and Last.fm users, events, groups at [http://odysseas.calit2.uci.edu/research/](http://odysseas.calit2.uci.edu/research/) Two datasets (collected April-May 2009) which contain representative samples of ~1 million users Facebook-wide, with a few annotated properties: for ...
null
CC BY-SA 2.5
null
2010-12-10T01:12:14.670
2010-12-10T01:12:14.670
null
null
null
null
5329
1
5337
null
2
250
I want to cluster a graph using the FCM algorithm, I used the adjacency matrix of the graph as the data, and the "Euclidean" distance as metric. The problem is that the adjacency matrix is full of zero's (depends actually on the degree of the node) and my network is a kinda huge more than 2000 node. For the results I ...
Are there any conditions on the data in Fuzzy c-mean clustering?
CC BY-SA 4.0
null
2010-12-10T01:40:31.767
2020-09-23T00:09:52.293
2020-09-23T00:09:52.293
11887
2325
[ "clustering", "fuzzy", "fuzzy-c-means-clustering" ]
5330
1
5335
null
1
1783
Hi my apologies first, I'm a biologist and not so good in statistics. In my study I'm studying the effect of concentration of feed on growth of a certain specimen. I have with me the different concentrations and the growth data for each concentration. What do you suggest is the best statistical test to find out the bes...
Which test to find out best concentration (the one having maximum effect)?
CC BY-SA 2.5
null
2010-12-10T01:44:12.643
2010-12-10T08:09:31.127
null
null
null
[ "regression", "mathematical-statistics" ]
5331
2
null
5315
0
null
If binning the age variable is an option, you might want to use a classification tree to get an idea of where to place the cutoffs.
null
CC BY-SA 2.5
null
2010-12-10T02:23:20.637
2010-12-10T02:23:20.637
null
null
1945
null
5332
2
null
5292
2
null
I recommend [Tinn-R](http://www.sciviews.org/Tinn-R/) (Which is the acronym for Tinn is not Notepad)
null
CC BY-SA 2.5
null
2010-12-10T02:48:55.077
2010-12-10T07:08:08.270
2010-12-10T07:08:08.270
1709
1709
null
5333
1
5374
null
5
4640
I have a linear mixed-effect model which I hope will answer the question of whether an increase in the frequency of use of one word leads to an increase of the frequency of use of that word by another person in a conversation, factoring out random effects of subject and topic of conversation. The basic model I've come ...
Interpreting correlation from two linear mixed-effect models
CC BY-SA 2.5
null
2010-12-10T03:04:44.617
2010-12-11T11:52:26.187
2010-12-10T18:15:33.003
52
52
[ "r", "mixed-model" ]
5334
2
null
5321
4
null
The line `[Ev,Vals] = sort(Ev,Vals);` probably does not do what you think it should. The sort command would have to be applied separately. Moreover, `eig` returns a diagonal matrix of eigenvalues, which you have to strip out to a vector. Probably you want to do the following: ``` [Ev, Vals] = eig(L); Vals = diag(Vals)...
null
CC BY-SA 2.5
null
2010-12-10T03:25:24.200
2010-12-10T03:25:24.200
null
null
795
null
5335
2
null
5330
2
null
It sounds like an ANOVA (analysis of variance) setting, except that usually ANOVA is used to ask the question whether there are differences in growth between the concentrations. If you used ANOVA and found that there is a difference, then it wouldn't indicate which is the "best" one, just that they are different. There...
null
CC BY-SA 2.5
null
2010-12-10T03:30:21.893
2010-12-10T03:30:21.893
null
null
1945
null
5337
2
null
5329
0
null
Different types of measures that form the matrix may be used to identify the cell values, where the measure controls how the clusters are formed. Some examples of values that can be used as measures include minimum distance from one node to the other, the degree of connectivity of each node and the amount of nodes need...
null
CC BY-SA 2.5
null
2010-12-10T04:39:47.820
2010-12-10T04:39:47.820
null
null
1808
null
5338
2
null
5290
3
null
N itself is often set in an arbitrary manner that makes sense for the application. Frankly the alpha = 2/(N+1) is also somewhat arbitrary, [http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm](http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm) suggests instead doing an optimization that minimi...
null
CC BY-SA 2.5
null
2010-12-10T05:49:12.900
2010-12-10T05:49:12.900
null
null
2073
null
5339
2
null
5330
1
null
If you have growth curves from each feed concentration, with time on the x-axis, you'll first want to estimate the growth from each curve. % change at the end points may be sufficient for your purposes, but to use all of your data consider looking to fitting some kind of model to each growth curve with a regression. Th...
null
CC BY-SA 2.5
null
2010-12-10T06:07:01.160
2010-12-10T06:07:01.160
null
null
2073
null
5340
1
5357
null
5
31134
In Excel or Google Docs you can readily construct a Cumulative Distribution Function for the Normal distribution using the NORMDIST function (X, Mean, Standard Deviation). I am trying to do the same for a Lognormal distribution using the LOGNORMALDIST function that has the same parameters (X, Mean, Standard Deviation)...
How to use the LOGNORMALDIST function to generate a Cumulative Distribution Function?
CC BY-SA 2.5
null
2010-12-10T06:17:00.830
2010-12-10T17:11:44.917
2010-12-10T17:11:44.917
919
1329
[ "distributions", "excel", "p-value" ]
5341
2
null
5330
2
null
Are you not looking after method for studying [dose-response relationship](http://en.wikipedia.org/wiki/Dose-response_relationship)? From the description you gave, I guess your growth curves are highly non-linear. Moreover, the problem of using simple ANOVA to compare two growth curve (i.e., equivalent to a time course...
null
CC BY-SA 2.5
null
2010-12-10T08:09:31.127
2010-12-10T08:09:31.127
null
null
930
null
5342
2
null
5340
4
null
On Microsoft Office for Mac 2008 `LOGNORMDIST(5;1;1)` gives `0,728882893` in Excel. On R `plnorm(5,1,1)` gives `0.7288829`. In R you need to supply mean and standard deviation on log scale, so it seems that in Excel you need to do the same.
null
CC BY-SA 2.5
null
2010-12-10T08:19:06.807
2010-12-10T08:19:06.807
null
null
2116
null
5343
1
null
null
4
1515
I am trying to predict the outcome of a random variable x, which is a real-valued number. In some cases I can observe another variable y1, which should approximate x. I model y1 as a Gaussian distribution with mean of 0 and an empirically estimated standard deviation, and use the probability density function of that Ga...
Combining Probability Density Functions
CC BY-SA 2.5
null
2010-12-10T08:20:25.247
2010-12-12T19:04:16.523
2010-12-10T17:25:18.083
2328
2328
[ "distributions", "probability", "normal-distribution" ]
5344
1
5345
null
97
59253
I have fit a few mixed effects models (particularly longitudinal models) using `lme4` in `R` but would like to really master the models and the code that goes with them. However, before diving in with both feet (and buying some books) I want to be sure that I am learning the right library. I have used `lme4` up to now ...
How to choose nlme or lme4 R library for mixed effects models?
CC BY-SA 4.0
null
2010-12-10T09:31:14.580
2023-01-04T20:17:15.790
2023-01-04T20:17:15.790
119468
199
[ "r", "mixed-model", "lme4-nlme" ]
5345
2
null
5344
77
null
Both packages use `Lattice` as the backend, but `nlme` has some nice features like `groupedData()` and `lmList()` that are lacking in `lme4` (IMO). From a practical perspective, the two most important criteria seem, however, that - lme4 extends nlme with other link functions: in nlme, you cannot fit outcomes whose dis...
null
CC BY-SA 3.0
null
2010-12-10T10:40:25.643
2015-01-23T12:11:27.467
2015-01-23T12:11:27.467
35034
930
null
5346
1
null
null
8
6812
I understand that in One-Way ANOVA two alternative F-Ratios have been derived to be robust when homogeneity of variance has been violated. Tomarkin and Serlin (1986) review amongst other techniques the Brown-Forsythe and Welch F-Ratios and conclude that both control the type I error rate well. So far I have only come a...
Brown-Forsythe and Welch f-ratios in two-way ANOVAs?
CC BY-SA 2.5
null
2010-12-10T10:54:27.050
2016-09-05T14:04:50.877
2010-12-10T11:03:12.177
null
null
[ "anova", "heteroscedasticity" ]
5347
1
5358
null
43
13545
I am modeling a random variable ($Y$) which is the sum of some ~15-40k independent Bernoulli random variables ($X_i$), each with a different success probability ($p_i$). Formally, $Y=\sum X_i$ where $\Pr(X_i=1)=p_i$ and $\Pr(X_i=0)=1-p_i$. I am interested in quickly answering queries such as $\Pr(Y\leq k)$ (where $k$ i...
How can I efficiently model the sum of Bernoulli random variables?
CC BY-SA 4.0
null
2010-12-10T11:06:05.337
2023-04-29T06:26:57.767
2023-04-29T06:26:57.767
362671
634
[ "r", "distributions", "binomial-distribution", "random-variable", "poisson-binomial-distribution" ]
5349
2
null
5347
8
null
With different $p_i$ your best bet I think is normal approximation. Let $B_n=\sum_{i=1}^np_i(1-p_i)$. Then \begin{align*} B_n^{-1/2}\left(\sum_{i=1}^nX_i-\sum_{i=1}^np_i\right)\to N(0,1), \end{align*} as $n\to\infty$, provided that for each $\varepsilon>0$ \begin{align*} B_n^{-1}\sum_{i=1}^nE\left((X_i-p_i)^2\mathbf{1}...
null
CC BY-SA 3.0
null
2010-12-10T12:06:50.643
2013-11-21T11:13:07.207
2013-11-21T11:13:07.207
2116
2116
null
5350
2
null
5344
56
null
As chl pointed out, the main difference is what kind of variance-covariance structure you can specify for the random effects. In `lme4` you can specify either: - diagonal covariance structures (i.e., enforce mutually uncorrelated random effects via syntax like ~ (1 | group)+ (0 + x1 | group) + (0 + x2 | group)) - or ...
null
CC BY-SA 2.5
null
2010-12-10T13:18:17.567
2010-12-10T13:18:17.567
null
null
1979
null
5351
1
5428
null
14
9371
I asked this [question](https://stackoverflow.com/questions/4403433/calculate-newy-west-standard-errors-without-an-an-lm-object-in-r) yesterday on StackOverflow, and got an answer, but we agreed that it seems a bit hackish and there may be a better way to look at it. The question: I would like calculate the Newey-West ...
Calculate Newey-West standard errors without an lm object in R
CC BY-SA 2.5
null
2010-12-10T14:30:40.167
2014-01-02T14:13:55.960
2017-05-23T12:39:26.203
-1
1445
[ "r", "standard-error", "autocorrelation", "heteroscedasticity" ]
5352
1
5353
null
4
363
I have a dataset where the difficulty level of my items and skill of my participants is unknown, but I would like to be able to extract some metric of how individual participants do on the test. What comes to mind initially is to use an item response theory model. However, I have two a priori constraints that makes me...
Is there a way to place a priori constraints on item difficulty under item response theory?
CC BY-SA 2.5
null
2010-12-10T15:17:37.817
2016-10-04T11:33:14.597
2016-10-04T11:33:14.597
35989
196
[ "psychometrics", "item-response-theory" ]
5353
2
null
5352
5
null
Off the shelf, the various software offerings from SSI may do what you want. If I wanted to enforce the constraint, and I didn't have too much data, then I'd switch into a BUGS / JAGS MCMC framework for modelling. I'd use the LSAT example in book 2 of the worked examples (contained in the JAGS distribution or as a se...
null
CC BY-SA 2.5
null
2010-12-10T16:15:26.540
2010-12-10T16:15:26.540
null
null
1739
null
5354
1
5356
null
49
151056
I've got some data about airline flights (in a data frame called `flights`) and I would like to see if the flight time has any effect on the probability of a significantly delayed arrival (meaning 10 or more minutes). I figured I'd use logistic regression, with the flight time as the predictor and whether or not each f...
Logistic regression model does not converge
CC BY-SA 2.5
null
2010-12-10T16:28:53.980
2021-07-15T01:28:11.177
2016-01-19T18:50:12.203
22311
1973
[ "r", "logistic", "separation" ]
5356
2
null
5354
40
null
`glm()` uses an iterative re-weighted least squares algorithm. The algorithm hit the maximum number of allowed iterations before signalling convergence. The default, documented in `?glm.control` is 25. You pass control parameters as a list in the `glm` call: ``` delay.model <- glm(BigDelay ~ ArrDelay, data=flights, fam...
null
CC BY-SA 4.0
null
2010-12-10T17:00:15.503
2021-07-15T01:28:11.177
2021-07-15T01:28:11.177
182175
1390
null