scope

Why does R update function changes glmer fit when called with 1 argument?

女生的网名这么多〃 提交于 2020-01-24 13:12:05
问题 Below is a simplified code reproducing what looks to me like a problem with R update function: library('lme4') f <- function(formula) { data <- data.frame(a = c(4, 5), rowi = c(1, 2), b = c(2, 2)) fit0 <- glmer(formula, data = data, family = poisson(log)) fit1 <- update(fit0) cat('f likelihoods: ', logLik(fit0), logLik(fit1), '\n') } g <- function() { f(a ~ -1 + (1|rowi) + offset(b)) data <- data.frame(a = c(4, 5), rowi = c(1, 2), b = c(20, 40)) f(a ~ -1 + (1|rowi) + offset(b)) cat('g

JavaScript variable scope question: to var, or not to var

六眼飞鱼酱① 提交于 2020-01-24 11:56:11
问题 Many thanks in advance. I'm working out of a schoolbook and they're using one function to call another which opens a window: function rtest(){ content='dans window'; oneWindow=open("","Window 1","width=450,height=290"); newWindow(oneWindow); } function newWindow(x){ x.document.close(); x.document.open(); x.document.write(content); x.document.close(); x.moveTo(20,20); x.focus(); } So everything works fine, but my question is this: how is the newWindow() function able to access the contents of

JSF 2 Custom Scope usage

微笑、不失礼 提交于 2020-01-24 07:19:53
问题 I am going through all the scopes in JSF2.0. I am a little confused about when to use custom Scope. Any specific use cases it will be useful. Initially I thought I can use it for scope spanning multiple pages like three page registration etc. But looks like we cannot use it there. 回答1: Better late than never: I wrote an article about the usage custom scopes in JSF2 : JSF 2 Custom Scopes without 3rd party libraries 回答2: Well, the general idea is to create your own Scope for what ever you like

Scope of var and variables

余生长醉 提交于 2020-01-24 06:16:52
问题 If I have a function like <cfscript> function say(what) { var a = what; variables.b = what; return what; } </cfscript> I thought the scope of a was variables , but dumping variables returns just b . What is the scope of a? 回答1: Declaring a variable using the var keyword puts it into the local scope, not the variables scope. 回答2: This really is a comment, but it is way too long. Consider the following code <cfscript> function doMath() { var a = 1; local.b = 2; return a + local.b; } </cfscript>

Scope of var and variables

半城伤御伤魂 提交于 2020-01-24 06:16:29
问题 If I have a function like <cfscript> function say(what) { var a = what; variables.b = what; return what; } </cfscript> I thought the scope of a was variables , but dumping variables returns just b . What is the scope of a? 回答1: Declaring a variable using the var keyword puts it into the local scope, not the variables scope. 回答2: This really is a comment, but it is way too long. Consider the following code <cfscript> function doMath() { var a = 1; local.b = 2; return a + local.b; } </cfscript>

Calling a function by a string in JavaScript and staying in scope

≡放荡痞女 提交于 2020-01-24 01:22:29
问题 I've been playing around and searching a bit, but I can't figure this out. I have a pseudo private function within a JavaScript object that needs to get called via eval (because the name of the function is built dynamically). However, the function is hidden from the global scope by a closure and I cannot figure out how to reference it using eval(). Ex: var myObject = function(){ var privateFunctionNeedsToBeCalled = function() { alert('gets here'); }; return { publicFunction: function

Accessing variable in another function, returns undefined - JavaScript

 ̄綄美尐妖づ 提交于 2020-01-24 01:02:48
问题 I am trying to access a variable which exists in another function, but I am not able to, it gives me undefined for the function through which (getMess() as below) I am doing that. As per the code below, I want the "value1" accessed through myfunction1, as shown below. Code: var namespace ={ myfunction1: function(){ namespace.myfunction2.getMess(); // I need to access value1 here in this function }, myfunction2: function(message1,message2){ var value1 = message1; var value2 = message2; return{

AngularJS two-way data binding not working properly in directive

纵饮孤独 提交于 2020-01-24 00:29:08
问题 i am trying to implement radio-button list using ng-repeat. typeList.html <div ng-repeat="type in types" > <input type="radio" id={{type.id}} name="{{type.name}}" ng-model="result" ng-value="type.id" > {{type.name}} <div> Result {{result}} </div> //result is changing only in the row of clicked radio-button. It should change in every row.(two way data-binding). </div> Directive: angular.module('app').directive('myList',function(){ return{ restrict: 'A', scope: { types: '=', //here list is

Is there a scope for (numpy) random seeds?

不想你离开。 提交于 2020-01-23 07:48:32
问题 My question is related to What is the scope of a random seed in Python? . In the case of above question, it is clarified that there is a (hidden) global Random() instance in the module for random . 1) I would like to clarify whether setting the random seed in one module will cause this to be the random seed in other modules and whether there are certain things to be aware of. For instance: Given: moduleA.py, moduleB.py moduleA.py: import random import moduleB random.seed(my_seed) moduleB

Is there a scope for (numpy) random seeds?

旧时模样 提交于 2020-01-23 07:48:23
问题 My question is related to What is the scope of a random seed in Python? . In the case of above question, it is clarified that there is a (hidden) global Random() instance in the module for random . 1) I would like to clarify whether setting the random seed in one module will cause this to be the random seed in other modules and whether there are certain things to be aware of. For instance: Given: moduleA.py, moduleB.py moduleA.py: import random import moduleB random.seed(my_seed) moduleB