## Solving for Conditional Variance

I am working on a problem and am a little bit confused.

The problem:

P(X=0,Y=0) = .80

P(X=1,Y=0) = .05

P(X=0,Y=1) = .025

P(X=1,Y=1) = .125

Find Var(Y|X=1)

What I have done so far: (using)

E(Y$$^2$$|X=1) – $$\big($$E(Y|X=1)$$\big) ^2$$

But with this I have been getting:

E(Y|X=1) = $$(0)(.05) + (1)(.125)\over(.05+.125)$$ = .71

and

E(Y$$^2$$|X=1) = $$(0)^2(.05) + (1)^2(.125)\over(.05+.125)$$ = .71

But with this we get the same answer so that when we do E(X$$^2$$) – (EX)$$^2$$

We get:

.71 – .71 = 0

This doesn’t seem like it is the right answer to me?

Posted on Categories proxies

## Error Fix Xcode 10, Swift 4 initializer for conditional must have optional.

So I’m working on a savings app using a table view controller. I ran into an error, and I couldn’t find a fix.

if let sourceViewController = sender.source as? SavingsTableViewController, let saving = sourceViewController.savings {         let newIndexPath = IndexPath(row: saving.count, section: 0)         saving.append(saving)         SavingsTableViewController.insertRows(at: [newIndexPath], with: .automatic)     } 

The error shows up as Initializer for conditional binding must have Optional type, not ‘[Savings]’

Thanks for the help!

Posted on Categories shared proxies